MedicalVisualization
Thresholding with ITK
← ITK Pipeline | ● | Dicom Writer with ITK →
Simple thresholding example:
The threshold filter compares the input image with a threshold and replaces the image pixels which are below the threshold with an outside color (black by default).
#include "itkThresholdImageFilter.h"
// create threshold filter
typedef itk::ThresholdImageFilter<Image3DType> ThresholdImageFilterType;
ThresholdImageFilterType::Pointer thresholdFilter = ThresholdImageFilterType::New();
// filter settings
thresholdFilter->ThresholdBelow(200);
thresholdFilter->SetOutsideValue(0);
// connect input of filter to output of reader
thresholdFilter->SetInput(reader->GetOutput());
// pull the pipeline at its end
thresholdFilter->Update();
// create threshold filter
typedef itk::ThresholdImageFilter<Image3DType> ThresholdImageFilterType;
ThresholdImageFilterType::Pointer thresholdFilter = ThresholdImageFilterType::New();
// filter settings
thresholdFilter->ThresholdBelow(200);
thresholdFilter->SetOutsideValue(0);
// connect input of filter to output of reader
thresholdFilter->SetInput(reader->GetOutput());
// pull the pipeline at its end
thresholdFilter->Update();
Histogram-based thresholding example:
Other intensity filters:
- itk::BinaryThresholdImageFilter
- itk::IntensityWindowingImageFilter
- itk::RescaleIntensityImageFilter
- itk::SigmoidImageFilter
← ITK Pipeline | ● | Dicom Writer with ITK →