| 84 | |
| 85 | template <typename TPixel, unsigned int VDimension> |
| 86 | void 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(); |
nothing calls this directly
no test coverage detected