Exemplo n.º 1
0
bool SmoothingImageFilter::execute()
{
	ImagePtr input = this->getCopiedInputImage();
	if (!input)
		return false;

	DoublePropertyPtr sigma = this->getSigma(mCopiedOptions);

	itkImageType::ConstPointer itkImage = AlgorithmHelper::getITKfromSSCImage(input);

	typedef itk::SmoothingRecursiveGaussianImageFilter<itkImageType, itkImageType> smoothingFilterType;
	smoothingFilterType::Pointer smoohingFilter = smoothingFilterType::New();
	smoohingFilter->SetSigma(sigma->getValue());
	smoohingFilter->SetInput(itkImage);
	smoohingFilter->Update();
	itkImage = smoohingFilter->GetOutput();

	//Convert ITK to VTK
	itkToVtkFilterType::Pointer itkToVtkFilter = itkToVtkFilterType::New();
	itkToVtkFilter->SetInput(itkImage);
	itkToVtkFilter->Update();

	vtkImageDataPtr rawResult = vtkImageDataPtr::New();
	rawResult->DeepCopy(itkToVtkFilter->GetOutput());
	// TODO: possible memory problem here - check debug mem system of itk/vtk

	mRawResult =  rawResult;
	return true;
}
Exemplo n.º 2
0
DoublePropertyPtr DilationFilter::getDilationRadiusOption(QDomElement root)
{
	DoublePropertyPtr retval = DoubleProperty::initialize("Dilation radius (mm)", "",
    "Set dilation radius in mm", 1, DoubleRange(1, 20, 1), 0,
                    root);
	retval->setGuiRepresentation(DoublePropertyBase::grSLIDER);
	return retval;
}
Exemplo n.º 3
0
DoublePropertyPtr AirwaysFilter::getNoiseLevelOption(QDomElement root)
{
	DoublePropertyPtr retval = DoubleProperty::initialize("Noise level",
			"", "Select the amount of noise present in the image", 0.5,
			DoubleRange(0.0, 2, 0.5), 1, root);
	retval->setGuiRepresentation(DoubleProperty::grSLIDER);
	return retval;
}
Exemplo n.º 4
0
DoublePropertyPtr AirwaysFilter::getSensitivityOption(QDomElement root)
{
	DoublePropertyPtr retval = DoubleProperty::initialize("Sensitivity",
			"", "Select sensitivity for the segmentation", 0.85,
			DoubleRange(0.01, 1, 0.01), 2, root);
	retval->setGuiRepresentation(DoubleProperty::grSLIDER);
	return retval;

}
Exemplo n.º 5
0
DoublePropertyBasePtr NetworkConnectionHandle::createPortOption()
{
	DoublePropertyPtr retval;
	int defval = mClient->getConnectionInfo().port;
	retval = DoubleProperty::initialize("port", "Port",
										"Network Port (default "+QString::number(defval)+")",
										defval,
										DoubleRange(1024, 49151, 1), 0,
										mOptions.getElement());
	retval->setGuiRepresentation(DoublePropertyBase::grSPINBOX);
	retval->setAdvanced(true);
	retval->setGroup("Connection");
	connect(retval.get(), &Property::changed, this, &NetworkConnectionHandle::onPropertiesChanged);
	return retval;
}
Exemplo n.º 6
0
void FilterImpl::updateThresholdFromImageChange(QString uid, DoublePropertyPtr threshold)
{
	ImagePtr image = mServices->patient()->getData<Image>(uid);
	if(!image)
		return;
	threshold->setValueRange(DoubleRange(image->getMin(), image->getMax(), 1));
	int oldLower = threshold->getValue();
	// avoid reset if old value is still within range,
	// but reset anyway if old val is 0..1, this can indicate old image was binary.
	if ((image->getMin() > oldLower )||( oldLower > image->getMax() )||( oldLower<=1 ))
	{
		int initLower = ::ceil(double(image->getMin()) + double(image->getRange())/10); // round up
		threshold->setValue(initLower);
	}
//	std::cout << "FilterImpl::imageChangedSlot " << image->getMin() << " "  << image->getMax() << std::endl;
//	std::cout << "            imageChangedSlot() " << threshold->getValue() << std::endl;
}
Exemplo n.º 7
0
void Transform3DWidget::addTranslationControls(QString uid, QString name, int index, QVBoxLayout* layout)
{
  QHBoxLayout* hLayout = new QHBoxLayout;

  DoublePropertyPtr adapter = DoubleProperty::initialize(uid, name, "", 0, DoubleRange(-10000,10000,0.1),1);
  connect(adapter.get(), SIGNAL(changed()), this, SLOT(changedSlot()));
  adapter->setInternal2Display(1.0);
  hLayout->addWidget(new SpinBoxGroupWidget(this, adapter));

  QSize mMinBarSize = QSize(20,20);
  MousePadWidget* pad = new MousePadWidget(this, mMinBarSize);
  pad->setFixedYPos(true);
  hLayout->addWidget(pad);

  // use QtSignalAdapters library to work magic:
  QtSignalAdapters::connect1<void(QPointF)>(pad, SIGNAL(mouseMoved(QPointF)),
      boost::bind(&Transform3DWidget::translateSlot, this, _1, index));

  layout->addLayout(hLayout);
  mTranslationAdapter[index] = adapter;
}