Commit 790bcfa9 authored by Emmanuel Promayon's avatar Emmanuel Promayon
Browse files

UPDATED action menu reflects the current state of visibility in 3D

parent 59798efc
...@@ -53,7 +53,12 @@ ShowImageIn3D::~ShowImageIn3D() { ...@@ -53,7 +53,12 @@ ShowImageIn3D::~ShowImageIn3D() {
// --------------- getWidget -------------- // --------------- getWidget --------------
QWidget* ShowImageIn3D::getWidget() { QWidget* ShowImageIn3D::getWidget() {
return NULL; ImageComponent* img = dynamic_cast<ImageComponent*> (getTargets().last());
if (img!=nullptr) {
bool isDisplayedIn3D = img->property("Display Image in 3D Viewer").toBool();
getQAction()->setChecked(isDisplayedIn3D);
}
return nullptr;
} }
// --------------- apply ------------------- // --------------- apply -------------------
...@@ -63,7 +68,11 @@ Action::ApplyStatus ShowImageIn3D::apply() { ...@@ -63,7 +68,11 @@ Action::ApplyStatus ShowImageIn3D::apply() {
foreach (Component * comp, getTargets()) { foreach (Component * comp, getTargets()) {
ImageComponent* img = dynamic_cast<ImageComponent*> (comp); ImageComponent* img = dynamic_cast<ImageComponent*> (comp);
if (img) { if (img) {
img->setViewIn3D(! img->getViewIn3D()); bool isDisplayedIn3D = img->property("Display Image in 3D Viewer").toBool();
// togle
isDisplayedIn3D = !isDisplayedIn3D;
img->setProperty("Display Image in 3D Viewer",isDisplayedIn3D);
getQAction()->setChecked(isDisplayedIn3D);
Application::refresh(); Application::refresh();
} }
} }
......
...@@ -60,11 +60,15 @@ class MeshComponent; ...@@ -60,11 +60,15 @@ class MeshComponent;
* An image volume data has no concrete 3D representation, * An image volume data has no concrete 3D representation,
* but handles several sub-components for axial, sagittal and coronal slices. * but handles several sub-components for axial, sagittal and coronal slices.
* *
* Vtk Pipeline: * Vtk Pipeline: @see Slice
* \verbatim
* \endverbatim
*
* *
* @note
* You can use the following properties to change the visualization of an ImageComponent and children components:
* - "Image Name" type QString
* - "Display Image in 3D Viewer" type boolean, controls what is displayed in the default 3D viewer
*
* Everytime a property is changed using setProperty(QString propertyName, QVariant value), the ImageComponent
* will automatically update, thanks to the updateProperty(..) method.
*/ */
class CAMITK_API ImageComponent : public camitk::Component { class CAMITK_API ImageComponent : public camitk::Component {
Q_OBJECT Q_OBJECT
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment