13 #include <QVBoxLayout>
14 #include <QPushButton>
41 void ClippingWidget::setupUI()
43 if (mInteractiveClipper)
48 if (!mInteractiveClipper)
51 connect(mInteractiveClipper.get(), SIGNAL(changed()),
this, SLOT(clipperChangedSlot()));
55 connect(mDataAdapter.get(), SIGNAL(changed()),
this, SLOT(imageChangedSlot()));
57 this->setToolTip(
"Interactive volume clipping");
59 QVBoxLayout* layout =
new QVBoxLayout(
this);
61 QGroupBox* activeClipGroupBox =
new QGroupBox(
"Interactive clipper");
62 activeClipGroupBox->setToolTip(this->toolTip());
63 layout->addWidget(activeClipGroupBox);
64 QVBoxLayout* activeClipLayout =
new QVBoxLayout(activeClipGroupBox);
69 mUseClipperCheckBox =
new QCheckBox(
"Use Clipper");
70 mUseClipperCheckBox->setToolTip(
"Turn on interactive clipping for the selected volume.");
71 connect(mUseClipperCheckBox, SIGNAL(toggled(
bool)), mInteractiveClipper.get(), SLOT(useClipper(
bool)));
72 activeClipLayout->addWidget(mUseClipperCheckBox);
73 activeClipLayout->addWidget(imageCombo);
74 activeClipLayout->addWidget(combo);
75 mInvertPlaneCheckBox =
new QCheckBox(
"Invert plane");
76 mInvertPlaneCheckBox->setToolTip(
"Use the inverse (mirror) of the selected slice plane.");
77 connect(mInvertPlaneCheckBox, SIGNAL(toggled(
bool)), mInteractiveClipper.get(), SLOT(invertPlane(
bool)));
78 activeClipLayout->addWidget(mInvertPlaneCheckBox);
80 QPushButton* saveButton =
new QPushButton(
"Save clip plane");
81 saveButton->setToolTip(
"Save the interactive plane as a clip plane in the selected volume.");
82 connect(saveButton, SIGNAL(clicked()),
this, SLOT(saveButtonClickedSlot()));
84 QPushButton* clearButton =
new QPushButton(
"Clear saved planes");
85 clearButton->setToolTip(
"Remove all saved clip planes from the selected volume");
86 connect(clearButton, SIGNAL(clicked()),
this, SLOT(clearButtonClickedSlot()));
88 activeClipLayout->addWidget(saveButton);
89 layout->addWidget(clearButton);
93 this->clipperChangedSlot();
96 void ClippingWidget::clipperChangedSlot()
98 mUseClipperCheckBox->setChecked(mInteractiveClipper->getUseClipper());
99 mInvertPlaneCheckBox->setChecked(mInteractiveClipper->getInvertPlane());
100 if (mInteractiveClipper->getData())
101 mDataAdapter->setValue(mInteractiveClipper->getData()->getUid());
104 void ClippingWidget::imageChangedSlot()
106 mInteractiveClipper->setData(mServices->patient()->getData(mDataAdapter->getValue()));
109 void ClippingWidget::clearButtonClickedSlot()
111 mInteractiveClipper->clearClipPlanesInVolume();
114 void ClippingWidget::saveButtonClickedSlot()
116 mInteractiveClipper->saveClipPlaneToVolume();