ITK  4.0.0
Insight Segmentation and Registration Toolkit
itkHausdorffDistanceImageFilter.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 __itkHausdorffDistanceImageFilter_h
00019 #define __itkHausdorffDistanceImageFilter_h
00020 
00021 #include "itkImageToImageFilter.h"
00022 #include "itkNumericTraits.h"
00023 
00024 namespace itk
00025 {
00061 template< class TInputImage1, class TInputImage2 >
00062 class ITK_EXPORT HausdorffDistanceImageFilter:
00063   public ImageToImageFilter< TInputImage1, TInputImage1 >
00064 {
00065 public:
00067   typedef HausdorffDistanceImageFilter                     Self;
00068   typedef ImageToImageFilter< TInputImage1, TInputImage1 > Superclass;
00069   typedef SmartPointer< Self >                             Pointer;
00070   typedef SmartPointer< const Self >                       ConstPointer;
00071 
00073   itkNewMacro(Self);
00074 
00076   itkTypeMacro(HausdorffDistanceImageFilter, ImageToImageFilter);
00077 
00079   typedef TInputImage1                        InputImage1Type;
00080   typedef TInputImage2                        InputImage2Type;
00081   typedef typename TInputImage1::Pointer      InputImage1Pointer;
00082   typedef typename TInputImage2::Pointer      InputImage2Pointer;
00083   typedef typename TInputImage1::ConstPointer InputImage1ConstPointer;
00084   typedef typename TInputImage2::ConstPointer InputImage2ConstPointer;
00085 
00086   typedef typename TInputImage1::RegionType RegionType;
00087   typedef typename TInputImage1::SizeType   SizeType;
00088   typedef typename TInputImage1::IndexType  IndexType;
00089 
00090   typedef typename TInputImage1::PixelType InputImage1PixelType;
00091   typedef typename TInputImage2::PixelType InputImage2PixelType;
00092 
00094   itkStaticConstMacro(ImageDimension, unsigned int,
00095                       TInputImage1::ImageDimension);
00096 
00098   typedef typename NumericTraits< InputImage1PixelType >::RealType RealType;
00099 
00101   void SetInput1(const InputImage1Type *image);
00102 
00104   void SetInput2(const InputImage2Type *image);
00105 
00107   const InputImage1Type * GetInput1(void);
00108 
00110   const InputImage2Type * GetInput2(void);
00111 
00113   itkSetMacro(UseImageSpacing, bool);
00114 
00116   itkGetConstMacro(HausdorffDistance, RealType);
00117   itkGetConstMacro(AverageHausdorffDistance, RealType);
00119 
00120 #ifdef ITK_USE_CONCEPT_CHECKING
00121 
00122   itkConceptMacro( Input1HasNumericTraitsCheck,
00123                    ( Concept::HasNumericTraits< InputImage1PixelType > ) );
00124 
00126 #endif
00127 protected:
00128   HausdorffDistanceImageFilter();
00129   ~HausdorffDistanceImageFilter(){}
00130   void PrintSelf(std::ostream & os, Indent indent) const;
00132 
00134   void  GenerateData();
00135 
00136   // Override since the filter needs all the data for the algorithm
00137   void GenerateInputRequestedRegion();
00138 
00139   // Override since the filter produces all of its output
00140   void EnlargeOutputRequestedRegion(DataObject *data);
00141 
00142 private:
00143   HausdorffDistanceImageFilter(const Self &); //purposely not implemented
00144   void operator=(const Self &);               //purposely not implemented
00145 
00146   RealType m_HausdorffDistance;
00147   RealType m_AverageHausdorffDistance;
00148   bool     m_UseImageSpacing;
00149 }; // end of class
00150 } // end namespace itk
00151 
00152 #ifndef ITK_MANUAL_INSTANTIATION
00153 #include "itkHausdorffDistanceImageFilter.hxx"
00154 #endif
00155 
00156 #endif
00157