NifTK  16.4.1 - 0798f20
CMIC's Translational Medical Imaging Platform
itkLightLineResponseImageFilter.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 itkLightLineResponseImageFilter_h
16 #define itkLightLineResponseImageFilter_h
17 
18 #include <itkImageToImageFilter.h>
20 #include <itkMaskImageFilter.h>
21 
22 #include <vnl/vnl_double_2.h>
23 
24 namespace itk {
25 
31 template<class TInputImage, class TOutputImage>
33  public ImageToImageFilter< TInputImage, TOutputImage >
34 {
35 public:
38  typedef ImageToImageFilter< TInputImage,TOutputImage > Superclass;
39  typedef SmartPointer< Self > Pointer;
40  typedef SmartPointer< const Self > ConstPointer;
41 
43  itkTypeMacro( LightLineResponseImageFilter, ImageToImageFilter );
44 
46  itkNewMacro(Self);
47 
49  itkStaticConstMacro(ImageDimension, unsigned int,
50  TInputImage::ImageDimension);
51 
53  typedef TInputImage InputImageType;
54  typedef typename InputImageType::Pointer InputImagePointer;
55  typedef typename InputImageType::ConstPointer InputImageConstPointer;
58  typedef typename InputImageType::SpacingType InputImageSpacingType;
59  typedef typename InputImageType::PointType InputImagePointType;
60 
61  typedef typename NumericTraits<InputImagePixelType>::RealType RealType;
62 
64  typedef TOutputImage OutputImageType;
65  typedef typename OutputImageType::Pointer OutputImagePointer;
69  typedef typename OutputImageType::PointType OutputImagePointType;
70 
71  typedef OutputImagePointType OriginType;
72 
74  typedef unsigned char MaskPixelType;
75  typedef typename itk::Image<MaskPixelType, ImageDimension> MaskImageType;
76  typedef typename MaskImageType::Pointer MaskImagePointer;
77 
78  typedef typename itk::MaskImageFilter< OutputImageType, MaskImageType, OutputImageType > MaskFilterType;
79  typedef typename MaskFilterType::Pointer MaskFilterPointer;
80 
81 
86  typedef float InternalRealType;
87 
89 
90  typedef typename RealImageType::Pointer RealImagePointer;
91 
93  typedef LewisGriffinRecursiveGaussianImageFilter < InputImageType,
94  RealImageType > DerivativeFilterTypeX;
95  typedef LewisGriffinRecursiveGaussianImageFilter < RealImageType,
96  RealImageType > DerivativeFilterTypeY;
97 
101 
105 
107  void SetDebug(bool b) { itk::Object::SetDebug(b); }
109  void DebugOn() { this->SetDebug(true); }
111  void DebugOff() { this->SetDebug(false); }
112 
114  void SetVerbose(bool b) { itk::Object::SetGlobalWarningDisplay(b); }
116  void VerboseOn() { this->SetVerbose(true); }
118  void VerboseOff() { this->SetVerbose(false); }
119 
121  void SetSigma( RealType sigma );
122 
128  virtual void GenerateInputRequestedRegion()
129  throw( InvalidRequestedRegionError );
130 
132  void SetNormalizeAcrossScale( bool normalizeInScaleSpace );
133  itkGetConstMacro( NormalizeAcrossScale, bool );
134 
136  itkSetMacro( Epsilon, InternalRealType );
138  itkGetMacro( Epsilon, InternalRealType );
139 
141  itkSetMacro( NumberOfOrientations, unsigned int );
143  itkGetMacro( NumberOfOrientations, unsigned int );
144 
146  void SetOrigin( OriginType o ) {
147  m_Origin = o;
148  m_FlagOriginSet = true;
149  this->Modified();
150  }
152  itkGetMacro( Origin, OriginType );
153 
155  void SetFlipHorizontally( void ) { flipHorizontally = -1.; this->Modified();}
157  void SetFlipVertically( void ) { flipVertically = -1.; this->Modified();}
158 
160  void SetLocalOrientation( RealImagePointer OrientationInX, RealImagePointer OrientationInY ) {
161  m_OrientationInX = OrientationInX;
162  m_OrientationInY = OrientationInY;
163 
164  m_FlagLocalOrientationSet = true;
165  m_FlagOriginSet = false;
166  this->Modified();
167  }
168 
170  itkSetObjectMacro( OrientationInY, RealImageType );
171 
173  itkSetObjectMacro( Mask, MaskImageType );
174 
175  itkGetObjectMacro( S11, RealImageType );
176  itkGetObjectMacro( S20, RealImageType );
177  itkGetObjectMacro( S02, RealImageType );
178 
179 
180  itkGetObjectMacro( Orientation, RealImageType );
181 
183  void WriteDerivativeToFile( int n, std::string filename );
184 
185 #ifdef ITK_USE_CONCEPT_CHECKING
186 
187  itkConceptMacro(DimensionShouldBe2,
188  (Concept::SameDimension<itkGetStaticConstMacro(InputImageDimension),2>));
189  itkConceptMacro(InputHasNumericTraitsCheck,
190  (Concept::HasNumericTraits<InputImagePixelType>));
191  itkConceptMacro(OutputHasPixelTraitsCheck,
192  (Concept::HasPixelTraits<OutputImagePixelType>));
194 #endif
195 
197  void SetSingleThreadedExecution(void) {m_FlagMultiThreadedExecution = false;}
198 
199 protected:
201  virtual ~LightLineResponseImageFilter();
202  void PrintSelf(std::ostream& os, Indent indent) const;
203 
206  {
208  };
209 
210  RealImagePointer GetDerivative( DerivativeFilterOrderEnumTypeX xOrder,
211  DerivativeFilterOrderEnumTypeY yOrder );
212 
223  virtual void BeforeThreadedGenerateData(void);
224 
235  virtual void AfterThreadedGenerateData(void);
236 
239  void GenerateData();
240 
251  void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread,
252  ThreadIdType threadId );
253 
254  // Override since the filter produces the entire dataset
255  void EnlargeOutputRequestedRegion(DataObject *output);
256 
259 
262 
267 
270 
272  InternalRealType m_Epsilon;
273 
275  InternalRealType m_Sigma;
276 
280  OriginType m_Origin;
281 
285  RealType flipVertically;
286 
287 
288  RealImagePointer m_OrientationInX;
289  RealImagePointer m_OrientationInY;
290 
292  MaskImagePointer m_Mask;
293  MaskFilterPointer m_MaskFilter;
294 
295  RealImagePointer m_S11;
296  RealImagePointer m_S20;
297  RealImagePointer m_S02;
298 
299  RealImagePointer m_Orientation;
300 
301 private:
302  LightLineResponseImageFilter(const Self&); //purposely not implemented
303  void operator=(const Self&); //purposely not implemented
304 };
305 
306 } // end namespace itk
307 
308 #ifndef ITK_MANUAL_INSTANTIATION
309 #include "itkLightLineResponseImageFilter.txx"
310 #endif
311 
312 #endif
RealImageType::Pointer RealImagePointer
Definition: itkLightLineResponseImageFilter.h:90
RealImagePointer m_OrientationInY
Set the local reference orientation image in 'y'.
Definition: itkLightLineResponseImageFilter.h:289
void SetVerbose(bool b)
Set the verbose output.
Definition: itkLightLineResponseImageFilter.h:114
void SetLocalOrientation(RealImagePointer OrientationInX, RealImagePointer OrientationInY)
Set the local reference orientation images.
Definition: itkLightLineResponseImageFilter.h:160
RealType flipHorizontally
Coefficient to flip the orientation horizontally.
Definition: itkLightLineResponseImageFilter.h:283
bool m_FlagLocalOrientationSet
Flag to calculate orientated BIFs using local orientation images.
Definition: itkLightLineResponseImageFilter.h:261
MaskImagePointer m_Mask
Optional mask image.
Definition: itkLightLineResponseImageFilter.h:292
SmartPointer< const Self > ConstPointer
Definition: itkLightLineResponseImageFilter.h:40
TInputImage InputImageType
Definition: itkLightLineResponseImageFilter.h:53
MaskFilterType::Pointer MaskFilterPointer
Definition: itkLightLineResponseImageFilter.h:79
RealImagePointer m_Orientation
Orientation of the structure.
Definition: itkLightLineResponseImageFilter.h:299
OutputImageType::Pointer OutputImagePointer
Definition: itkLightLineResponseImageFilter.h:65
void SetSingleThreadedExecution(void)
For debugging purposes, set single threaded execution.
Definition: itkLightLineResponseImageFilter.h:197
RealImagePointer m_OrientationInX
Set the local reference orientation image in 'x'.
Definition: itkLightLineResponseImageFilter.h:288
Orientation
Definition: itkMIDASHelper.h:35
void DebugOff()
Set debugging output off.
Definition: itkLightLineResponseImageFilter.h:111
InternalRealType m_Epsilon
Noise suppression parameter.
Definition: itkLightLineResponseImageFilter.h:272
Definition: niftkITKAffineResampleImage.cxx:74
ImageType::IndexType IndexType
Definition: niftkMakeLapUSProbeBasicModel.cxx:32
Definition: itkLightLineResponseImageFilter.h:205
OriginType m_Origin
The origin to use for oriented BIFs.
Definition: itkLightLineResponseImageFilter.h:280
MaskFilterPointer m_MaskFilter
Definition: itkLightLineResponseImageFilter.h:293
GLdouble GLdouble GLdouble b
Definition: glew.h:7885
RealImagePointer m_S02
Second derivative in 'yy'.
Definition: itkLightLineResponseImageFilter.h:297
InputImageType::PointType InputImagePointType
Definition: itkLightLineResponseImageFilter.h:59
Lewis Griffin's implementation of a recursive Gaussian filter which does not produce the oscillations...
Definition: itkLewisGriffinRecursiveGaussianImageFilter.h:30
InputImageType::RegionType InputImageRegionType
Definition: itkLightLineResponseImageFilter.h:56
MaskImageType::Pointer MaskImagePointer
Definition: itkLightLineResponseImageFilter.h:76
LewisGriffinRecursiveGaussianImageFilter< InputImageType, RealImageType > DerivativeFilterTypeX
Definition: itkLightLineResponseImageFilter.h:94
LightLineResponseImageFilter Self
Definition: itkLightLineResponseImageFilter.h:37
2D image filter class to compute the light line response of an image a specific scale.
Definition: itkLightLineResponseImageFilter.h:32
InputImageType::PixelType InputImagePixelType
Definition: itkLightLineResponseImageFilter.h:57
InternalRealType m_Sigma
Scale.
Definition: itkLightLineResponseImageFilter.h:275
bool m_FlagOriginSet
Flag indicating whether the orgin has been set.
Definition: itkLightLineResponseImageFilter.h:278
float PixelType
Definition: niftkBreastDCEandADC.cxx:88
DerivativeFilterTypeX::OrderEnumType DerivativeFilterOrderEnumTypeX
Definition: itkLightLineResponseImageFilter.h:99
ImageType::RegionType RegionType
Definition: niftkMakeLapUSProbeBasicModel.cxx:30
SmartPointer< Self > Pointer
Definition: itkLightLineResponseImageFilter.h:39
DerivativeFilterTypeY::OrderEnumType DerivativeFilterOrderEnumTypeY
Definition: itkLightLineResponseImageFilter.h:100
TOutputImage OutputImageType
Definition: itkLightLineResponseImageFilter.h:64
float InternalRealType
Definition: itkLightLineResponseImageFilter.h:86
itk::Image< MaskPixelType, ImageDimension > MaskImageType
Definition: itkLightLineResponseImageFilter.h:75
DerivativeFilterTypeX::Pointer DerivativeFilterPointerX
Definition: itkLightLineResponseImageFilter.h:103
RealType flipVertically
Coefficient to flip the orientation vertically.
Definition: itkLightLineResponseImageFilter.h:285
InputImageType::SpacingType InputImageSpacingType
Definition: itkLightLineResponseImageFilter.h:58
void VerboseOff()
Set verbose output off.
Definition: itkLightLineResponseImageFilter.h:118
Image< InternalRealType, TInputImage::ImageDimension > RealImageType
Definition: itkLightLineResponseImageFilter.h:88
LewisGriffinRecursiveGaussianImageFilter< RealImageType, RealImageType > DerivativeFilterTypeY
Definition: itkLightLineResponseImageFilter.h:96
bool m_NormalizeAcrossScale
Definition: itkLightLineResponseImageFilter.h:269
void VerboseOn()
Set verbose output on.
Definition: itkLightLineResponseImageFilter.h:116
Simultaneous itk::Image and itk::Array (and hence vnl_vector) class.
InputImageType::Pointer InputImagePointer
Definition: itkLightLineResponseImageFilter.h:54
OutputImageType::PixelType OutputImagePixelType
Definition: itkLightLineResponseImageFilter.h:67
GLclampd n
Definition: glew.h:6789
RealImagePointer m_S20
Second derivative in 'xx'.
Definition: itkLightLineResponseImageFilter.h:296
void SetDebug(bool b)
Set the debugging output.
Definition: itkLightLineResponseImageFilter.h:107
OutputImageType::RegionType OutputImageRegionType
Definition: itkLightLineResponseImageFilter.h:66
void DebugOn()
Set debugging output on.
Definition: itkLightLineResponseImageFilter.h:109
OutputImagePointType OriginType
Definition: itkLightLineResponseImageFilter.h:71
unsigned char MaskPixelType
Definition: itkLightLineResponseImageFilter.h:74
LightLineResponseImageFilter * Filter
Definition: itkLightLineResponseImageFilter.h:207
SmartPointer< Self > Pointer
Definition: itkLewisGriffinRecursiveGaussianImageFilter.h:37
DerivativeFilterTypeY::Pointer DerivativeFilterPointerY
Definition: itkLightLineResponseImageFilter.h:104
void SetFlipVertically(void)
Set the coefficient to flip the orientation vertically.
Definition: itkLightLineResponseImageFilter.h:157
unsigned int m_NumberOfOrientations
Definition: itkLightLineResponseImageFilter.h:266
void SetFlipHorizontally(void)
Set the coefficient to flip the orientation horizontally.
Definition: itkLightLineResponseImageFilter.h:155
bool m_FlagMultiThreadedExecution
Flag to turn multithreading on or off.
Definition: itkLightLineResponseImageFilter.h:258
OrderEnumType
Definition: itkLewisGriffinRecursiveGaussianImageFilter.h:99
GLsizei const GLcharARB ** string
Definition: glew.h:5194
RealImagePointer m_S11
Second derivative in 'xy'.
Definition: itkLightLineResponseImageFilter.h:295
OutputImageType::PointType OutputImagePointType
Definition: itkLightLineResponseImageFilter.h:69
InputImageType::ConstPointer InputImageConstPointer
Definition: itkLightLineResponseImageFilter.h:55
NumericTraits< InputImagePixelType >::RealType RealType
Definition: itkLightLineResponseImageFilter.h:61
itk::MaskImageFilter< OutputImageType, MaskImageType, OutputImageType > MaskFilterType
Definition: itkLightLineResponseImageFilter.h:78
ImageToImageFilter< TInputImage, TOutputImage > Superclass
Definition: itkLightLineResponseImageFilter.h:38
OutputImageType::IndexType OutputImageIndexType
Definition: itkLightLineResponseImageFilter.h:68