35 #include "itkConnectedThresholdImageFilter.h" 61 mOutputBasePath = outputBasePath;
63 mLowerThreshold = lowerThreshold;
64 mUpperTheshold = upperThreshold;
65 mReplaceValue = replaceValue;
76 void ConnectedThresholdImageFilter::postProcessingSlot()
88 QString uid = mInput->getUid() +
"_seg%1";
89 QString name = mInput->getName()+
" seg%1";
95 mOutput->resetTransferFunctions();
97 mServices->patient()->insertData(mOutput);
100 reportSuccess(
"Done segmenting: \"" + mOutput->getName()+
"\"");
140 typedef itk::ConnectedThresholdImageFilter<itkImageType, itkImageType> thresholdFilterType;
141 thresholdFilterType::Pointer thresholdFilter = thresholdFilterType::New();
142 thresholdFilter->SetInput(itkImage);
145 thresholdFilter->SetLower(mLowerThreshold);
146 thresholdFilter->SetUpper(mUpperTheshold);
147 thresholdFilter->SetReplaceValue(mReplaceValue);
150 thresholdFilter->SetSeed(mSeed);
155 thresholdFilter->Update();
157 catch( itk::ExceptionObject & excep )
159 reportError(
"Error when setting seed for Connected Threshold Image Filter:");
163 itkImage = thresholdFilter->GetOutput();
167 itkToVtkFilter->SetInput(itkImage);
168 itkToVtkFilter->Update();
171 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.