NifTK  16.4.1 - 0798f20
CMIC's Translational Medical Imaging Platform
itkMIDASMeanIntensityWithinARegionFilter.h
Go to the documentation of this file.
1 /*=============================================================================
2 
3  NifTK: A software platform for medical image computing.
4 
5  Copyright (c) University College London (UCL). All rights reserved.
6 
7  This software is distributed WITHOUT ANY WARRANTY; without even
8  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
9  PURPOSE.
10 
11  See LICENSE.txt in the top level directory for details.
12 
13 =============================================================================*/
14 
15 #ifndef itkMIDASMeanIntensityWithinARegionFilter_h
16 #define itkMIDASMeanIntensityWithinARegionFilter_h
17 
18 #include <itkImageToImageFilter.h>
19 
20 namespace itk
21 {
22 
36  template <class TInputImage1, class TInputImage2, class TOutputImage>
37  class ITK_EXPORT MIDASMeanIntensityWithinARegionFilter : public ImageToImageFilter<TInputImage1, TOutputImage>
38  {
39  public:
42  typedef ImageToImageFilter<TInputImage1, TOutputImage> SuperClass;
43  typedef SmartPointer<Self> Pointer;
44  typedef SmartPointer<const Self> ConstPointer;
45 
47  itkNewMacro(Self);
48 
50  itkTypeMacro(MIDASMeanIntensityWithinARegionFilter, ImageToImageFilter);
51 
53  typedef TInputImage1 InputMainImageType;
54  typedef typename InputMainImageType::ConstPointer InputMainImageConstPointer;
55  typedef typename InputMainImageType::Pointer InputMainImagePointer;
60 
61  typedef TInputImage2 InputMaskImageType;
62  typedef typename InputMaskImageType::ConstPointer InputMaskImageConstPointer;
63  typedef typename InputMaskImageType::Pointer InputMaskImagePointer;
68 
69  typedef TInputImage1 OutputImageType;
70  typedef typename OutputImageType::Pointer OutputImagePointer;
74 
76  void SetGreyScaleImageInput(const InputMainImageType* image);
77 
79  void SetBinaryImageInput(const InputMaskImageType* image);
80 
82  double GetMeanIntensityMainImage();
83 
85  unsigned long int GetCount();
86 
88  itkSetMacro(InValue, InputMaskImagePixelType);
89  itkGetConstMacro(InValue, InputMaskImagePixelType);
90 
91  protected:
94  void PrintSelf(std::ostream& os, Indent indent) const;
95 
97  void AllocateOutputs();
98 
100  virtual void BeforeThreadedGenerateData();
101 
102  // The main method to implement in derived classes, note, its threaded.
103  virtual void ThreadedGenerateData(const InputMainImageRegionType &outputRegionForThread, ThreadIdType ThreadID);
104 
106  virtual void AfterThreadedGenerateData();
107 
108  private:
109  MIDASMeanIntensityWithinARegionFilter(const Self&); //purposely not implemented
110  void operator=(const Self&); //purposely not implemented
111 
112  double m_MeanIntensityMainImage;
113  unsigned long int m_Counter;
114  std::vector<double> m_TotalIntensityVector;
115  std::vector<unsigned long int> m_CountPixelsVector;
116  InputMaskImagePixelType m_InValue;
117 
118  };
119 
120 }
121 
122 #ifndef ITK_MANUAL_INSTANTIATION
123 #include "itkMIDASMeanIntensityWithinARegionFilter.txx"
124 #endif
125 
126 #endif
SmartPointer< Self > Pointer
Definition: itkMIDASMeanIntensityWithinARegionFilter.h:43
SmartPointer< const Self > ConstPointer
Definition: itkMIDASMeanIntensityWithinARegionFilter.h:44
InputMaskImageType::PixelType InputMaskImagePixelType
Definition: itkMIDASMeanIntensityWithinARegionFilter.h:65
ImageType::SizeType SizeType
Definition: niftkMakeLapUSProbeBasicModel.cxx:31
InputMainImageType::IndexType InputMainImageIndexType
Definition: itkMIDASMeanIntensityWithinARegionFilter.h:58
OutputImageType::SizeType OutputImageSizeType
Definition: itkMIDASMeanIntensityWithinARegionFilter.h:72
InputMainImageType::PixelType InputMainImagePixelType
Definition: itkMIDASMeanIntensityWithinARegionFilter.h:57
OutputImageType::IndexType OutputImageIndexType
Definition: itkMIDASMeanIntensityWithinARegionFilter.h:73
InputMaskImageType::Pointer InputMaskImagePointer
Definition: itkMIDASMeanIntensityWithinARegionFilter.h:63
GLenum GLsizei GLenum GLenum const GLvoid * image
Definition: glew.h:4052
InputMainImageType::Pointer InputMainImagePointer
Definition: itkMIDASMeanIntensityWithinARegionFilter.h:55
InputMaskImageType::RegionType InputMaskImageRegionType
Definition: itkMIDASMeanIntensityWithinARegionFilter.h:64
Definition: niftkITKAffineResampleImage.cxx:74
ImageType::IndexType IndexType
Definition: niftkMakeLapUSProbeBasicModel.cxx:32
MIDASMeanIntensityWithinARegionFilter Self
Definition: itkMIDASMeanIntensityWithinARegionFilter.h:41
InputMainImageType::ConstPointer InputMainImageConstPointer
Definition: itkMIDASMeanIntensityWithinARegionFilter.h:54
TInputImage1 OutputImageType
Definition: itkMIDASMeanIntensityWithinARegionFilter.h:69
InputMainImageType::SizeType InputMainImageSizeType
Definition: itkMIDASMeanIntensityWithinARegionFilter.h:59
OutputImageType::Pointer OutputImagePointer
Definition: itkMIDASMeanIntensityWithinARegionFilter.h:70
ImageToImageFilter< TInputImage1, TOutputImage > SuperClass
Definition: itkMIDASMeanIntensityWithinARegionFilter.h:42
float PixelType
Definition: niftkBreastDCEandADC.cxx:88
InputMaskImageType::IndexType InputMaskImageIndexType
Definition: itkMIDASMeanIntensityWithinARegionFilter.h:66
ImageType::RegionType RegionType
Definition: niftkMakeLapUSProbeBasicModel.cxx:30
OutputImageType::RegionType OutputImageRegionType
Definition: itkMIDASMeanIntensityWithinARegionFilter.h:71
virtual ~MIDASMeanIntensityWithinARegionFilter()
Definition: itkMIDASMeanIntensityWithinARegionFilter.h:93
TInputImage1 InputMainImageType
Definition: itkMIDASMeanIntensityWithinARegionFilter.h:50
InputMainImageType::RegionType InputMainImageRegionType
Definition: itkMIDASMeanIntensityWithinARegionFilter.h:56
calculate the mean intensity within a binary mask (region).
Definition: itkMIDASMeanIntensityWithinARegionFilter.h:37
TInputImage2 InputMaskImageType
Definition: itkMIDASMeanIntensityWithinARegionFilter.h:61
InputMaskImageType::ConstPointer InputMaskImageConstPointer
Definition: itkMIDASMeanIntensityWithinARegionFilter.h:62
InputMaskImageType::SizeType InputMaskImageSizeType
Definition: itkMIDASMeanIntensityWithinARegionFilter.h:67