NifTK  16.4.1 - 0798f20
CMIC's Translational Medical Imaging Platform
itkBrainMaskFromCTFilter.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 #ifndef ITKBRAINMASKFROMCTFILTER_H
15 #define ITKBRAINMASKFROMCTFILTER_H
16 
17 #include <itkImageToImageFilter.h>
18 #include <itkMacro.h>
19 #include <itkBinaryThresholdImageFilter.h>
20 #include <itkConnectedComponentImageFilter.h>
21 #include <itkLabelShapeKeepNObjectsImageFilter.h>
22 #include <itkOtsuThresholdImageFilter.h>
23 #include <itkImageDuplicator.h>
24 #include <itkMaskImageFilter.h>
25 #include <itkBinaryBallStructuringElement.h>
26 #include <itkBinaryCrossStructuringElement.h>
27 #include <itkBinaryDilateImageFilter.h>
28 #include <itkBinaryErodeImageFilter.h>
29 
30 namespace itk {
31 
37 template < class TInputImage, class TOutputImage >
38 class ITK_EXPORT BrainMaskFromCTFilter :
39  public ImageToImageFilter< TInputImage, TOutputImage >
40 {
41 public:
44  typedef ImageToImageFilter<TInputImage,TOutputImage> Superclass;
45  typedef SmartPointer<Self> Pointer;
46  typedef SmartPointer<const Self> ConstPointer;
47 
49  itkNewMacro(Self);
50 
52  itkTypeMacro(BrainMaskFromCTFilter, ImageToImageFilter);
53 
54  itkStaticConstMacro(ImageDimension, unsigned int, TInputImage::ImageDimension);
55 
57  typedef typename Superclass::InputImageType InputImageType;
58  typedef typename Superclass::OutputImageType OutputImageType;
59  typedef typename Superclass::InputImagePointer InputImagePointer;
60  typedef typename Superclass::OutputImagePointer OutputImagePointer;
61  typedef typename Superclass::InputImageConstPointer InputImageConstPointer;
62 
64  itkBooleanMacro(CheckHounsFieldUnits);
65  itkGetConstMacro(CheckHounsFieldUnits, bool);
66  itkSetMacro(CheckHounsFieldUnits, bool);
67  itkBooleanMacro(IsHU);
68  itkGetConstMacro(IsHU, bool);
69  itkSetMacro(IsHU, bool);
70 
73 
74 protected:
77  void PrintSelf(std::ostream&os, Indent indent) const;
78 
79  typedef itk::BinaryThresholdImageFilter<InputImageType,
80  OutputImageType> ThreshFilterType;
81  typedef itk::ConnectedComponentImageFilter<OutputImageType,
82  OutputImageType> ConnectFilterType;
83  typedef itk::LabelShapeKeepNObjectsImageFilter< OutputImageType >
85  typedef itk::OtsuThresholdImageFilter <InputImageType,
86  OutputImageType> OtsuFilterType;
87  typedef itk::ImageDuplicator< OutputImageType > DuplicatorType;
88  typedef itk::MaskImageFilter< OutputImageType, OutputImageType > MaskFilterType;
89  typedef itk::BinaryBallStructuringElement<OutputPixelType,ImageDimension>
91  typedef itk::BinaryDilateImageFilter<OutputImageType,
92  OutputImageType,
94  typedef itk::BinaryCrossStructuringElement<OutputPixelType,
95  ImageDimension> CrossType;
96  typedef itk::BinaryDilateImageFilter<OutputImageType,
97  OutputImageType,
99  typedef itk::BinaryErodeImageFilter<OutputImageType,
100  OutputImageType,
102 
103 
105  virtual void GenerateData();
106 
110  bool m_IsHU;
111 
112 private:
113  BrainMaskFromCTFilter(const Self&); //purposely not implemented
114  void operator=(const Self&); //purposely not implemented
115 
116  static const InputPixelType lowThresh_HU = 600;
117  static const InputPixelType lowThresh_noHU = 1624;
118 
120  void checkHounsfieldImage();
121 
122 
123 
124 };
125 } // namespace itk
126 
127 #ifndef ITK_MANUAL_INSTANTIATION
128 #include "itkBrainMaskFromCTFilter.txx"
129 #endif
130 
131 #endif // ITKBRAINMASKFROMCTFILTER_H
Superclass::InputImageType InputImageType
Definition: itkBrainMaskFromCTFilter.h:57
itk::MaskImageFilter< OutputImageType, OutputImageType > MaskFilterType
Definition: itkBrainMaskFromCTFilter.h:88
bool m_IsHU
Definition: itkBrainMaskFromCTFilter.h:110
InputImageType::PixelType InputPixelType
Definition: itkBrainMaskFromCTFilter.h:69
itk::BinaryDilateImageFilter< OutputImageType, OutputImageType, CrossType > DilateCrossFilterType
Definition: itkBrainMaskFromCTFilter.h:98
itk::BinaryBallStructuringElement< OutputPixelType, ImageDimension > StructuringElementType
Definition: itkBrainMaskFromCTFilter.h:90
SmartPointer< const Self > ConstPointer
Definition: itkBrainMaskFromCTFilter.h:46
Superclass::InputImageConstPointer InputImageConstPointer
Definition: itkBrainMaskFromCTFilter.h:61
BrainMaskFromCTFilter Self
Definition: itkBrainMaskFromCTFilter.h:43
Definition: niftkITKAffineResampleImage.cxx:74
Superclass::InputImagePointer InputImagePointer
Definition: itkBrainMaskFromCTFilter.h:59
bool m_CheckHounsFieldUnits
Definition: itkBrainMaskFromCTFilter.h:108
itk::LabelShapeKeepNObjectsImageFilter< OutputImageType > LabelShapeKeepNObjectsImageFilterType
Definition: itkBrainMaskFromCTFilter.h:84
itk::BinaryErodeImageFilter< OutputImageType, OutputImageType, StructuringElementType > ErodeFilterType
Definition: itkBrainMaskFromCTFilter.h:101
Superclass::OutputImagePointer OutputImagePointer
Definition: itkBrainMaskFromCTFilter.h:60
itk::BinaryDilateImageFilter< OutputImageType, OutputImageType, StructuringElementType > DilateFilter
Definition: itkBrainMaskFromCTFilter.h:93
itk::BinaryCrossStructuringElement< OutputPixelType, ImageDimension > CrossType
Definition: itkBrainMaskFromCTFilter.h:95
float PixelType
Definition: niftkBreastDCEandADC.cxx:88
itk::ConnectedComponentImageFilter< OutputImageType, OutputImageType > ConnectFilterType
Definition: itkBrainMaskFromCTFilter.h:82
itk::ImageDuplicator< OutputImageType > DuplicatorType
Definition: itkBrainMaskFromCTFilter.h:87
OutputImageType::PixelType OutputPixelType
Definition: itkBrainMaskFromCTFilter.h:72
~BrainMaskFromCTFilter()
Definition: itkBrainMaskFromCTFilter.h:76
ImageToImageFilter< TInputImage, TOutputImage > Superclass
Definition: itkBrainMaskFromCTFilter.h:44
Filter to extract the brain from a CT image. Optionally, the filter can receive a T1 image...
Definition: itkBrainMaskFromCTFilter.h:38
Superclass::OutputImageType OutputImageType
Definition: itkBrainMaskFromCTFilter.h:58
itk::OtsuThresholdImageFilter< InputImageType, OutputImageType > OtsuFilterType
Definition: itkBrainMaskFromCTFilter.h:86
itk::BinaryThresholdImageFilter< InputImageType, OutputImageType > ThreshFilterType
Definition: itkBrainMaskFromCTFilter.h:80
SmartPointer< Self > Pointer
Definition: itkBrainMaskFromCTFilter.h:45