34 #include <QVBoxLayout>
35 #include <QPushButton>
39 #include <vtkImageData.h>
61 connect(mInteractiveCropper.get(), SIGNAL(changed()),
this, SLOT(cropperChangedSlot()));
63 QVBoxLayout* layout =
new QVBoxLayout(
this);
67 QGroupBox* activeGroupBox =
new QGroupBox(
"Interactive cropper");
69 layout->addWidget(activeGroupBox);
70 QVBoxLayout* activeLayout =
new QVBoxLayout(activeGroupBox);
72 mUseCropperCheckBox =
new QCheckBox(
"Use Cropper");
73 mUseCropperCheckBox->setToolTip(
"Turn on cropping for the active volume.");
74 connect(mUseCropperCheckBox, SIGNAL(toggled(
bool)), mInteractiveCropper.get(), SLOT(useCropping(
bool)));
75 activeLayout->addWidget(mUseCropperCheckBox);
77 mShowBoxCheckBox =
new QCheckBox(
"Show box");
78 mShowBoxCheckBox->setToolTip(
"Show crop box in 3D view. This also turns on cropping for convenience.");
79 connect(mShowBoxCheckBox, SIGNAL(toggled(
bool)), mInteractiveCropper.get(), SLOT(showBoxWidget(
bool)));
80 activeLayout->addWidget(mShowBoxCheckBox);
82 mBoundingBoxDimensions =
new QLabel(
"?, ?, ?");
83 mBoundingBoxDimensions->setToolTip(
"The dimensions of the croppers boundingbox.");
84 activeLayout->addWidget(mBoundingBoxDimensions);
87 layout->addWidget(mBBWidget);
88 connect(mBBWidget, SIGNAL(changed()),
this, SLOT(boxValuesChanged()));
90 QPushButton* cropClipButton =
new QPushButton(
"Create new cropped volume");
91 cropClipButton->setToolTip(
"Create a new volume containing only the volume inside the crop box.");
92 connect(cropClipButton, SIGNAL(clicked()),
this, SLOT(cropClipButtonClickedSlot()));
93 layout->addWidget(cropClipButton);
97 this->cropperChangedSlot();
103 "<h3>Functionality for cropping a volume.</h3>"
105 "Lets you crop a volume by defining a bounding box along the volume "
106 "axis. Everything outside the box is not shown."
109 "<b>How to use the bounding box:</b>"
111 "<li>First click the bounding box to get the control spheres</li>"
112 "<li>Click and drag a sphere to change the crop area</li>"
116 "<b>Tip:</b> To make the crop permanent, press the button to create a new volume from the crop."
122 void CroppingWidget::boxValuesChanged()
124 mInteractiveCropper->setBoundingBox(mBBWidget->
getValue());
127 void CroppingWidget::cropperChangedSlot()
129 std::vector<int> dims = mInteractiveCropper->getDimensions();
134 mBoundingBoxDimensions->setText(dimensionText);
135 mUseCropperCheckBox->setChecked(mInteractiveCropper->getUseCropping());
136 mShowBoxCheckBox->setChecked(mInteractiveCropper->getShowBoxWidget());
138 mBBWidget->
setValue(mInteractiveCropper->getBoundingBox(), mInteractiveCropper->getMaxBoundingBox());
141 ImagePtr CroppingWidget::cropClipButtonClickedSlot()
QString qstring_cast(const T &val)
vtkImageDataPtr cropImage(vtkImageDataPtr input, IntBoundingBox3D cropbox)
boost::shared_ptr< class Image > ImagePtr
cxLogicManager_EXPORT ViewServicePtr viewService()
cxLogicManager_EXPORT PatientModelServicePtr patientService()