ITK
4.0.0
Insight Segmentation and Registration Toolkit
|
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 __itkDirectedHausdorffDistanceImageFilter_h 00019 #define __itkDirectedHausdorffDistanceImageFilter_h 00020 00021 #include "itkImageToImageFilter.h" 00022 #include "itkNumericTraits.h" 00023 #include "itkArray.h" 00024 00025 namespace itk 00026 { 00062 template< class TInputImage1, class TInputImage2 > 00063 class ITK_EXPORT DirectedHausdorffDistanceImageFilter: 00064 public ImageToImageFilter< TInputImage1, TInputImage1 > 00065 { 00066 public: 00068 typedef DirectedHausdorffDistanceImageFilter Self; 00069 typedef ImageToImageFilter< TInputImage1, TInputImage1 > Superclass; 00070 typedef SmartPointer< Self > Pointer; 00071 typedef SmartPointer< const Self > ConstPointer; 00072 00074 itkNewMacro(Self); 00075 00077 itkTypeMacro(DirectedHausdorffDistanceImageFilter, ImageToImageFilter); 00078 00080 typedef TInputImage1 InputImage1Type; 00081 typedef TInputImage2 InputImage2Type; 00082 typedef typename TInputImage1::Pointer InputImage1Pointer; 00083 typedef typename TInputImage2::Pointer InputImage2Pointer; 00084 typedef typename TInputImage1::ConstPointer InputImage1ConstPointer; 00085 typedef typename TInputImage2::ConstPointer InputImage2ConstPointer; 00086 00087 typedef typename TInputImage1::RegionType RegionType; 00088 typedef typename TInputImage1::SizeType SizeType; 00089 typedef typename TInputImage1::IndexType IndexType; 00090 00091 typedef typename TInputImage1::PixelType InputImage1PixelType; 00092 typedef typename TInputImage2::PixelType InputImage2PixelType; 00093 00095 itkStaticConstMacro(ImageDimension, unsigned int, 00096 TInputImage1::ImageDimension); 00097 00099 typedef typename NumericTraits< InputImage1PixelType >::RealType RealType; 00100 00102 void SetInput1(const InputImage1Type *image); 00103 00105 void SetInput2(const InputImage2Type *image); 00106 00108 const InputImage1Type * GetInput1(void); 00109 00111 const InputImage2Type * GetInput2(void); 00112 00114 itkSetMacro(UseImageSpacing, bool); 00115 00117 itkGetConstMacro(DirectedHausdorffDistance, RealType); 00118 itkGetConstMacro(AverageHausdorffDistance, RealType); 00120 00121 #ifdef ITK_USE_CONCEPT_CHECKING 00122 00123 itkConceptMacro( InputHasNumericTraitsCheck, 00124 ( Concept::HasNumericTraits< InputImage1PixelType > ) ); 00125 00127 #endif 00128 protected: 00129 DirectedHausdorffDistanceImageFilter(); 00130 ~DirectedHausdorffDistanceImageFilter(){} 00131 void PrintSelf(std::ostream & os, Indent indent) const; 00133 00136 void AllocateOutputs(); 00137 00139 void BeforeThreadedGenerateData(); 00140 00143 void AfterThreadedGenerateData(); 00144 00146 void ThreadedGenerateData(const RegionType & 00147 outputRegionForThread, 00148 ThreadIdType threadId); 00149 00150 // Override since the filter needs all the data for the algorithm 00151 void GenerateInputRequestedRegion(); 00152 00153 // Override since the filter produces all of its output 00154 void EnlargeOutputRequestedRegion(DataObject *data); 00155 00156 private: 00157 DirectedHausdorffDistanceImageFilter(const Self &); //purposely not 00158 // implemented 00159 void operator=(const Self &); //purposely not 00160 00161 // implemented 00162 00163 typedef Image< RealType, itkGetStaticConstMacro(ImageDimension) > DistanceMapType; 00164 typedef typename DistanceMapType::Pointer DistanceMapPointer; 00165 00166 DistanceMapPointer m_DistanceMap; 00167 00168 Array< RealType > m_MaxDistance; 00169 Array< IdentifierType > m_PixelCount; 00170 Array< RealType > m_Sum; 00171 RealType m_DirectedHausdorffDistance; 00172 RealType m_AverageHausdorffDistance; 00173 bool m_UseImageSpacing; 00174 }; // end of class 00175 } // end namespace itk 00176 00177 #ifndef ITK_MANUAL_INSTANTIATION 00178 #include "itkDirectedHausdorffDistanceImageFilter.hxx" 00179 #endif 00180 00181 #endif 00182