14 #include "itkConnectedThresholdImageFilter.h" 40 mOutputBasePath = outputBasePath;
42 mLowerThreshold = lowerThreshold;
43 mUpperTheshold = upperThreshold;
44 mReplaceValue = replaceValue;
55 void ConnectedThresholdImageFilter::postProcessingSlot()
67 QString uid = mInput->getUid() +
"_seg%1";
68 QString name = mInput->getName()+
" seg%1";
74 mOutput->resetTransferFunctions();
76 mServices->patient()->insertData(mOutput);
79 reportSuccess(
"Done segmenting: \"" + mOutput->getName()+
"\"");
119 typedef itk::ConnectedThresholdImageFilter<itkImageType, itkImageType> thresholdFilterType;
120 thresholdFilterType::Pointer thresholdFilter = thresholdFilterType::New();
121 thresholdFilter->SetInput(itkImage);
124 thresholdFilter->SetLower(mLowerThreshold);
125 thresholdFilter->SetUpper(mUpperTheshold);
126 thresholdFilter->SetReplaceValue(mReplaceValue);
129 thresholdFilter->SetSeed(mSeed);
134 thresholdFilter->Update();
136 catch( itk::ExceptionObject & excep )
138 reportError(
"Error when setting seed for Connected Threshold Image Filter:");
142 itkImage = thresholdFilter->GetOutput();
146 itkToVtkFilter->SetInput(itkImage);
147 itkToVtkFilter->Update();
150 rawResult->DeepCopy(itkToVtkFilter->GetOutput());
QString qstring_cast(const T &val)
void reportError(QString msg)
Base class for algorithms that wants to thread and time their execution. T is the return type of the ...
boost::shared_ptr< class VisServices > VisServicesPtr
boost::shared_ptr< class Image > ImagePtr
ConnectedThresholdImageFilter(VisServicesPtr services)
ImagePtr createDerivedImage(PatientModelServicePtr dataManager, QString uid, QString name, vtkImageDataPtr raw, ImagePtr parent)
SmartPointer< Self > Pointer
void reportSuccess(QString msg)
virtual ~ConnectedThresholdImageFilter()
static itkImageType::ConstPointer getITKfromSSCImage(ImagePtr image)
vtkImageDataPtr getResult()
void setInput(ImagePtr image, QString outputBasePath, float lowerThreshold, float upperThreshold, int replaceValue, itkImageType::IndexType seed)
Namespace for all CustusX production code.