Medical Imaging Interaction Toolkit  2023.12.00
Medical Imaging Interaction Toolkit
mitkToFCompositeFilter.h
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 #ifndef mitkToFCompositeFilter_h
13 #define mitkToFCompositeFilter_h
14 
15 #include <mitkImage.h>
16 #include "mitkImageToImageFilter.h"
17 #include <MitkToFProcessingExports.h>
18 #include <itkBilateralImageFilter.h>
19 #include <opencv2/core/types_c.h>
20 
21 typedef itk::Image<float, 2> ItkImageType2D;
22 typedef itk::Image<float, 3> ItkImageType3D;
23 typedef itk::BilateralImageFilter<ItkImageType2D,ItkImageType2D> BilateralFilterType;
24 
25 namespace mitk
26 {
40  class MITKTOFPROCESSING_EXPORT ToFCompositeFilter : public ImageToImageFilter
41  {
42  public:
43 
45  itkFactorylessNewMacro(Self);
46  itkCloneMacro(Self);
47  itkSetMacro(SegmentationMask,mitk::Image::Pointer);
48  itkSetMacro(ApplyTemporalMedianFilter,bool);
49  itkGetConstMacro(ApplyTemporalMedianFilter,bool);
50  itkSetMacro(ApplyAverageFilter,bool);
51  itkGetConstMacro(ApplyAverageFilter,bool);
52  itkSetMacro(ApplyMedianFilter,bool);
53  itkGetConstMacro(ApplyMedianFilter,bool);
54  itkSetMacro(ApplyThresholdFilter,bool);
55  itkGetConstMacro(ApplyThresholdFilter,bool);
56  itkSetMacro(ApplyMaskSegmentation,bool);
57  itkGetConstMacro(ApplyMaskSegmentation,bool);
58  itkSetMacro(ApplyBilateralFilter,bool);
59  itkGetConstMacro(ApplyBilateralFilter,bool);
60 
61  using itk::ProcessObject::SetInput;
62 
67  void SetInput( const InputImageType* distanceImage) override;
68 
74  void SetInput(unsigned int idx, const InputImageType* distanceImage) override;
75 
79  Image* GetInput();
80 
84  Image* GetInput(unsigned int idx);
89  void SetTemporalMedianFilterParameter(int tmporalMedianFilterNumOfFrames);
95  void SetThresholdFilterParameter(int min, int max);
102  void SetBilateralFilterParameter(double domainSigma, double rangeSigma, int kernelRadius);
103 
104  protected:
112  ~ToFCompositeFilter() override;
113  void GenerateOutputInformation() override;
118  void GenerateData() override;
126  void CreateOutputsForAllInputs();
132  void ProcessSegmentation(IplImage* inputIplImage);
136  ItkImageType2D::Pointer ProcessItkBilateralFilter(ItkImageType2D::Pointer inputItkImage);
140  void ProcessCVBilateralFilter(IplImage* inputIplImage, IplImage* outputIplImage);
144  void ProcessCVMedianFilter(IplImage* inputIplImage, IplImage* outputIplImage, int radius = 3);
148  void ProcessStreamedQuickSelectMedianImageFilter(IplImage* inputIplImage);
156  float quick_select(float arr[], int n);
160  void CreateItkImage(ItkImageType2D::Pointer &itkInputImage);
161 
163 
167 
168  IplImage* m_IplDistanceImage;
169  IplImage* m_IplOutputImage;
170 
171  ItkImageType2D::Pointer m_ItkInputImage;
172 
179 
180  float** m_DataBuffer;
183 
190 
191  };
192 } //END mitk namespace
193 #endif
mitk::ToFCompositeFilter::m_ApplyThresholdFilter
bool m_ApplyThresholdFilter
Flag indicating if the threshold filter is currently active for processing the distance image.
Definition: mitkToFCompositeFilter.h:176
mitk::ToFCompositeFilter::m_ApplyMedianFilter
bool m_ApplyMedianFilter
Flag indicating if the spatial median filter is currently active for processing the distance image.
Definition: mitkToFCompositeFilter.h:175
mitk::ToFCompositeFilter::m_IplDistanceImage
IplImage * m_IplDistanceImage
OpenCV-representation of the distance image.
Definition: mitkToFCompositeFilter.h:168
mitk::ToFCompositeFilter::m_ApplyTemporalMedianFilter
bool m_ApplyTemporalMedianFilter
Flag indicating if the temporal median filter is currently active for processing the distance image.
Definition: mitkToFCompositeFilter.h:173
mitkImageToImageFilter.h
mitk::ToFCompositeFilter::m_ImageWidth
int m_ImageWidth
x-dimension of the image
Definition: mitkToFCompositeFilter.h:164
mitkImage.h
mitk::Image
Image class for storing images.
Definition: mitkImage.h:69
itk::SmartPointer< Self >
mitk::ToFCompositeFilter
Applies a common filter-pipeline to the first input of this filter.
Definition: mitkToFCompositeFilter.h:40
mitk::ToFCompositeFilter::m_ThresholdFilterMax
int m_ThresholdFilterMax
Lower threshold of the threshold filter. Pixels with values above will be assigned value 0 when apply...
Definition: mitkToFCompositeFilter.h:186
mitk::ToFCompositeFilter::m_ApplyBilateralFilter
bool m_ApplyBilateralFilter
Flag indicating if the bilateral filter is currently active for processing the distance image.
Definition: mitkToFCompositeFilter.h:178
mitk
Find image slices visible on a given plane.
Definition: RenderingTests.dox:1
mitk::ToFCompositeFilter::m_BilateralFilterKernelRadius
int m_BilateralFilterKernelRadius
Kernel radius of the bilateral filter mask.
Definition: mitkToFCompositeFilter.h:189
ItkImageType3D
itk::Image< float, 3 > ItkImageType3D
Definition: mitkToFCompositeFilter.h:22
mitk::BaseDataSource
Superclass of all classes generating some kind of mitk::BaseData.
Definition: mitkBaseDataSource.h:71
mitk::ToFCompositeFilter::m_ImageHeight
int m_ImageHeight
y-dimension of the image
Definition: mitkToFCompositeFilter.h:165
mitk::ToFCompositeFilter::m_BilateralFilterDomainSigma
double m_BilateralFilterDomainSigma
Parameter of the bilateral filter controlling the smoothing effect of the filter. Default value: 2.
Definition: mitkToFCompositeFilter.h:187
ItkImageType2D
itk::Image< float, 2 > ItkImageType2D
Definition: mitkToFCompositeFilter.h:21
mitk::ToFCompositeFilter::m_SegmentationMask
mitk::Image::Pointer m_SegmentationMask
mask image used for segmenting the image
Definition: mitkToFCompositeFilter.h:162
mitk::ToFCompositeFilter::m_DataBufferCurrentIndex
int m_DataBufferCurrentIndex
Current index in the buffer of the temporal median filter.
Definition: mitkToFCompositeFilter.h:181
mitk::ToFCompositeFilter::m_DataBufferMaxSize
int m_DataBufferMaxSize
Maximal size for the buffer of the temporal median filter (m_DataBuffer)
Definition: mitkToFCompositeFilter.h:182
mitk::ToFCompositeFilter::m_TemporalMedianFilterNumOfFrames
int m_TemporalMedianFilterNumOfFrames
Number of frames to be used in the calculation of the temporal median.
Definition: mitkToFCompositeFilter.h:184
mitk::ToFCompositeFilter::m_ApplyMaskSegmentation
bool m_ApplyMaskSegmentation
Flag indicating if a mask segmentation is performed.
Definition: mitkToFCompositeFilter.h:177
mitk::ToFCompositeFilter::m_ThresholdFilterMin
int m_ThresholdFilterMin
Lower threshold of the threshold filter. Pixels with values below will be assigned value 0 when apply...
Definition: mitkToFCompositeFilter.h:185
mitkClassMacro
#define mitkClassMacro(className, SuperClassName)
Definition: mitkCommon.h:36
mitk::ToFCompositeFilter::m_ItkInputImage
ItkImageType2D::Pointer m_ItkInputImage
ITK representation of the distance image.
Definition: mitkToFCompositeFilter.h:171
mitk::ToFCompositeFilter::m_ImageSize
int m_ImageSize
size of the image in bytes
Definition: mitkToFCompositeFilter.h:166
mitk::ToFCompositeFilter::m_IplOutputImage
IplImage * m_IplOutputImage
OpenCV-representation of the output image.
Definition: mitkToFCompositeFilter.h:169
mitk::ToFCompositeFilter::m_DataBuffer
float ** m_DataBuffer
Buffer used for calculating the pixel-wise median over the last n (m_TemporalMedianFilterNumOfFrames)...
Definition: mitkToFCompositeFilter.h:180
mitk::ImageToImageFilter
Superclass of all classes having one or more Images as input and generating Images as output.
Definition: mitkImageToImageFilter.h:25
BilateralFilterType
itk::BilateralImageFilter< ItkImageType2D, ItkImageType2D > BilateralFilterType
Definition: mitkToFCompositeFilter.h:23
mitk::ToFCompositeFilter::m_BilateralFilterRangeSigma
double m_BilateralFilterRangeSigma
Parameter of the bilateral filter controlling the edge preserving effect of the filter....
Definition: mitkToFCompositeFilter.h:188
mitk::ToFCompositeFilter::m_ApplyAverageFilter
bool m_ApplyAverageFilter
Flag indicating if the average filter is currently active for processing the distance image.
Definition: mitkToFCompositeFilter.h:174