MCPcopy Create free account
hub / github.com/MITK/MITK / InternalProcessing

Method InternalProcessing

Modules/Multilabel/src/mitkLabelSetImageToSurfaceFilter.cpp:86–225  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

84
85template <typename TPixel, unsigned int VDimension>
86void mitk::LabelSetImageToSurfaceFilter::InternalProcessing(const itk::Image<TPixel, VDimension> *input,
87 mitk::Surface * /*surface*/)
88{
89 typedef itk::Image<TPixel, VDimension> ImageType;
90
91 typedef itk::BinaryThresholdImageFilter<ImageType, ImageType> BinaryThresholdFilterType;
92 typedef itk::LabelObject<TPixel, VDimension> LabelObjectType;
93 typedef itk::LabelMap<LabelObjectType> LabelMapType;
94 typedef itk::LabelImageToLabelMapFilter<ImageType, LabelMapType> Image2LabelMapType;
95 typedef itk::AutoCropLabelMapFilter<LabelMapType> AutoCropType;
96 typedef itk::LabelMapToLabelImageFilter<LabelMapType, ImageType> LabelMap2ImageType;
97
98 typedef itk::Image<float, VDimension> RealImageType;
99
100 typedef itk::AntiAliasBinaryImageFilter<ImageType, RealImageType> AntiAliasFilterType;
101 typedef itk::SmoothingRecursiveGaussianImageFilter<RealImageType, RealImageType> GaussianFilterType;
102
103 typename BinaryThresholdFilterType::Pointer thresholdFilter = BinaryThresholdFilterType::New();
104 thresholdFilter->SetInput(input);
105 thresholdFilter->SetLowerThreshold(m_RequestedLabel);
106 thresholdFilter->SetUpperThreshold(m_RequestedLabel);
107 thresholdFilter->SetOutsideValue(0);
108 thresholdFilter->SetInsideValue(1);
109 // thresholdFilter->ReleaseDataFlagOn();
110 thresholdFilter->Update();
111
112 typename Image2LabelMapType::Pointer image2label = Image2LabelMapType::New();
113 image2label->SetInput(thresholdFilter->GetOutput());
114
115 typename AutoCropType::SizeType border;
116 border[0] = 3;
117 border[1] = 3;
118 border[2] = 3;
119
120 typename AutoCropType::Pointer autoCropFilter = AutoCropType::New();
121 autoCropFilter->SetInput(image2label->GetOutput());
122 autoCropFilter->SetCropBorder(border);
123 autoCropFilter->InPlaceOn();
124
125 typename LabelMap2ImageType::Pointer label2image = LabelMap2ImageType::New();
126 label2image->SetInput(autoCropFilter->GetOutput());
127
128 label2image->Update();
129
130 typename AntiAliasFilterType::Pointer antiAliasFilter = AntiAliasFilterType::New();
131 antiAliasFilter->SetInput(label2image->GetOutput());
132 antiAliasFilter->SetMaximumRMSError(0.001);
133 antiAliasFilter->SetNumberOfLayers(3);
134 antiAliasFilter->SetUseImageSpacing(false);
135 antiAliasFilter->SetNumberOfIterations(40);
136
137 antiAliasFilter->Update();
138
139 typename RealImageType::Pointer result;
140
141 if (m_UseSmoothing)
142 {
143 typename GaussianFilterType::Pointer gaussianFilter = GaussianFilterType::New();

Callers

nothing calls this directly

Calls 15

GetInputMethod · 0.95
CastToMitkImageFunction · 0.85
SetOutsideValueMethod · 0.80
GetSlicedGeometryMethod · 0.80
GetGeometryMethod · 0.80
SetInputConnectionMethod · 0.80
GetNumberOfPointsMethod · 0.80
GetMatrixMethod · 0.80
SetVtkPolyDataMethod · 0.80
NewFunction · 0.50
SetInputMethod · 0.45

Tested by

no test coverage detected