TransferFunction3DWidget::TransferFunction3DWidget(ActiveDataPtr activeData, QWidget* parent, bool connectToActiveImage) :
  BaseWidget(parent, "TransferFunction3DWidget", "3D"),
  mLayout(new QVBoxLayout(this)),
  mActiveImageProxy(ActiveImageProxyPtr()),
  mActiveData(activeData)
{
	this->setToolTip("Set a transfer function on a 3D volume");
  mTransferFunctionAlphaWidget = new TransferFunctionAlphaWidget(activeData, this);
  mTransferFunctionColorWidget = new TransferFunctionColorWidget(activeData, this);

  mTransferFunctionAlphaWidget->setSizePolicy(QSizePolicy::MinimumExpanding,
                                              QSizePolicy::MinimumExpanding);
  mTransferFunctionColorWidget->setSizePolicy(QSizePolicy::Expanding,
                                              QSizePolicy::Fixed);

  mLayout->addWidget(mTransferFunctionAlphaWidget);
  mLayout->addWidget(mTransferFunctionColorWidget);

  this->setLayout(mLayout);

  if(connectToActiveImage)
  {
	  mActiveImageProxy = ActiveImageProxy::New(mActiveData);
	  connect(mActiveImageProxy.get(), &ActiveImageProxy::activeImageChanged, this, &TransferFunction3DWidget::activeImageChangedSlot);
	  connect(mActiveImageProxy.get(), &ActiveImageProxy::transferFunctionsChanged, this, &TransferFunction3DWidget::activeImageChangedSlot);
  }
  this->activeImageChangedSlot();
}
Example #2
0
ShadingWidget::ShadingWidget(ActiveDataPtr activeData, QWidget* parent,  bool connectToActiveImage) :
	BaseWidget(parent, "shading_widget", "Shading"),
	mLayout(new QVBoxLayout(this)),
	mActiveData(activeData),
	mActiveImageProxy(ActiveImageProxyPtr()),
	mImage(ImagePtr()),
	mImagePropertiesWidget(ImageRenderPropertiesWidgetPtr())
{
  this->init(connectToActiveImage);
}
Example #3
0
EraserWidget::EraserWidget(PatientModelServicePtr patientModelService, VisualizationServicePtr visualizationService, QWidget* parent) :
	BaseWidget(parent, "EraserWidget", "Eraser"),
	mPreviousCenter(0,0,0),
	mPreviousRadius(0),
	mActiveImageProxy(ActiveImageProxyPtr()),
	mPatientModelService(patientModelService),
	mVisualizationService(visualizationService)

{

	QVBoxLayout* layout = new QVBoxLayout(this);
	this->setToolTip("Erase parts of volumes/models");

	mContinousEraseTimer = new QTimer(this);
	connect(mContinousEraseTimer, SIGNAL(timeout()), this, SLOT(continousRemoveSlot())); // this signal will be executed in the thread of THIS, i.e. the main thread.

	QHBoxLayout* buttonLayout = new QHBoxLayout;
	layout->addLayout(buttonLayout);
	QHBoxLayout* buttonLayout2 = new QHBoxLayout;
	layout->addLayout(buttonLayout2);

	mShowEraserCheckBox = new QCheckBox("Show");
	mShowEraserCheckBox->setToolTip("Show eraser sphere in the views.");
	connect(mShowEraserCheckBox, SIGNAL(toggled(bool)), this, SLOT(toggleShowEraser(bool)));
	buttonLayout->addWidget(mShowEraserCheckBox);

	mContinousEraseCheckBox = new QCheckBox("Continous");
	mContinousEraseCheckBox->setToolTip("Erase continously using the sphere. (might be slow)");
	connect(mContinousEraseCheckBox, SIGNAL(toggled(bool)), this, SLOT(toggleContinous(bool)));
	buttonLayout2->addWidget(mContinousEraseCheckBox);

	mDuplicateAction = this->createAction(this, QIcon(), "Duplicate", "Duplicate active volume - do this before erasing!",
		SLOT(duplicateSlot()), buttonLayout);

	mSaveAction = this->createAction(this, QIcon(), "Save", "Save modified image to disk",
		SLOT(saveSlot()), buttonLayout);

	mRemoveAction = this->createAction(this, QIcon(), "Erase", "Erase everything inside sphere",
		SLOT(removeSlot()), buttonLayout2);


	double sphereRadius = 10;
	mSphereSizeAdapter = DoubleProperty::initialize("SphereSize", "Sphere Size", "Radius of Eraser Sphere", sphereRadius, DoubleRange(0,200,1), 0, QDomNode());
	connect(mSphereSizeAdapter.get(), &DoubleProperty::changed, this, &EraserWidget::sphereSizeChangedSlot);
	mSphereSize = new SpinBoxAndSliderGroupWidget(this, mSphereSizeAdapter);
	layout->addWidget(mSphereSize);

	ImagePtr image = mPatientModelService->getActiveImage();
	int eraseValue = 0;
	if(image)
		eraseValue = image->getMin();
	mEraseValueAdapter = DoubleProperty::initialize("EraseValue", "Erase value", "Erase/draw with value", eraseValue, DoubleRange(1,200,1), 0, QDomNode());

	mActiveImageProxy = ActiveImageProxy::New(mPatientModelService);
	connect(mActiveImageProxy.get(), &ActiveImageProxy::activeImageChanged, this, &EraserWidget::activeImageChangedSlot);

	mEraseValueWidget = new SpinBoxAndSliderGroupWidget(this, mEraseValueAdapter);
	layout->addWidget(mEraseValueWidget);

	layout->addStretch();

	this->enableButtons();
}