Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Alberto Arcones Méndez
HUGO1-1
Commits
b11d885f
Commit
b11d885f
authored
1 year ago
by
alberto
Browse files
Options
Download
Email Patches
Plain Diff
Histograma creado y funcionando.
parent
469b7be8
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
157 additions
and
39 deletions
+157
-39
source/hugo/graphics/neuriteG.cpp
source/hugo/graphics/neuriteG.cpp
+4
-0
source/hugo/graphics/neuriteG.h
source/hugo/graphics/neuriteG.h
+1
-0
source/hugo/graphics/neuronG.cpp
source/hugo/graphics/neuronG.cpp
+11
-0
source/hugo/graphics/neuronG.h
source/hugo/graphics/neuronG.h
+3
-0
source/hugo/graphics/sectionH.cpp
source/hugo/graphics/sectionH.cpp
+26
-1
source/hugo/graphics/sectionH.h
source/hugo/graphics/sectionH.h
+2
-0
source/hugo/mainwindow.cpp
source/hugo/mainwindow.cpp
+45
-24
source/hugo/myOpenGLWidget2D.cpp
source/hugo/myOpenGLWidget2D.cpp
+4
-0
source/hugo/myOpenGLWidget2D.h
source/hugo/myOpenGLWidget2D.h
+2
-0
source/hugo/openGLDialog.cpp
source/hugo/openGLDialog.cpp
+51
-12
source/hugo/openGLDialog.h
source/hugo/openGLDialog.h
+8
-2
No files found.
source/hugo/graphics/neuriteG.cpp
View file @
b11d885f
...
...
@@ -558,3 +558,7 @@ float neuriteG::getGrosor() const {
return
gr
;
}
void
neuriteG
::
cont_points_neu
(
int
*
aux
,
float
separador
,
float
crecimiento
)
{
firstSection
->
cont_points_neu
(
aux
,
separador
,
crecimiento
);
}
This diff is collapsed.
Click to expand it.
source/hugo/graphics/neuriteG.h
View file @
b11d885f
...
...
@@ -127,6 +127,7 @@ con un desplazamiento de X y otro desplazamiento de Y*/
float
getTamm
()
const
;
float
getGrosor
()
const
;
void
cont_points_neu
(
int
aux
[
9
],
float
separador
,
float
crecimiento
);
protected:
virtual
void
putColor
()
=
0
;
...
...
This diff is collapsed.
Click to expand it.
source/hugo/graphics/neuronG.cpp
View file @
b11d885f
...
...
@@ -518,6 +518,17 @@ bool neuronG::compararNodosDend(const dendriteG &d1, const dendriteG &d2) {
return
d1
.
getTerminalNodes
()
<
d2
.
getTerminalNodes
();
}
void
neuronG
::
cont_points_neu
(
int
*
aux
,
float
separador
,
float
crecimiento
)
{
for
(
auto
axi
:
ax
)
{
axi
->
cont_points_neu
(
aux
,
separador
,
crecimiento
);
}
for
(
auto
&
item
:
dends
)
{
item
.
cont_points_neu
(
aux
,
separador
,
crecimiento
);
}
}
This diff is collapsed.
Click to expand it.
source/hugo/graphics/neuronG.h
View file @
b11d885f
...
...
@@ -75,6 +75,9 @@ public:
void
setVarPosDend
(
VarPosDendritas
varPosDend
);
void
cont_points_neu
(
int
aux
[
9
],
float
separador
,
float
crecimiento
);
private:
void
tamMaxSeccion
();
void
tamMaxP1P2Seccion
();
...
...
This diff is collapsed.
Click to expand it.
source/hugo/graphics/sectionH.cpp
View file @
b11d885f
...
...
@@ -523,4 +523,29 @@ float sectionH::distanciaEntreRegistrosV(Eigen::Vector3f r1, Eigen::Vector3f r2)
std
::
pow
(
r1
[
1
]
-
r2
[
1
]
/
100
,
2
)
+
std
::
pow
(
r1
[
2
]
-
r2
[
2
]
/
100
,
2
));
}
\ No newline at end of file
}
void
sectionH
::
cont_points_neu
(
int
*
aux
,
float
separador
,
float
crecimiento
)
{
Eigen
::
Vector3f
na
(
0
,
0
,
0
);
float
valor
=
distanciaEntreRegistrosV
(
na
,
sec
->
firstNode
()
->
point
());
int
i
=
0
;
bool
encontrado
=
false
;
float
sep
=
separador
;
do
{
if
(
valor
<
sep
){
encontrado
=
true
;
aux
[
i
]
=
aux
[
i
]
+
1
;
}
sep
+=
crecimiento
;
i
++
;
}
while
(
i
<
8
&&
!
encontrado
);
if
(
!
encontrado
){
aux
[
8
]
=
aux
[
8
]
+
1
;
}
if
(
sectionsHijas
.
size
()
==
2
)
{
sectionsHijas
[
0
]
->
cont_points_neu
(
aux
,
separador
,
crecimiento
);
sectionsHijas
[
1
]
->
cont_points_neu
(
aux
,
separador
,
crecimiento
);
}
}
This diff is collapsed.
Click to expand it.
source/hugo/graphics/sectionH.h
View file @
b11d885f
...
...
@@ -59,6 +59,8 @@ public:
nsol
::
NeuronMorphologySection
*
getSec
()
const
;
void
cont_points_neu
(
int
aux
[
9
],
float
separador
,
float
crecimiento
);
private:
float
distanciaEntreRegistros
(
nsol
::
Node
*
r1
,
nsol
::
Node
*
r2
);
float
areaCono
(
nsol
::
Node
*
r1
,
nsol
::
Node
*
r2
);
...
...
This diff is collapsed.
Click to expand it.
source/hugo/mainwindow.cpp
View file @
b11d885f
...
...
@@ -67,6 +67,8 @@ MainWindow::MainWindow(QWidget *parent)
ui
->
loadButton
->
setToolTip
(
"Carga de ruta de ficheros .SWC"
);
ui
->
grafica_sol
->
setEnabled
(
false
);
}
...
...
@@ -135,15 +137,6 @@ void MainWindow::save() {
}
}
////Selecciono el objeto de la list que pinto y se lo mando a qopenGLWidget
//void MainWindow::selecction() {
// int index = ui->list->currentIndex();
// if(index<base->getList().size()){
// _openGLWidget->setGraphicsObject(base->get(index));
// openGLWidget2d->setNeuronGraphic(base->get(index));
// elementosCargados->addItem(base->get(index)->getName());
// }
//}
//Selecciono el objeto de la list que pinto y se lo mando a qopenGLWidget
void
MainWindow
::
selecction
()
{
...
...
@@ -395,6 +388,7 @@ void MainWindow::set_dend() {
openGLWidget2d
->
setEsquema
(
false
);
openGLWidget2d
->
setDrawCircle
(
false
);
_openGLWidget
->
setDrawCircle
(
false
);
ui
->
grafica_sol
->
setEnabled
(
false
);
}
...
...
@@ -404,6 +398,7 @@ void MainWindow::set_nada(){
openGLWidget2d
->
setEsquema
(
false
);
openGLWidget2d
->
setDrawCircle
(
false
);
_openGLWidget
->
setDrawCircle
(
false
);
ui
->
grafica_sol
->
setEnabled
(
false
);
...
...
@@ -415,6 +410,7 @@ void MainWindow::set_tree() {
openGLWidget2d
->
setEsquema
(
false
);
openGLWidget2d
->
setDrawCircle
(
false
);
_openGLWidget
->
setDrawCircle
(
false
);
ui
->
grafica_sol
->
setEnabled
(
false
);
}
void
MainWindow
::
set_esq
()
{
...
...
@@ -423,8 +419,22 @@ void MainWindow::set_esq() {
openGLWidget2d
->
setEsquema
(
true
);
openGLWidget2d
->
setDrawCircle
(
false
);
_openGLWidget
->
setDrawCircle
(
false
);
ui
->
grafica_sol
->
setEnabled
(
false
);
}
void
MainWindow
::
setCirculos
()
{
openGLWidget2d
->
setDrawCircle
(
ui
->
setCirculos
->
isChecked
());
_openGLWidget
->
setDrawCircle
(
ui
->
setCirculos
->
isChecked
());
ui
->
grafica_sol
->
setEnabled
(
true
);
if
(
ui
->
setCirculos
->
isChecked
())
{
openGLWidget2d
->
setDendograma
(
false
);
openGLWidget2d
->
setTree
(
false
);
openGLWidget2d
->
setEsquema
(
false
);
}
}
void
MainWindow
::
resetButtons
()
{
ui
->
igualGrosor
->
setChecked
(
true
);
...
...
@@ -442,20 +452,15 @@ void MainWindow::resetButtons() {
ui
->
terminales_ang
->
setChecked
(
false
);
ui
->
tamanoComboBox
->
setCurrentIndex
(
2
);
openGLWidget2d
->
setDrawCircle
(
false
);
_openGLWidget
->
setDrawCircle
(
false
);
}
ui
->
grafica_sol
->
setEnabled
(
false
);
void
MainWindow
::
setCirculos
()
{
openGLWidget2d
->
setDrawCircle
(
ui
->
setCirculos
->
isChecked
());
_openGLWidget
->
setDrawCircle
(
ui
->
setCirculos
->
isChecked
());
if
(
ui
->
setCirculos
->
isChecked
())
{
openGLWidget2d
->
setDendograma
(
false
);
openGLWidget2d
->
setTree
(
false
);
openGLWidget2d
->
setEsquema
(
false
);
}
}
void
MainWindow
::
set_dend_ord_normal
()
{
openGLWidget2d
->
setPosDendrita
(
VarPosDendritas
::
Normal
);
}
...
...
@@ -474,17 +479,33 @@ void MainWindow::set_dend_ord_nodos() {
void
MainWindow
::
create_graphic
()
{
QDialog
dialog
(
this
);
dialog
.
setWindowTitle
(
"
Ventana Emergente
"
);
dialog
.
setWindowTitle
(
"
Histograma
"
);
dialog
.
setGeometry
(
300
,
300
,
500
,
500
);
if
(
!
openGLWidget2d
->
getNeuronGraphic
().
empty
())
{
openGLDialog
*
glWidget
=
new
openGLDialog
(
&
dialog
);
neuronG
*
neu
;
neu
=
openGLWidget2d
->
getNeuronGraphic
()[
0
];
int
*
aux
=
new
int
[
9
];
for
(
int
i
=
0
;
i
<
9
;
i
++
){
aux
[
i
]
=
0
;
}
neu
->
cont_points_neu
(
aux
,
0.2
,
0.8
);
QVBoxLayout
*
layout
=
new
QVBoxLayout
(
&
dialog
);
glWidget
->
update
();
layout
->
addWidget
(
glWidget
);
dialog
.
setLayout
(
layout
);
openGLDialog
*
glWidget
=
new
openGLDialog
(
&
dialog
);
glWidget
->
anadir_nodos_por_punto
(
aux
);
QVBoxLayout
*
layout
=
new
QVBoxLayout
(
&
dialog
);
glWidget
->
update
();
layout
->
addWidget
(
glWidget
);
dialog
.
setLayout
(
layout
);
}
else
{
dialog
.
setWindowTitle
(
"No esta activada esta opcion"
);
}
dialog
.
exec
();
}
...
...
This diff is collapsed.
Click to expand it.
source/hugo/myOpenGLWidget2D.cpp
View file @
b11d885f
...
...
@@ -370,3 +370,7 @@ void myOpenGLWidget2D::setPosDendrita(VarPosDendritas vpd) {
update
();
}
const
std
::
vector
<
neuronG
*>
&
myOpenGLWidget2D
::
getNeuronGraphic
()
const
{
return
neuronGraphic
;
}
This diff is collapsed.
Click to expand it.
source/hugo/myOpenGLWidget2D.h
View file @
b11d885f
...
...
@@ -57,6 +57,8 @@ public:
void
setPosDendrita
(
VarPosDendritas
vpd
);
const
std
::
vector
<
neuronG
*>
&
getNeuronGraphic
()
const
;
protected:
void
paintGL
()
override
;
void
resizeGL
(
int
w
,
int
h
)
override
;
...
...
This diff is collapsed.
Click to expand it.
source/hugo/openGLDialog.cpp
View file @
b11d885f
...
...
@@ -2,6 +2,7 @@
// Created by alberto on 11/09/23.
//
#include <iostream>
#include "openGLDialog.h"
void
openGLDialog
::
paintGL
()
{
...
...
@@ -10,20 +11,52 @@ void openGLDialog::paintGL() {
QFont
font
;
font
.
setPixelSize
(
24
);
// Tamaño de fuente
painter
.
setFont
(
font
);
painter
.
drawLine
(
30
,
450
,
30
,
30
);
painter
.
drawLine
(
45
,
450
,
45
,
30
);
painter
.
drawLine
(
20
,
430
,
430
,
430
);
int
alto
=
0
;
for
(
int
i
=
0
;
i
<
9
;
i
++
){
if
(
alto
<
nodos_por_punto
[
i
])
alto
=
nodos_por_punto
[
i
];
}
float
alto_aux
=
(
alto
/
9
+
1
)
*
(
9
);
int
a
=
55
;
int
b
=
420
;
int
c
=
45
;
float
pintar
=
0
;
QBrush
brush
(
Qt
::
blue
);
// Establece el color del pincel como rojo
painter
.
setBrush
(
brush
);
for
(
int
i
=
0
;
i
<
9
;
i
++
){
QString
qstr
=
QString
::
number
(
i
+
1
);
QString
qstr2
=
QString
::
number
((
alto
/
9
+
1
)
*
(
i
+
1
));
std
::
cout
<<
nodos_por_punto
[
i
]
<<
"
\n
"
;
if
(
nodos_por_punto
[
i
]
!=
0
)
pintar
=
340
*
nodos_por_punto
[
i
]
/
alto_aux
;
painter
.
drawText
(
a
,
450
,
qstr
);
painter
.
drawText
(
3
,
b
,
qstr2
);
a
+=
35
;
b
-=
40
;
c
+=
35
;
if
(
nodos_por_punto
[
i
]
>
alto
/
9
)
{
painter
.
drawRect
(
c
,
430
,
35
,
-
pintar
);
}
else
if
(
nodos_por_punto
[
i
]
!=
0
){
painter
.
drawRect
(
c
,
430
,
35
,
-
(
20
*
nodos_por_punto
[
i
]
/
(
alto
/
9
+
1
)));
}
painter
.
drawRect
(
c
,
430
,
35
,
0
);
}
painter
.
drawText
(
50
,
450
,
"1"
);
painter
.
drawText
(
85
,
450
,
"2"
);
painter
.
drawText
(
120
,
450
,
"3"
);
painter
.
drawText
(
155
,
450
,
"4"
);
painter
.
drawText
(
190
,
450
,
"5"
);
painter
.
drawText
(
225
,
450
,
"6"
);
painter
.
drawText
(
260
,
450
,
"7"
);
painter
.
drawText
(
295
,
450
,
"8"
);
painter
.
drawText
(
330
,
450
,
"9"
);
painter
.
drawText
(
365
,
450
,
"10"
);
painter
.
drawText
(
400
,
450
,
"11"
);
}
...
...
@@ -54,3 +87,9 @@ void openGLDialog::initializeGL() {
QSurfaceFormat
format
=
this
->
format
();
}
void
openGLDialog
::
anadir_nodos_por_punto
(
int
aux
[
9
])
{
for
(
int
i
=
0
;
i
<
9
;
i
++
){
nodos_por_punto
[
i
]
=
aux
[
i
];
}
}
This diff is collapsed.
Click to expand it.
source/hugo/openGLDialog.h
View file @
b11d885f
...
...
@@ -20,10 +20,16 @@ class openGLDialog : public QOpenGLWidget,public QOpenGLFunctions {
Q_OBJECT
public:
openGLDialog
(
QWidget
*
parent
=
nullptr
)
:
QOpenGLWidget
(
parent
)
{}
openGLDialog
(
QWidget
*
parent
=
nullptr
)
:
QOpenGLWidget
(
parent
)
{
for
(
int
i
=
0
;
i
<
9
;
i
++
){
nodos_por_punto
[
i
]
=
0
;
}
}
void
paintGL
()
override
;
void
resizeGL
(
int
w
,
int
h
)
override
;
void
initializeGL
()
override
;
void
anadir_nodos_por_punto
(
int
aux
[
9
]);
private:
int
nodos_por_punto
[
9
];
};
#endif //SOURCE_OPENGLDIALOG_H
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment