Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dtk
dtk-visualization
Commits
404d3554
Commit
404d3554
authored
Jan 13, 2020
by
NICLAUSSE Nicolas
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' into feature/vtk-native
parents
1c0174cf
45d930bc
Changes
15
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
361 additions
and
139 deletions
+361
-139
app/dtkVisualizationViewer/dtkVisualizationViewer.cpp
app/dtkVisualizationViewer/dtkVisualizationViewer.cpp
+2
-2
src/dtkVisualization/dtkVisualizationDecoratorDelaunay2D.cpp
src/dtkVisualization/dtkVisualizationDecoratorDelaunay2D.cpp
+45
-19
src/dtkVisualization/dtkVisualizationDecoratorIsocontours.cpp
...dtkVisualization/dtkVisualizationDecoratorIsocontours.cpp
+22
-23
src/dtkVisualization/dtkVisualizationDecoratorSlices.cpp
src/dtkVisualization/dtkVisualizationDecoratorSlices.cpp
+79
-56
src/dtkVisualization/dtkVisualizationDecoratorVectorGlyphs.cpp
...tkVisualization/dtkVisualizationDecoratorVectorGlyphs.cpp
+1
-0
src/dtkVisualization/dtkVisualizationDecoratorVectorStreamTracer.cpp
...alization/dtkVisualizationDecoratorVectorStreamTracer.cpp
+6
-4
src/dtkVisualization/dtkVisualizationDecoratorWithClut.cpp
src/dtkVisualization/dtkVisualizationDecoratorWithClut.cpp
+73
-28
src/dtkVisualization/dtkVisualizationDecoratorWithClut.h
src/dtkVisualization/dtkVisualizationDecoratorWithClut.h
+1
-0
src/dtkVisualization/dtkVisualizationDecoratorWithClut_p.h
src/dtkVisualization/dtkVisualizationDecoratorWithClut_p.h
+11
-4
src/dtkVisualizationWidgets/CMakeLists.txt
src/dtkVisualizationWidgets/CMakeLists.txt
+3
-0
src/dtkVisualizationWidgets/dtkVisualizationWidgets
src/dtkVisualizationWidgets/dtkVisualizationWidgets
+2
-0
src/dtkVisualizationWidgets/dtkVisualizationWidgetsColorDialog
...tkVisualizationWidgets/dtkVisualizationWidgetsColorDialog
+1
-0
src/dtkVisualizationWidgets/dtkVisualizationWidgetsColorDialog.cpp
...sualizationWidgets/dtkVisualizationWidgetsColorDialog.cpp
+80
-0
src/dtkVisualizationWidgets/dtkVisualizationWidgetsColorDialog.h
...VisualizationWidgets/dtkVisualizationWidgetsColorDialog.h
+34
-0
src/dtkVisualizationWidgets/dtkVisualizationWidgetsVideoControls.cpp
...alizationWidgets/dtkVisualizationWidgetsVideoControls.cpp
+1
-3
No files found.
app/dtkVisualizationViewer/dtkVisualizationViewer.cpp
View file @
404d3554
...
...
@@ -301,7 +301,7 @@ void dtkVisualizationViewer::importDataSet(const QString& path)
dtkVisualizationDecoratorInfo
*
decorator_info
=
new
dtkVisualizationDecoratorInfo
;
dtkVisualizationDecoratorAxes
*
decorator_axes
=
new
dtkVisualizationDecoratorAxes
;
//
dtkVisualizationDecoratorDelaunay2D *decorator_delaunay_2D = new dtkVisualizationDecoratorDelaunay2D;
dtkVisualizationDecoratorDelaunay2D
*
decorator_delaunay_2D
=
new
dtkVisualizationDecoratorDelaunay2D
;
//dtkVisualizationDecoratorPoints *decorator_points = new dtkVisualizationDecoratorPoints;
dtkVisualizationDecoratorSurfaceColor
*
decorator_surface_color
=
new
dtkVisualizationDecoratorSurfaceColor
;
//dtkVisualizationDecoratorScalarGlyphs *decorator_scalar_glyphs = new dtkVisualizationDecoratorScalarGlyphs;
...
...
@@ -316,7 +316,7 @@ void dtkVisualizationViewer::importDataSet(const QString& path)
QList
<
dtkVisualizationDecorator
*>
decorators
;
decorators
//<< decorator_points
//
<< decorator_delaunay_2D
<<
decorator_delaunay_2D
<<
decorator_surface_color
<<
decorator_isocontours
//<< decorator_scalar_glyphs
...
...
src/dtkVisualization/dtkVisualizationDecoratorDelaunay2D.cpp
View file @
404d3554
...
...
@@ -17,6 +17,9 @@
#include "dtkVisualizationMetaType.h"
#include "dtkVisualizationView2D.h"
#include <dtkVisualizationWidgets/dtkVisualizationWidgetsCategory>
#include <dtkVisualizationWidgets/dtkVisualizationWidgetsColorDialog>
#include <dtkLog>
#include <QtGui>
...
...
@@ -56,10 +59,11 @@ public:
public:
bool
default_visibility
;
QColor
default_color
=
QColor
();
public:
QCheckBox
*
show_actor_cb
=
nullptr
;
QPushButton
*
color_button
=
nullptr
;
dtkVisualizationWidgetsColorDialog
*
col_dialog
=
nullptr
;
QDoubleSpinBox
*
opacity_spinbox
=
nullptr
;
public:
...
...
@@ -91,43 +95,59 @@ dtkVisualizationDecoratorDelaunay2D::dtkVisualizationDecoratorDelaunay2D(void):
d
->
actor
->
SetMapper
(
d
->
mapper
);
d
->
actor
->
SetVisibility
(
d
->
default_visibility
);
d
->
actor
->
GetProperty
()
->
SetPointSize
(
30
);
d
->
actor
->
GetProperty
()
->
SetColor
(
0.5
,
0.5
,
0.5
);
d
->
actor
->
GetProperty
()
->
SetColor
(
d
->
default_color
.
red
(),
d
->
default_color
.
green
(),
d
->
default_color
.
blue
());
//////////
// Inspectors creation
d
->
color_button
=
new
QPushButton
(
"Color"
);
d
->
opacity_spinbox
=
new
QDoubleSpinBox
;
d
->
show_actor_cb
=
new
QCheckBox
;
d
->
col_dialog
=
new
dtkVisualizationWidgetsColorDialog
;
d
->
col_dialog
->
setObjectName
(
"Color"
);
d
->
opacity_spinbox
=
new
QDoubleSpinBox
;
d
->
opacity_spinbox
->
setObjectName
(
"Opacity"
);
d
->
opacity_spinbox
->
setRange
(
0
,
1
);
d
->
opacity_spinbox
->
setDecimals
(
2
);
d
->
opacity_spinbox
->
setSingleStep
(
0.01
);
d
->
opacity_spinbox
->
setValue
(
1.
);
d
->
show_actor_cb
=
new
QCheckBox
;
d
->
show_actor_cb
->
setObjectName
(
"Display"
);
d
->
show_actor_cb
->
setChecked
(
d
->
default_visibility
);
//////////
// Inspectors connections
connect
(
d
->
color_button
,
&
QPushButton
::
released
,
[
=
]
(
void
)
{
double
*
vtk_color
=
d
->
actor
->
GetProperty
()
->
GetColor
();
QColor
qt_color
=
QColor
(
vtk_color
[
0
],
vtk_color
[
1
],
vtk_color
[
2
]);
qt_color
=
QColorDialog
::
getColor
(
qt_color
,
d
->
color_button
);
this
->
setColor
(
qt_color
);
connect
(
d
->
col_dialog
,
&
dtkVisualizationWidgetsColorDialog
::
colorChanged
,
[
=
]
(
QColor
c
)
{
if
(
c
.
isValid
())
{
this
->
saveSettings
(
"color"
,
c
);
d
->
actor
->
GetProperty
()
->
SetColor
(
c
.
red
(),
c
.
green
(),
c
.
blue
());
this
->
draw
();
}
});
connect
(
d
->
opacity_spinbox
,
QOverload
<
double
>::
of
(
&
QDoubleSpinBox
::
valueChanged
),
this
,
&
dtkVisualizationDecoratorDelaunay2D
::
setOpacity
);
connect
(
d
->
opacity_spinbox
,
QOverload
<
double
>::
of
(
&
QDoubleSpinBox
::
valueChanged
),
[
=
]
(
double
opacity
)
{
this
->
saveSettings
(
"opacity"
,
opacity
);
d
->
actor
->
GetProperty
()
->
SetOpacity
(
opacity
);
this
->
draw
();
});
connect
(
d
->
show_actor_cb
,
&
QCheckBox
::
stateChanged
,
[
=
]
(
int
state
)
{
this
->
saveSettings
(
"visibility"
,
state
==
Qt
::
Checked
);
this
->
setVisibility
(
state
==
Qt
::
Checked
);
this
->
draw
();
connect
(
d
->
show_actor_cb
,
&
QCheckBox
::
stateChanged
,
[
=
]
(
int
state
)
{
this
->
saveSettings
(
"visibility"
,
state
==
Qt
::
Checked
);
this
->
setVisibility
(
state
==
Qt
::
Checked
);
this
->
draw
();
});
auto
styling_box
=
new
dtkVisualizationWidgetsCategory
(
"Styling"
,
{
d
->
col_dialog
,
d
->
opacity_spinbox
});
d
->
inspectors
<<
d
->
color_button
<<
d
->
opacity_spinbox
<<
d
->
show_actor_cb
;
d
->
inspectors
<<
d
->
show_actor_cb
<<
styling_box
;
}
dtkVisualizationDecoratorDelaunay2D
::~
dtkVisualizationDecoratorDelaunay2D
(
void
)
...
...
@@ -147,7 +167,13 @@ void dtkVisualizationDecoratorDelaunay2D::restoreSettings(void)
QSettings
settings
;
settings
.
beginGroup
(
"canvas"
);
d
->
default_visibility
=
settings
.
value
(
name
+
"_visibility"
,
false
).
toBool
();
d
->
default_color
=
QColor
(
settings
.
value
(
name
+
"_color"
,
""
).
toString
());
double
opacity
=
settings
.
value
(
name
+
"_opacity"
,
1.0
).
toDouble
();
settings
.
endGroup
();
this
->
setVisibility
(
d
->
default_visibility
);
this
->
setColor
(
d
->
default_color
);
this
->
setOpacity
(
opacity
);
}
void
dtkVisualizationDecoratorDelaunay2D
::
touch
(
void
)
...
...
@@ -229,7 +255,9 @@ void dtkVisualizationDecoratorDelaunay2D::setColor(const QColor& color)
{
d
->
actor
->
GetProperty
()
->
SetColor
(
color
.
red
(),
color
.
green
(),
color
.
blue
());
this
->
draw
();
d
->
col_dialog
->
blockSignals
(
true
);
d
->
col_dialog
->
setColor
(
d
->
default_color
);
d
->
col_dialog
->
blockSignals
(
false
);
}
void
dtkVisualizationDecoratorDelaunay2D
::
setOpacity
(
const
double
&
alpha
)
...
...
@@ -239,8 +267,6 @@ void dtkVisualizationDecoratorDelaunay2D::setOpacity(const double& alpha)
d
->
opacity_spinbox
->
blockSignals
(
true
);
d
->
opacity_spinbox
->
setValue
(
alpha
);
d
->
opacity_spinbox
->
blockSignals
(
false
);
this
->
draw
();
}
QVariant
dtkVisualizationDecoratorDelaunay2D
::
data
(
void
)
const
...
...
src/dtkVisualization/dtkVisualizationDecoratorIsocontours.cpp
View file @
404d3554
...
...
@@ -78,10 +78,6 @@ public:
void
dtkVisualizationDecoratorIsocontours
::
updateContours
(
void
)
{
if
(
!
d_func
()
->
show_actor_cb
->
isChecked
())
{
return
;
}
auto
field_name
=
d_func
()
->
current_field_name
;
if
(
field_name
.
isEmpty
()
||
!
d_func
()
->
dataset
)
{
...
...
@@ -142,25 +138,28 @@ dtkVisualizationDecoratorIsocontours::dtkVisualizationDecoratorIsocontours(void)
//////////
// Inspectors connections
connect
(
d_func
()
->
show_actor_cb
,
&
QCheckBox
::
stateChanged
,
[
=
]
(
int
state
)
{
this
->
saveSettings
(
"visibility"
,
state
==
Qt
::
Checked
);
this
->
setVisibility
(
state
==
Qt
::
Checked
);
this
->
draw
();
});
connect
(
d
->
isolines_counts_sb
,
QOverload
<
int
>::
of
(
&
QSpinBox
::
valueChanged
),
[
=
]
(
int
value
)
{
this
->
saveSettings
(
"isolines_count"
,
value
);
this
->
setCurrentIsolinesCount
(
value
);
this
->
touch
();
this
->
draw
();
});
connect
(
d
->
isolines_width_sb
,
QOverload
<
double
>::
of
(
&
QDoubleSpinBox
::
valueChanged
),
[
=
]
(
double
value
)
{
this
->
saveSettings
(
"isolines_line_width"
,
value
);
d
->
actor
->
GetProperty
()
->
SetLineWidth
(
value
);
d
->
actor
->
Modified
();
this
->
draw
();
});
connect
(
d_func
()
->
show_actor_cb
,
&
QCheckBox
::
stateChanged
,
[
=
]
(
int
state
)
{
this
->
saveSettings
(
"visibility"
,
state
==
Qt
::
Checked
);
this
->
setVisibility
(
state
==
Qt
::
Checked
);
this
->
draw
();
});
connect
(
d
->
isolines_counts_sb
,
QOverload
<
int
>::
of
(
&
QSpinBox
::
valueChanged
),
[
=
]
(
int
value
)
{
this
->
saveSettings
(
"isolines_count"
,
value
);
this
->
setCurrentIsolinesCount
(
value
);
this
->
touch
();
this
->
draw
();
});
connect
(
d
->
isolines_width_sb
,
QOverload
<
double
>::
of
(
&
QDoubleSpinBox
::
valueChanged
),
[
=
]
(
double
value
)
{
this
->
saveSettings
(
"isolines_line_width"
,
value
);
d
->
actor
->
GetProperty
()
->
SetLineWidth
(
value
);
d
->
actor
->
Modified
();
this
->
draw
();
});
this
->
setObjectName
(
"Isocontours"
);
...
...
src/dtkVisualization/dtkVisualizationDecoratorSlices.cpp
View file @
404d3554
...
...
@@ -36,6 +36,7 @@
#include <vtkDataSetMapper.h>
#include <vtkImageMapToColors.h>
#include <vtkImagePlaneWidget.h>
#include <vtkImageReslice.h>
#include <vtkLookupTable.h>
#include <vtkOutlineFilter.h>
#include <vtkPiecewiseFunction.h>
...
...
@@ -91,6 +92,9 @@ public:
class
dtkVisualizationDecoratorSlicesPrivate
{
public:
vtkSmartPointer
<
vtkImageData
>
input_image
;
public:
vtkSmartPointer
<
vtkImagePlaneWidget
>
volume_slice_x
;
vtkSmartPointer
<
vtkImagePlaneWidget
>
volume_slice_y
;
...
...
@@ -121,7 +125,7 @@ public slots:
void
dtkVisualizationDecoratorSlicesPrivate
::
setupSlices
(
void
)
{
double
*
origin
;
origin
=
vtkImageData
::
SafeDownCast
(
this
->
volume_slice_
z
->
GetInput
())
->
GetOrigin
();
origin
=
vtkImageData
::
SafeDownCast
(
this
->
volume_slice_
x
->
GetInput
())
->
GetOrigin
();
this
->
volume_slice_x
->
PlaceWidget
();
this
->
volume_slice_x
->
SetPlaneOrientationToXAxes
();
...
...
@@ -148,6 +152,11 @@ void dtkVisualizationDecoratorSlicesPrivate::setupSlices(void)
void
dtkVisualizationDecoratorSlicesPrivate
::
setVisibility
(
bool
visible
)
{
if
(
!
this
->
volume_slice_x
->
GetInteractor
())
{
// Interactor must be set before enabling vtkImagePlaneWidget.
return
;
}
if
(
visible
)
{
this
->
volume_slice_x
->
On
();
this
->
volume_slice_x
->
InteractionOn
();
...
...
@@ -170,7 +179,10 @@ void dtkVisualizationDecoratorSlicesPrivate::setVisibility(bool visible)
dtkVisualizationDecoratorSlices
::
dtkVisualizationDecoratorSlices
(
void
)
:
dtkVisualizationDecoratorWithClut
(),
d
(
new
dtkVisualizationDecoratorSlicesPrivate
())
{
d
->
input_image
=
vtkSmartPointer
<
vtkImageData
>::
New
();
d
->
c2p_filter
=
vtkSmartPointer
<
vtkCellDataToPointData
>::
New
();
d
->
c2p_filter
->
SetInputData
(
d
->
input_image
);
d
->
volume_slice_x
=
vtkImagePlaneWidget
::
New
();
d
->
volume_slice_y
=
vtkImagePlaneWidget
::
New
();
...
...
@@ -195,58 +207,61 @@ dtkVisualizationDecoratorSlices::dtkVisualizationDecoratorSlices(void): dtkVisua
//////////
// Inspectors connections
connect
(
d
->
enable_slicing_x
,
&
dtkVisualizationWidgetsSliceControls
::
toggled
,
[
=
]
(
bool
checked
)
{
connect
(
d
->
enable_slicing_x
,
&
dtkVisualizationWidgetsSliceControls
::
toggled
,
[
=
]
(
bool
checked
)
{
d
->
volume_slice_x
->
SetEnabled
(
checked
);
this
->
draw
();
});
connect
(
d
->
enable_slicing_x
,
&
dtkVisualizationWidgetsSliceControls
::
reset
,
[
=
]
()
{
double
*
origin
;
origin
=
vtkImageData
::
SafeDownCast
(
d_func
()
->
dataset
)
->
GetOrigin
();
d
->
volume_slice_x
->
SetPlaneOrientationToXAxes
();
d
->
volume_slice_x
->
SetSlicePosition
(
origin
[
0
]);
this
->
draw
();
connect
(
d
->
enable_slicing_x
,
&
dtkVisualizationWidgetsSliceControls
::
reset
,
[
=
]
()
{
double
*
origin
=
d
->
input_image
->
GetOrigin
();
d
->
volume_slice_x
->
SetPlaneOrientationToXAxes
();
d
->
volume_slice_x
->
SetSlicePosition
(
origin
[
0
]);
this
->
draw
();
});
connect
(
d
->
enable_slicing_x
,
&
dtkVisualizationWidgetsSliceControls
::
valueChanged
,
[
=
]
(
double
value
)
{
double
*
origin
;
origin
=
vtkImageData
::
SafeDownCast
(
d_func
()
->
dataset
)
->
GetOrigin
();
d
->
volume_slice_x
->
SetSlicePosition
(
value
+
origin
[
0
]);
this
->
draw
();
connect
(
d
->
enable_slicing_x
,
&
dtkVisualizationWidgetsSliceControls
::
valueChanged
,
[
=
]
(
double
value
)
{
double
*
origin
=
d
->
input_image
->
GetOrigin
();
d
->
volume_slice_x
->
SetSlicePosition
(
value
+
origin
[
0
]);
this
->
draw
();
});
connect
(
d
->
enable_slicing_y
,
&
dtkVisualizationWidgetsSliceControls
::
toggled
,
[
=
]
(
bool
checked
)
{
connect
(
d
->
enable_slicing_y
,
&
dtkVisualizationWidgetsSliceControls
::
toggled
,
[
=
]
(
bool
checked
)
{
d
->
volume_slice_y
->
SetEnabled
(
checked
);
this
->
draw
();
});
connect
(
d
->
enable_slicing_y
,
&
dtkVisualizationWidgetsSliceControls
::
reset
,
[
=
]
()
{
double
*
origin
;
origin
=
vtkImageData
::
SafeDownCast
(
d_func
()
->
dataset
)
->
GetOrigin
();
d
->
volume_slice_y
->
SetPlaneOrientationToYAxes
();
d
->
volume_slice_y
->
SetSlicePosition
(
origin
[
1
]);
this
->
draw
();
connect
(
d
->
enable_slicing_y
,
&
dtkVisualizationWidgetsSliceControls
::
reset
,
[
=
]
()
{
double
*
origin
=
d
->
input_image
->
GetOrigin
();
d
->
volume_slice_y
->
SetPlaneOrientationToYAxes
();
d
->
volume_slice_y
->
SetSlicePosition
(
origin
[
1
]);
this
->
draw
();
});
connect
(
d
->
enable_slicing_y
,
&
dtkVisualizationWidgetsSliceControls
::
valueChanged
,
[
=
]
(
double
value
)
{
double
*
origin
;
origin
=
vtkImageData
::
SafeDownCast
(
d_func
()
->
dataset
)
->
GetOrigin
();
d
->
volume_slice_y
->
SetSlicePosition
(
value
+
origin
[
1
]);
this
->
draw
();
connect
(
d
->
enable_slicing_y
,
&
dtkVisualizationWidgetsSliceControls
::
valueChanged
,
[
=
]
(
double
value
)
{
double
*
origin
=
d
->
input_image
->
GetOrigin
();
d
->
volume_slice_y
->
SetSlicePosition
(
value
+
origin
[
1
]);
this
->
draw
();
});
connect
(
d
->
enable_slicing_z
,
&
dtkVisualizationWidgetsSliceControls
::
toggled
,
[
=
]
(
bool
checked
)
{
connect
(
d
->
enable_slicing_z
,
&
dtkVisualizationWidgetsSliceControls
::
toggled
,
[
=
]
(
bool
checked
)
{
d
->
volume_slice_z
->
SetEnabled
(
checked
);
this
->
draw
();
});
connect
(
d
->
enable_slicing_z
,
&
dtkVisualizationWidgetsSliceControls
::
reset
,
[
=
]
()
{
double
*
origin
;
origin
=
vtkImageData
::
SafeDownCast
(
d_func
()
->
dataset
)
->
GetOrigin
();
d
->
volume_slice_z
->
SetPlaneOrientationToZAxes
();
d
->
volume_slice_z
->
SetSlicePosition
(
origin
[
2
]);
this
->
draw
();
connect
(
d
->
enable_slicing_z
,
&
dtkVisualizationWidgetsSliceControls
::
reset
,
[
=
]
()
{
double
*
origin
=
d
->
input_image
->
GetOrigin
();
d
->
volume_slice_z
->
SetPlaneOrientationToZAxes
();
d
->
volume_slice_z
->
SetSlicePosition
(
origin
[
2
]);
this
->
draw
();
});
connect
(
d
->
enable_slicing_z
,
&
dtkVisualizationWidgetsSliceControls
::
valueChanged
,
[
=
]
(
double
value
)
{
double
*
origin
;
origin
=
vtkImageData
::
SafeDownCast
(
d_func
()
->
dataset
)
->
GetOrigin
();
d
->
volume_slice_z
->
SetSlicePosition
((
value
+
origin
[
2
]));
this
->
draw
();
connect
(
d
->
enable_slicing_z
,
&
dtkVisualizationWidgetsSliceControls
::
valueChanged
,
[
=
]
(
double
value
)
{
double
*
origin
=
d
->
input_image
->
GetOrigin
();
d
->
volume_slice_z
->
SetSlicePosition
((
value
+
origin
[
2
]));
this
->
draw
();
});
...
...
@@ -303,7 +318,8 @@ void dtkVisualizationDecoratorSlices::setData(const QVariant& data)
d_func
()
->
clear
();
return
;
}
d
->
c2p_filter
->
SetInputData
(
dataset
);
d
->
input_image
->
ShallowCopy
(
dataset
);
this
->
restoreSettings
();
d_func
()
->
sortEligibleFields
();
...
...
@@ -343,8 +359,8 @@ void dtkVisualizationDecoratorSlices::setCanvas(dtkVisualizationCanvas *canvas)
void
dtkVisualizationDecoratorSlices
::
unsetCanvas
(
void
)
{
if
(
d_func
()
->
view
)
{
// d_func()->view->renderer()->RemoveActor(d->actor)
;
if
(
!
d_func
()
->
view
)
{
return
;
}
d
->
volume_slice_x
->
SetInteractor
(
nullptr
);
...
...
@@ -376,6 +392,12 @@ void dtkVisualizationDecoratorSlices::restoreSettings(void)
void
dtkVisualizationDecoratorSlices
::
touch
(
void
)
{
// Need to update slices positions before calling parent touch to ensure drawing slices at the right positions.
double
*
origin
=
d
->
input_image
->
GetOrigin
();
d
->
volume_slice_x
->
SetSlicePosition
(
d
->
enable_slicing_x
->
value
()
+
origin
[
0
]);
d
->
volume_slice_y
->
SetSlicePosition
(
d
->
enable_slicing_y
->
value
()
+
origin
[
1
]);
d
->
volume_slice_z
->
SetSlicePosition
(
d
->
enable_slicing_z
->
value
()
+
origin
[
2
]);
dtkVisualizationDecoratorWithClut
::
touch
();
}
...
...
@@ -393,29 +415,25 @@ bool dtkVisualizationDecoratorSlices::setCurrentFieldName(const QString& field_n
if
(
!
d_func
()
->
eligible_field_names
.
contains
(
field_name
))
{
dtkWarn
()
<<
Q_FUNC_INFO
<<
"The field name :"
<<
field_name
<<
"that was specified doesn't match any of the eligible scalar field names"
;
return
false
;
}
using
Support
=
dtkVisualizationDecoratorWithClut
::
Support
;
int
support
=
d_func
()
->
supports
[
field_name
];
if
(
support
==
Support
::
Point
)
{
d
->
volume_slice_x
->
SetInputData
(
d_func
()
->
dataset
);
d
->
volume_slice_y
->
SetInputData
(
d_func
()
->
dataset
);
d
->
volume_slice_z
->
SetInputData
(
d_func
()
->
dataset
);
d
->
input_image
->
GetPointData
()
->
SetActiveScalars
(
qPrintable
(
field_name
));
d
->
volume_slice_x
->
SetInputData
(
d
->
input_image
);
d
->
volume_slice_y
->
SetInputData
(
d
->
input_image
);
d
->
volume_slice_z
->
SetInputData
(
d
->
input_image
);
}
else
if
(
support
==
Support
::
Cell
)
{
d
->
c2p_filter
->
SetInputArrayToProcess
(
0
,
0
,
0
,
vtkDataObject
::
FIELD_ASSOCIATION_CELLS
,
qPrintable
(
field_name
));
d
->
volume_slice_x
->
SetInputConnection
(
d
->
c2p_filter
->
GetOutputPort
());
d
->
volume_slice_y
->
SetInputConnection
(
d
->
c2p_filter
->
GetOutputPort
());
d
->
volume_slice_z
->
SetInputConnection
(
d
->
c2p_filter
->
GetOutputPort
());
d
->
c2p_filter
->
Modified
();
}
d
->
volume_slice_x
->
SetSlicePosition
(
d
->
enable_slicing_x
->
value
());
d
->
volume_slice_y
->
SetSlicePosition
(
d
->
enable_slicing_y
->
value
());
d
->
volume_slice_z
->
SetSlicePosition
(
d
->
enable_slicing_z
->
value
());
return
dtkVisualizationDecoratorWithClut
::
setCurrentFieldName
(
field_name
);
d
->
input_image
->
GetCellData
()
->
SetActiveScalars
(
qPrintable
(
field_name
));
d
->
c2p_filter
->
Modified
();
d
->
volume_slice_x
->
SetInputConnection
(
d
->
c2p_filter
->
GetOutputPort
());
d
->
volume_slice_y
->
SetInputConnection
(
d
->
c2p_filter
->
GetOutputPort
());
d
->
volume_slice_z
->
SetInputConnection
(
d
->
c2p_filter
->
GetOutputPort
());
}
return
dtkVisualizationDecoratorWithClut
::
setCurrentFieldName
(
field_name
);
}
void
dtkVisualizationDecoratorSlices
::
setColorMap
(
const
QMap
<
double
,
QColor
>&
new_colormap
)
...
...
@@ -423,8 +441,13 @@ void dtkVisualizationDecoratorSlices::setColorMap(const QMap<double, QColor>& ne
dtkVisualizationDecoratorWithClut
::
setColorMap
(
new_colormap
);
d
->
volume_slice_x
->
GetColorMap
()
->
SetLookupTable
(
d_func
()
->
color_function
);
d
->
volume_slice_x
->
GetColorMap
()
->
Modified
();
d
->
volume_slice_y
->
GetColorMap
()
->
SetLookupTable
(
d_func
()
->
color_function
);
d
->
volume_slice_y
->
GetColorMap
()
->
Modified
();
d
->
volume_slice_z
->
GetColorMap
()
->
SetLookupTable
(
d_func
()
->
color_function
);
d
->
volume_slice_z
->
GetColorMap
()
->
Modified
();
}
//
...
...
src/dtkVisualization/dtkVisualizationDecoratorVectorGlyphs.cpp
View file @
404d3554
...
...
@@ -109,6 +109,7 @@ dtkVisualizationDecoratorVectorGlyphs::dtkVisualizationDecoratorVectorGlyphs(voi
{
this
->
saveSettings
(
"scaling_mode"
,
component_id
);
this
->
touch
();
this
->
draw
();
});
connect
(
d
->
glyphs_stride_sb
,
QOverload
<
int
>::
of
(
&
QSpinBox
::
valueChanged
),
[
=
]
(
int
value
)
...
...
src/dtkVisualization/dtkVisualizationDecoratorVectorStreamTracer.cpp
View file @
404d3554
...
...
@@ -647,10 +647,12 @@ void dtkVisualizationDecoratorVectorStreamTracer::setVisibility(bool visible)
{
dtkVisualizationDecoratorWithClut
::
setVisibility
(
visible
);
d
->
actor
->
SetVisibility
(
visible
);
if
(
d
->
cb_seed_type
->
currentText
()
==
"Sphere"
)
{
d
->
source_sphere_widget
->
SetEnabled
(
visible
);
}
else
{
d
->
source_line_widget
->
SetEnabled
(
visible
);
if
(
d
->
cb_show_seed
->
isChecked
())
{
if
(
d
->
cb_seed_type
->
currentText
()
==
"Sphere"
)
{
d
->
source_sphere_widget
->
SetEnabled
(
visible
);
}
else
{
d
->
source_line_widget
->
SetEnabled
(
visible
);
}
}
}
...
...
src/dtkVisualization/dtkVisualizationDecoratorWithClut.cpp
View file @
404d3554
...
...
@@ -19,6 +19,7 @@
#include "dtkVisualizationView2D.h"
#include <dtkVisualizationWidgets/dtkVisualizationWidgetsCategory>
#include <dtkVisualizationWidgets/dtkVisualizationWidgetsColorDialog>
#include <dtkVisualizationWidgets/dtkVisualizationWidgetsColorMapEditor>
#include <dtkFonts/dtkFontAwesome>
...
...
@@ -31,6 +32,7 @@
#include <vtkCellData.h>
#include <vtkDataArray.h>
#include <vtkDataSet.h>
#include <vtkLookupTable.h>
#include <vtkPiecewiseFunction.h>
#include <vtkPointData.h>
#include <vtkRenderer.h>
...
...
@@ -70,14 +72,18 @@ dtkVisualizationDecoratorWithClutPrivate::dtkVisualizationDecoratorWithClutPriva
this
->
colormap_editor
=
new
dtkVisualizationWidgetsColorMapEditor
;
this
->
colormap_editor
->
setObjectName
(
"Color Map"
);
// Color dialog
this
->
col_dialog
=
new
dtkVisualizationWidgetsColorDialog
;
this
->
col_dialog
->
setObjectName
(
"Color"
);
// Display Data
show_actor_cb
=
new
QCheckBox
;
show_actor_cb
->
setObjectName
(
"Data"
);
// Range
QHBoxLayout
*
h_layout_range
=
new
QHBoxLayout
;
QWidget
*
range_widget
=
new
QWidget
;
range_widget
->
setObjectName
(
"Range"
);
this
->
range_widget
=
new
QWidget
;
this
->
range_widget
->
setObjectName
(
"Range"
);
this
->
min_range
=
new
QLineEdit
;
this
->
max_range
=
new
QLineEdit
;
...
...
@@ -91,11 +97,12 @@ dtkVisualizationDecoratorWithClutPrivate::dtkVisualizationDecoratorWithClutPriva
this
->
max_range
->
setValidator
(
double_validator
);
h_layout_range
->
setAlignment
(
Qt
::
AlignLeft
);
h_layout_range
->
setContentsMargins
(
0
,
0
,
0
,
0
);
h_layout_range
->
addWidget
(
this
->
min_range
);
h_layout_range
->
addWidget
(
this
->
max_range
);
h_layout_range
->
addWidget
(
this
->
reset_range
);
range_widget
->
setLayout
(
h_layout_range
);
this
->
range_widget
->
setLayout
(
h_layout_range
);
// Opacity
this
->
opacity_widget
=
new
QWidget
;
...
...
@@ -117,6 +124,7 @@ dtkVisualizationDecoratorWithClutPrivate::dtkVisualizationDecoratorWithClutPriva
this
->
opacity_val_sp
->
setValue
(
1
);
QHBoxLayout
*
h_layout_opacity
=
new
QHBoxLayout
;
h_layout_opacity
->
setContentsMargins
(
0
,
0
,
0
,
0
);
h_layout_opacity
->
addWidget
(
this
->
opacity_slider
);
h_layout_opacity
->
addWidget
(
this
->
opacity_val_sp
);
...
...
@@ -135,8 +143,10 @@ dtkVisualizationDecoratorWithClutPrivate::dtkVisualizationDecoratorWithClutPriva
this
->
show_scalar_bar
}
)
<<
new
dtkVisualizationWidgetsCategory
(
"Colors"
,
{
this
->
field_components
,
colormap_editor
,
range_widget
}
);
this
->
colormap_editor
,
this
->
range_widget
,
this
->
col_dialog
});
}
void
dtkVisualizationDecoratorWithClutPrivate
::
clear
(
void
)
...
...
@@ -336,6 +346,18 @@ void dtkVisualizationDecoratorWithClutPrivate::updateColorTransferFunction(void)
// to extract in the GetRange method for the vector case.
int
component_id
=
this
->
field_components
->
currentIndex
()
-
2
;
dtkVisualizationWidgetsCategory
*
category
=
dynamic_cast
<
dtkVisualizationWidgetsCategory
*>
(
this
->
inspectorItem
(
"Colors"
));
Q_ASSERT_X
(
category
,
Q_FUNC_INFO
,
"Category Colors should exist."
);
category
->
setVisible
(
this
->
col_dialog
,
false
);
category
->
setVisible
(
this
->
colormap_editor
,
true
);
category
->
setVisible
(
this
->
range_widget
,
true
);
this
->
colormap_editor
->
blockSignals
(
true
);
this
->
colormap_editor
->
setValue
(
this
->
color_transfer_functions
[
this
->
current_field_name
]);
this
->
colormap_editor
->
blockSignals
(
false
);
QMap
<
double
,
QColor
>
color_map
=
this
->
colormap_editor
->
value
();
switch
(
this
->
kinds
[
this
->
current_field_name
])
{
case
Kind
::
Vector
:
switch
(
component_id
)
{
...
...
@@ -355,7 +377,13 @@ void dtkVisualizationDecoratorWithClutPrivate::updateColorTransferFunction(void)
this
->
color_function
->
SetVectorComponent
(
2
);
break
;
default:
category
->
setVisible
(
this
->
col_dialog
,
true
);
category
->
setVisible
(
this
->
colormap_editor
,
false
);
category
->
setVisible
(
this
->
range_widget
,
false
);
this
->
color_function
->
SetVectorModeToMagnitude
();
color_map
.
clear
();
auto
&&
range
=
this
->
ranges
[
this
->
current_field_name
];
color_map
[
range
[
0
]]
=
this
->
col_dialog
->
currentColor
();
break
;
}
break
;
...
...
@@ -363,9 +391,7 @@ void dtkVisualizationDecoratorWithClutPrivate::updateColorTransferFunction(void)
break
;
}
this
->
colormap_editor
->
blockSignals
(
true
);
this
->
colormap_editor
->
setValue
(
this
->
color_transfer_functions
[
this
->
current_field_name
]);