34 #include <QVBoxLayout>
35 #include <QPushButton>
53 mInteractiveClipper(clipper)
64 PLANE_TYPE plane = string2enum<PLANE_TYPE> (value);
76 return "Chose the slice plane to clip with.";
83 for (
unsigned i = 0; i < planes.size(); ++i)
94 mPatientModelService(patientModelService)
97 connect(mInteractiveClipper.get(), SIGNAL(changed()),
this, SLOT(clipperChangedSlot()));
101 connect(mImageAdapter.get(), SIGNAL(changed()),
this, SLOT(imageChangedSlot()));
105 QVBoxLayout* layout =
new QVBoxLayout(
this);
107 QGroupBox* activeClipGroupBox =
new QGroupBox(
"Interactive clipper");
109 layout->addWidget(activeClipGroupBox);
110 QVBoxLayout* activeClipLayout =
new QVBoxLayout(activeClipGroupBox);
115 mUseClipperCheckBox =
new QCheckBox(
"Use Clipper");
116 mUseClipperCheckBox->setToolTip(
"Turn on interactive clipping for the selected volume.");
117 connect(mUseClipperCheckBox, SIGNAL(toggled(
bool)), mInteractiveClipper.get(), SLOT(useClipper(
bool)));
118 activeClipLayout->addWidget(mUseClipperCheckBox);
119 activeClipLayout->addWidget(imageCombo);
120 activeClipLayout->addWidget(combo);
121 mInvertPlaneCheckBox =
new QCheckBox(
"Invert plane");
122 mInvertPlaneCheckBox->setToolTip(
"Use the inverse (mirror) of the selected slice plane.");
123 connect(mInvertPlaneCheckBox, SIGNAL(toggled(
bool)), mInteractiveClipper.get(), SLOT(invertPlane(
bool)));
124 activeClipLayout->addWidget(mInvertPlaneCheckBox);
126 QPushButton* saveButton =
new QPushButton(
"Save clip plane");
127 saveButton->setToolTip(
"Save the interactive plane as a clip plane in the selected volume.");
128 connect(saveButton, SIGNAL(clicked()),
this, SLOT(saveButtonClickedSlot()));
130 QPushButton* clearButton =
new QPushButton(
"Clear saved planes");
131 clearButton->setToolTip(
"Remove all saved clip planes from the selected volume");
132 connect(clearButton, SIGNAL(clicked()),
this, SLOT(clearButtonClickedSlot()));
134 activeClipLayout->addWidget(saveButton);
135 layout->addWidget(clearButton);
137 layout->addStretch();
139 this->clipperChangedSlot();
145 "<h3>Functonality for clipping a volume</h3>"
147 "Define clip planes in a volume. The interactive clipper is attached "
148 "to the active tool, and clips the active volume according to a slice "
152 "The current clip can also be saved along with the volume. This can be "
153 "done several times."
159 void ClippingWidget::clipperChangedSlot()
161 mUseClipperCheckBox->setChecked(mInteractiveClipper->getUseClipper());
162 mInvertPlaneCheckBox->setChecked(mInteractiveClipper->getInvertPlane());
163 if (mInteractiveClipper->getImage())
164 mImageAdapter->setValue(mInteractiveClipper->getImage()->getUid());
167 void ClippingWidget::imageChangedSlot()
169 mInteractiveClipper->setImage(mPatientModelService->getData<Image>(mImageAdapter->getValue()));
172 void ClippingWidget::clearButtonClickedSlot()
174 mInteractiveClipper->clearClipPlanesInVolume();
177 void ClippingWidget::saveButtonClickedSlot()
179 mInteractiveClipper->saveClipPlaneToVolume();
QString qstring_cast(const T &val)
virtual QString getValue() const
get the data value.
static StringPropertyBasePtr New(InteractiveClipperPtr clipper)
virtual QString getHelp() const
return a descriptive help string for the data, used for example as a tool tip.
virtual QString getDisplayName() const
name of data entity. Used for display to user.
virtual QStringList getValueRange() const
boost::shared_ptr< class InteractiveClipper > InteractiveClipperPtr
InteractiveClipperPtr mInteractiveClipper
StringPropertyClipPlane(InteractiveClipperPtr clipper)
boost::shared_ptr< class PatientModelService > PatientModelServicePtr
void changed()
emit when the underlying data value is changed: The user interface will be updated.
cxLogicManager_EXPORT ViewServicePtr viewService()
static StringPropertySelectImagePtr New(PatientModelServicePtr patientModelService)
virtual bool setValue(const QString &value)
set the data value.