ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkMultiScaleHessianBasedMeasureImageFilter.h
Go to the documentation of this file.
00001 /*=========================================================================
00002  *
00003  *  Copyright Insight Software Consortium
00004  *
00005  *  Licensed under the Apache License, Version 2.0 (the "License");
00006  *  you may not use this file except in compliance with the License.
00007  *  You may obtain a copy of the License at
00008  *
00009  *         http://www.apache.org/licenses/LICENSE-2.0.txt
00010  *
00011  *  Unless required by applicable law or agreed to in writing, software
00012  *  distributed under the License is distributed on an "AS IS" BASIS,
00013  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  *  See the License for the specific language governing permissions and
00015  *  limitations under the License.
00016  *
00017  *=========================================================================*/
00018 #ifndef __itkMultiScaleHessianBasedMeasureImageFilter_h
00019 #define __itkMultiScaleHessianBasedMeasureImageFilter_h
00020 
00021 #include "itkImageToImageFilter.h"
00022 #include "itkHessianRecursiveGaussianImageFilter.h"
00023 
00024 namespace itk
00025 {
00064 template< typename TInputImage,
00065           typename THessianImage,
00066           typename TOutputImage = TInputImage >
00067 class ITK_EXPORT MultiScaleHessianBasedMeasureImageFilter:
00068   public
00069   ImageToImageFilter< TInputImage, TOutputImage >
00070 {
00071 public:
00073   typedef MultiScaleHessianBasedMeasureImageFilter        Self;
00074   typedef ImageToImageFilter< TInputImage, TOutputImage > Superclass;
00075 
00076   typedef SmartPointer< Self >       Pointer;
00077   typedef SmartPointer< const Self > ConstPointer;
00078 
00079   typedef TInputImage   InputImageType;
00080   typedef TOutputImage  OutputImageType;
00081   typedef THessianImage HessianImageType;
00082 
00083   typedef ImageToImageFilter< HessianImageType, OutputImageType  > HessianToMeasureFilterType;
00084 
00085   typedef typename TInputImage::PixelType   InputPixelType;
00086   typedef typename TOutputImage::PixelType  OutputPixelType;
00087   typedef typename TOutputImage::RegionType OutputRegionType;
00088 
00090   itkStaticConstMacro(ImageDimension, unsigned int, ::itk::GetImageDimension< InputImageType >::ImageDimension);
00091 
00093   typedef float                                                            ScalesPixelType;
00094   typedef Image< ScalesPixelType, itkGetStaticConstMacro(ImageDimension) > ScalesImageType;
00095 
00097   typedef HessianRecursiveGaussianImageFilter< InputImageType, HessianImageType > HessianFilterType;
00098 
00102   typedef Image< double, itkGetStaticConstMacro(ImageDimension) > UpdateBufferType;
00103   typedef typename UpdateBufferType::ValueType                    BufferValueType;
00104 
00105   typedef typename Superclass::DataObjectPointer DataObjectPointer;
00106 
00108   itkNewMacro(Self);
00109 
00111   itkTypeMacro(MultiScaleHessianBasedMeasureImageFilter,
00112                ImageToImageFilter);
00113 
00115   itkSetMacro(SigmaMinimum, double);
00116   itkGetConstMacro(SigmaMinimum, double);
00118 
00120   itkSetMacro(SigmaMaximum, double);
00121   itkGetConstMacro(SigmaMaximum, double);
00123 
00125   itkSetMacro(NumberOfSigmaSteps, unsigned int);
00126   itkGetConstMacro(NumberOfSigmaSteps, unsigned int);
00128 
00132   itkSetObjectMacro(HessianToMeasureFilter, HessianToMeasureFilterType);
00133   itkGetObjectMacro(HessianToMeasureFilter, HessianToMeasureFilterType);
00135 
00142   itkSetMacro(NonNegativeHessianBasedMeasure, bool);
00143   itkGetConstMacro(NonNegativeHessianBasedMeasure, bool);
00144   itkBooleanMacro(NonNegativeHessianBasedMeasure);
00146 
00147   typedef enum { EquispacedSigmaSteps = 0,
00148                  LogarithmicSigmaSteps = 1 } SigmaStepMethodType;
00149 
00152   itkSetMacro(SigmaStepMethod, SigmaStepMethodType);
00153   itkGetConstMacro(SigmaStepMethod, SigmaStepMethodType);
00155 
00157   void SetSigmaStepMethodToEquispaced();
00158 
00160   void SetSigmaStepMethodToLogarithmic();
00161 
00164   const HessianImageType * GetHessianOutput() const;
00165 
00168   const ScalesImageType * GetScalesOutput() const;
00169 
00170   void EnlargeOutputRequestedRegion(DataObject *);
00171 
00174   itkSetMacro(GenerateScalesOutput, bool);
00175   itkGetConstMacro(GenerateScalesOutput, bool);
00176   itkBooleanMacro(GenerateScalesOutput);
00178 
00181   itkSetMacro(GenerateHessianOutput, bool);
00182   itkGetConstMacro(GenerateHessianOutput, bool);
00183   itkBooleanMacro(GenerateHessianOutput);
00185 
00187   typedef ProcessObject::DataObjectPointerArraySizeType DataObjectPointerArraySizeType;
00188   using Superclass::MakeOutput;
00189   virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx);
00190 
00191 protected:
00192   MultiScaleHessianBasedMeasureImageFilter();
00193   ~MultiScaleHessianBasedMeasureImageFilter() {}
00194   void PrintSelf(std::ostream & os, Indent indent) const;
00195 
00197   void GenerateData(void);
00198 
00199 private:
00200   void UpdateMaximumResponse(double sigma);
00201 
00202   double ComputeSigmaValue(int scaleLevel);
00203 
00204   void AllocateUpdateBuffer();
00205 
00206   //purposely not implemented
00207   MultiScaleHessianBasedMeasureImageFilter(const Self &);
00208   void operator=(const Self &); //purposely not implemented
00209 
00210   bool m_NonNegativeHessianBasedMeasure;
00211 
00212   double m_SigmaMinimum;
00213   double m_SigmaMaximum;
00214 
00215   unsigned int        m_NumberOfSigmaSteps;
00216   SigmaStepMethodType m_SigmaStepMethod;
00217 
00218   typename HessianToMeasureFilterType::Pointer m_HessianToMeasureFilter;
00219 
00220   typename HessianFilterType::Pointer m_HessianFilter;
00221 
00222   typename UpdateBufferType::Pointer m_UpdateBuffer;
00223 
00224   bool m_GenerateScalesOutput;
00225   bool m_GenerateHessianOutput;
00226 };
00227 } // end namespace itk
00228 
00229 #ifndef ITK_MANUAL_INSTANTIATION
00230 #include "itkMultiScaleHessianBasedMeasureImageFilter.hxx"
00231 #endif
00232 
00233 #endif
00234