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)
100 void ClippingWidget::setupUI()
102 if (mInteractiveClipper)
107 if (!mInteractiveClipper)
110 connect(mInteractiveClipper.get(), SIGNAL(changed()),
this, SLOT(clipperChangedSlot()));
114 connect(mImageAdapter.get(), SIGNAL(changed()),
this, SLOT(imageChangedSlot()));
116 this->setToolTip(
"Interactive volume clipping");
118 QVBoxLayout* layout =
new QVBoxLayout(
this);
120 QGroupBox* activeClipGroupBox =
new QGroupBox(
"Interactive clipper");
121 activeClipGroupBox->setToolTip(this->toolTip());
122 layout->addWidget(activeClipGroupBox);
123 QVBoxLayout* activeClipLayout =
new QVBoxLayout(activeClipGroupBox);
128 mUseClipperCheckBox =
new QCheckBox(
"Use Clipper");
129 mUseClipperCheckBox->setToolTip(
"Turn on interactive clipping for the selected volume.");
130 connect(mUseClipperCheckBox, SIGNAL(toggled(
bool)), mInteractiveClipper.get(), SLOT(useClipper(
bool)));
131 activeClipLayout->addWidget(mUseClipperCheckBox);
132 activeClipLayout->addWidget(imageCombo);
133 activeClipLayout->addWidget(combo);
134 mInvertPlaneCheckBox =
new QCheckBox(
"Invert plane");
135 mInvertPlaneCheckBox->setToolTip(
"Use the inverse (mirror) of the selected slice plane.");
136 connect(mInvertPlaneCheckBox, SIGNAL(toggled(
bool)), mInteractiveClipper.get(), SLOT(invertPlane(
bool)));
137 activeClipLayout->addWidget(mInvertPlaneCheckBox);
139 QPushButton* saveButton =
new QPushButton(
"Save clip plane");
140 saveButton->setToolTip(
"Save the interactive plane as a clip plane in the selected volume.");
141 connect(saveButton, SIGNAL(clicked()),
this, SLOT(saveButtonClickedSlot()));
143 QPushButton* clearButton =
new QPushButton(
"Clear saved planes");
144 clearButton->setToolTip(
"Remove all saved clip planes from the selected volume");
145 connect(clearButton, SIGNAL(clicked()),
this, SLOT(clearButtonClickedSlot()));
147 activeClipLayout->addWidget(saveButton);
148 layout->addWidget(clearButton);
150 layout->addStretch();
152 this->clipperChangedSlot();
155 void ClippingWidget::clipperChangedSlot()
157 mUseClipperCheckBox->setChecked(mInteractiveClipper->getUseClipper());
158 mInvertPlaneCheckBox->setChecked(mInteractiveClipper->getInvertPlane());
159 if (mInteractiveClipper->getImage())
160 mImageAdapter->setValue(mInteractiveClipper->getImage()->getUid());
163 void ClippingWidget::imageChangedSlot()
165 mInteractiveClipper->setImage(mPatientModelService->getData<Image>(mImageAdapter->getValue()));
168 void ClippingWidget::clearButtonClickedSlot()
170 mInteractiveClipper->clearClipPlanesInVolume();
173 void ClippingWidget::saveButtonClickedSlot()
175 mInteractiveClipper->saveClipPlaneToVolume();
QString qstring_cast(const T &val)
virtual QString getValue() const
get the data value.
static StringPropertyBasePtr New(InteractiveClipperPtr clipper)
void activeLayoutChanged()
emitted when the active layout changes
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.