Medical Imaging Interaction Toolkit  2018.4.99-a3d2e8fb
Medical Imaging Interaction Toolkit
Go to the documentation of this file.
1 /*============================================================================
3 The Medical Imaging Interaction Toolkit (MITK)
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
11 ============================================================================*/
12 #ifndef __mitkToFCompositeFilter_h
13 #define __mitkToFCompositeFilter_h
15 #include <mitkImage.h>
16 #include "mitkImageToImageFilter.h"
18 #include <itkBilateralImageFilter.h>
19 #include "opencv2/core.hpp"
21 typedef itk::Image<float, 2> ItkImageType2D;
22 typedef itk::Image<float, 3> ItkImageType3D;
23 typedef itk::BilateralImageFilter<ItkImageType2D,ItkImageType2D> BilateralFilterType;
25 namespace mitk
26 {
41  {
42  public:
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);
61  using itk::ProcessObject::SetInput;
67  void SetInput( const InputImageType* distanceImage) override;
74  void SetInput(unsigned int idx, const InputImageType* distanceImage) override;
79  Image* GetInput();
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);
104  protected:
112  ~ToFCompositeFilter() override;
113  void GenerateOutputInformation() override;
118  void GenerateData() override;
126  void CreateOutputsForAllInputs();
132  void ProcessSegmentation(IplImage* inputIplImage);
137  ItkImageType2D::Pointer ProcessItkBilateralFilter(ItkImageType2D::Pointer inputItkImage);
142  void ProcessCVBilateralFilter(IplImage* inputIplImage, IplImage* outputIplImage);
147  void ProcessCVMedianFilter(IplImage* inputIplImage, IplImage* outputIplImage, int radius = 3);
151  void ProcessStreamedQuickSelectMedianImageFilter(IplImage* inputIplImage);
159  float quick_select(float arr[], int n);
163  void CreateItkImage(ItkImageType2D::Pointer &itkInputImage);
171  IplImage* m_IplDistanceImage;
172  IplImage* m_IplOutputImage;
174  ItkImageType2D::Pointer m_ItkInputImage;
183  float** m_DataBuffer;
194  };
195 } //END mitk namespace
196 #endif
bool m_ApplyMaskSegmentation
Flag indicating if a mask segmentation is performed.
bool m_ApplyBilateralFilter
Flag indicating if the bilateral filter is currently active for processing the distance image...
itk::Image< float, 2 > ItkImageType2D
bool m_ApplyThresholdFilter
Flag indicating if the threshold filter is currently active for processing the distance image...
double m_BilateralFilterRangeSigma
Parameter of the bilateral filter controlling the edge preserving effect of the filter. Default value: 60.
bool m_ApplyMedianFilter
Flag indicating if the spatial median filter is currently active for processing the distance image...
int m_ImageWidth
x-dimension of the image
Superclass of all classes generating some kind of mitk::BaseData.
bool m_ApplyAverageFilter
Flag indicating if the average filter is currently active for processing the distance image...
DataCollection - Class to facilitate loading/accessing structured data.
ItkImageType2D::Pointer m_ItkInputImage
ITK representation of the distance image.
int m_TemporalMedianFilterNumOfFrames
Number of frames to be used in the calculation of the temporal median.
itk::BilateralImageFilter< ItkImageType2D, ItkImageType2D > BilateralFilterType
IplImage * m_IplOutputImage
OpenCV-representation of the output image.
int m_ImageHeight
y-dimension of the image
int m_ThresholdFilterMin
Lower threshold of the threshold filter. Pixels with values below will be assigned value 0 when apply...
#define mitkClassMacro(className, SuperClassName)
Definition: mitkCommon.h:40
Image class for storing images.
Definition: mitkImage.h:72
double m_BilateralFilterDomainSigma
Parameter of the bilateral filter controlling the smoothing effect of the filter. Default value: 2...
int m_ImageSize
size of the image in bytes
float ** m_DataBuffer
Buffer used for calculating the pixel-wise median over the last n (m_TemporalMedianFilterNumOfFrames)...
int m_DataBufferMaxSize
Maximal size for the buffer of the temporal median filter (m_DataBuffer)
static T max(T x, T y)
Definition: svm.cpp:56
Superclass of all classes having one or more Images as input and generating Images as output...
int m_BilateralFilterKernelRadius
Kernel radius of the bilateral filter mask.
mitk::Image::Pointer m_SegmentationMask
mask image used for segmenting the image
static T min(T x, T y)
Definition: svm.cpp:53
int m_DataBufferCurrentIndex
Current index in the buffer of the temporal median filter.
Applies a common filter-pipeline to the first input of this filter.
bool m_ApplyTemporalMedianFilter
Flag indicating if the temporal median filter is currently active for processing the distance image...
int m_ThresholdFilterMax
Lower threshold of the threshold filter. Pixels with values above will be assigned value 0 when apply...
IplImage * m_IplDistanceImage
OpenCV-representation of the distance image.
itk::Image< float, 3 > ItkImageType3D