Medical Imaging Interaction Toolkit  2016.11.0
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,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 #ifndef __mitkToFCompositeFilter_h
17 #define __mitkToFCompositeFilter_h
18 
19 #include <mitkImage.h>
20 #include "mitkImageToImageFilter.h"
21 #include <MitkToFProcessingExports.h>
22 #include <cv.h>
23 #include <itkBilateralImageFilter.h>
24 
25 typedef itk::Image<float, 2> ItkImageType2D;
26 typedef itk::Image<float, 3> ItkImageType3D;
27 typedef itk::BilateralImageFilter<ItkImageType2D,ItkImageType2D> BilateralFilterType;
28 
29 namespace mitk
30 {
44  class MITKTOFPROCESSING_EXPORT ToFCompositeFilter : public ImageToImageFilter
45  {
46  public:
47 
49  itkFactorylessNewMacro(Self)
50  itkCloneMacro(Self)
51 
52  itkSetMacro(SegmentationMask,mitk::Image::Pointer);
53  itkSetMacro(ApplyTemporalMedianFilter,bool);
54  itkGetConstMacro(ApplyTemporalMedianFilter,bool);
55  itkSetMacro(ApplyAverageFilter,bool);
56  itkGetConstMacro(ApplyAverageFilter,bool);
57  itkSetMacro(ApplyMedianFilter,bool);
58  itkGetConstMacro(ApplyMedianFilter,bool);
59  itkSetMacro(ApplyThresholdFilter,bool);
60  itkGetConstMacro(ApplyThresholdFilter,bool);
61  itkSetMacro(ApplyMaskSegmentation,bool);
62  itkGetConstMacro(ApplyMaskSegmentation,bool);
63  itkSetMacro(ApplyBilateralFilter,bool);
64  itkGetConstMacro(ApplyBilateralFilter,bool);
65 
70  virtual void SetInput( Image* distanceImage);
71 
77  virtual void SetInput(unsigned int idx, Image* distanceImage);
78 
82  Image* GetInput();
83 
87  Image* GetInput(unsigned int idx);
92  void SetTemporalMedianFilterParameter(int tmporalMedianFilterNumOfFrames);
98  void SetThresholdFilterParameter(int min, int max);
105  void SetBilateralFilterParameter(double domainSigma, double rangeSigma, int kernelRadius);
106 
107  protected:
116  virtual void GenerateOutputInformation() override;
121  virtual void GenerateData() override;
129  void CreateOutputsForAllInputs();
135  void ProcessSegmentation(IplImage* inputIplImage);
140  ItkImageType2D::Pointer ProcessItkBilateralFilter(ItkImageType2D::Pointer inputItkImage);
145  void ProcessCVBilateralFilter(IplImage* inputIplImage, IplImage* outputIplImage);
150  void ProcessCVMedianFilter(IplImage* inputIplImage, IplImage* outputIplImage, int radius = 3);
154  void ProcessStreamedQuickSelectMedianImageFilter(IplImage* inputIplImage);
162  float quick_select(float arr[], int n);
166  void CreateItkImage(ItkImageType2D::Pointer &itkInputImage);
167 
169 
173 
174  IplImage* m_IplDistanceImage;
175  IplImage* m_IplOutputImage;
176 
178 
185 
186  float** m_DataBuffer;
189 
196 
197  };
198 } //END mitk namespace
199 #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::SmartPointer< Self > Pointer
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:44
Image class for storing images.
Definition: mitkImage.h:76
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:70
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:67
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