|
NorMIT-nav
22.09
An IGT application
|
Go to the documentation of this file.
20 #include <itkBinaryDilateImageFilter.h>
21 #include <itkBinaryBallStructuringElement.h>
23 #include <vtkImageCast.h>
47 return "dilation_filter";
53 "<h3>Dilation Filter.</h3>"
54 "<p>This filter dilates a binary volume with a given radius in mm.<p>"
55 "<p>The dilation is performed using a ball structuring element<p>"
62 "Set dilation radius in mm", 1,
DoubleRange(1, 20, 1), 0,
71 "Generate a surface of the output volume",
true,
79 "Color of output model.",
80 QColor(
"green"), root);
96 temp->setValueName(
"Input");
97 temp->setHelp(
"Select segmentation input for dilation");
106 temp->setValueName(
"Output");
107 temp->setHelp(
"Dilated segmentation image");
111 temp->setValueName(
"Contour");
112 temp->setHelp(
"Output contour generated from dilated segmentation image.");
129 Eigen::Array3d spacing = input->getSpacing();
130 itk::Size<3> radiusInVoxels;
131 radiusInVoxels[0] = radius/spacing(0);
132 radiusInVoxels[1] = radius/spacing(1);
133 radiusInVoxels[2] = radius/spacing(2);
138 typedef itk::BinaryBallStructuringElement<unsigned char,3> StructuringElementType;
139 StructuringElementType structuringElement;
140 structuringElement.SetRadius(radiusInVoxels);
141 structuringElement.CreateStructuringElement();
144 typedef itk::BinaryDilateImageFilter<itkImageType, itkImageType, StructuringElementType> dilateFilterType;
145 dilateFilterType::Pointer dilationFilter = dilateFilterType::New();
146 dilationFilter->SetInput(itkImage);
147 dilationFilter->SetKernel(structuringElement);
148 dilationFilter->SetDilateValue(1);
149 dilationFilter->Update();
150 itkImage = dilationFilter->GetOutput();
154 itkToVtkFilter->SetInput(itkImage);
155 itkToVtkFilter->Update();
158 rawResult->DeepCopy(itkToVtkFilter->GetOutput());
161 imageCast->SetInputData(rawResult);
162 imageCast->SetOutputScalarTypeToUnsignedChar();
164 rawResult = imageCast->GetOutput();
168 mRawResult = rawResult;
171 if (generateSurface->getValue())
173 double threshold = 1;
190 QString uid = input->getUid() +
"_seg%1";
191 QString name = input->getName()+
" seg%1";
199 output->resetTransferFunctions();
200 mServices->patient()->insertData(output);
206 if (mRawContour!=NULL)
static BoolPropertyPtr initialize(const QString &uid, QString name, QString help, bool value, QDomNode root=QDomNode())
boost::shared_ptr< class ColorProperty > ColorPropertyPtr
static StringPropertySelectDataPtr New(PatientModelServicePtr patientModelService, QString typeRegexp=".*")
static itkImageType::ConstPointer getITKfromSSCImage(ImagePtr image)
Namespace for all CustusX production code.
virtual void createOptions()
boost::shared_ptr< class BoolProperty > BoolPropertyPtr
boost::shared_ptr< class VisServices > VisServicesPtr
std::vector< SelectDataStringPropertyBasePtr > mOutputTypes
virtual QString getName() const
virtual void createOutputTypes()
static ColorPropertyPtr initialize(const QString &uid, QString name, QString help, QColor value, QDomNode root=QDomNode())
std::vector< SelectDataStringPropertyBasePtr > mInputTypes
QDomElement mCopiedOptions
ImagePtr getCopiedInputImage(int index=0)
static DoublePropertyPtr initialize(const QString &uid, QString name, QString help, double value, DoubleRange range, int decimals, QDomNode root=QDomNode())
boost::shared_ptr< class DoubleProperty > DoublePropertyPtr
virtual void createInputTypes()
boost::shared_ptr< class Mesh > MeshPtr
static StringPropertySelectImagePtr New(PatientModelServicePtr patientModelService)
virtual bool postProcess()
ColorPropertyPtr getColorOption(QDomElement root)
boost::shared_ptr< class Image > ImagePtr
vtkSmartPointer< vtkPolyData > vtkPolyDataPtr
ImagePtr createDerivedImage(PatientModelServicePtr dataManager, QString uid, QString name, vtkImageDataPtr raw, ImagePtr parent)
virtual QString getType() const
virtual bool postProcess()
SmartPointer< Self > Pointer
DoublePropertyPtr getDilationRadiusOption(QDomElement root)
virtual QString getHelp() const
virtual bool preProcess()
Utility class for describing a bounded numeric range.
vtkSmartPointer< class vtkImageCast > vtkImageCastPtr
BoolPropertyPtr getGenerateSurfaceOption(QDomElement root)
DilationFilter(VisServicesPtr services)
std::vector< PropertyPtr > mOptionsAdapters
boost::shared_ptr< class SelectDataStringPropertyBase > SelectDataStringPropertyBasePtr