34 #include <QVBoxLayout>
35 #include <QPushButton>
62 void ClippingWidget::setupUI()
64 if (mInteractiveClipper)
69 if (!mInteractiveClipper)
72 connect(mInteractiveClipper.get(), SIGNAL(changed()),
this, SLOT(clipperChangedSlot()));
76 connect(mDataAdapter.get(), SIGNAL(changed()),
this, SLOT(imageChangedSlot()));
78 this->setToolTip(
"Interactive volume clipping");
80 QVBoxLayout* layout =
new QVBoxLayout(
this);
82 QGroupBox* activeClipGroupBox =
new QGroupBox(
"Interactive clipper");
83 activeClipGroupBox->setToolTip(this->toolTip());
84 layout->addWidget(activeClipGroupBox);
85 QVBoxLayout* activeClipLayout =
new QVBoxLayout(activeClipGroupBox);
90 mUseClipperCheckBox =
new QCheckBox(
"Use Clipper");
91 mUseClipperCheckBox->setToolTip(
"Turn on interactive clipping for the selected volume.");
92 connect(mUseClipperCheckBox, SIGNAL(toggled(
bool)), mInteractiveClipper.get(), SLOT(useClipper(
bool)));
93 activeClipLayout->addWidget(mUseClipperCheckBox);
94 activeClipLayout->addWidget(imageCombo);
95 activeClipLayout->addWidget(combo);
96 mInvertPlaneCheckBox =
new QCheckBox(
"Invert plane");
97 mInvertPlaneCheckBox->setToolTip(
"Use the inverse (mirror) of the selected slice plane.");
98 connect(mInvertPlaneCheckBox, SIGNAL(toggled(
bool)), mInteractiveClipper.get(), SLOT(invertPlane(
bool)));
99 activeClipLayout->addWidget(mInvertPlaneCheckBox);
101 QPushButton* saveButton =
new QPushButton(
"Save clip plane");
102 saveButton->setToolTip(
"Save the interactive plane as a clip plane in the selected volume.");
103 connect(saveButton, SIGNAL(clicked()),
this, SLOT(saveButtonClickedSlot()));
105 QPushButton* clearButton =
new QPushButton(
"Clear saved planes");
106 clearButton->setToolTip(
"Remove all saved clip planes from the selected volume");
107 connect(clearButton, SIGNAL(clicked()),
this, SLOT(clearButtonClickedSlot()));
109 activeClipLayout->addWidget(saveButton);
110 layout->addWidget(clearButton);
112 layout->addStretch();
114 this->clipperChangedSlot();
117 void ClippingWidget::clipperChangedSlot()
119 mUseClipperCheckBox->setChecked(mInteractiveClipper->getUseClipper());
120 mInvertPlaneCheckBox->setChecked(mInteractiveClipper->getInvertPlane());
121 if (mInteractiveClipper->getData())
122 mDataAdapter->setValue(mInteractiveClipper->getData()->getUid());
125 void ClippingWidget::imageChangedSlot()
127 mInteractiveClipper->setData(mServices->patient()->getData(mDataAdapter->getValue()));
130 void ClippingWidget::clearButtonClickedSlot()
132 mInteractiveClipper->clearClipPlanesInVolume();
135 void ClippingWidget::saveButtonClickedSlot()
137 mInteractiveClipper->saveClipPlaneToVolume();
boost::shared_ptr< class VisServices > VisServicesPtr
static StringPropertySelectDataPtr New(PatientModelServicePtr patientModelService, QString typeRegexp=".*")
void activeLayoutChanged()
emitted when the active layout changes
static StringPropertyClipPlanePtr New(InteractiveClipperPtr clipper)