ITK
4.1.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 __itkFastChamferDistanceImageFilter_h 00019 #define __itkFastChamferDistanceImageFilter_h 00020 00021 #include "itkImageToImageFilter.h" 00022 #include "itkImageRegionIteratorWithIndex.h" 00023 #include "itkNarrowBand.h" 00024 00025 namespace itk 00026 { 00054 template< class TInputImage, class TOutputImage > 00055 class ITK_EXPORT FastChamferDistanceImageFilter: 00056 public ImageToImageFilter< TInputImage, TOutputImage > 00057 { 00058 public: 00060 typedef FastChamferDistanceImageFilter Self; 00061 typedef ImageToImageFilter< TInputImage, TOutputImage > Superclass; 00062 typedef SmartPointer< Self > Pointer; 00063 typedef SmartPointer< const Self > ConstPointer; 00064 00066 itkNewMacro(Self); 00067 00069 itkTypeMacro(FastChamferDistanceImageFilter, ImageToImageFilter); 00070 00072 typedef TInputImage InputImageType; 00073 00075 typedef TOutputImage OutputImageType; 00076 00078 typedef typename InputImageType::RegionType RegionType; 00079 00081 typedef typename InputImageType::PixelType PixelType; 00082 00084 typedef typename RegionType::IndexType IndexType; 00085 00087 typedef typename InputImageType::OffsetType OffsetType; 00088 00090 typedef typename RegionType::SizeType SizeType; 00091 00093 itkStaticConstMacro(ImageDimension, unsigned int, 00094 InputImageType::ImageDimension); 00095 itkStaticConstMacro(OutputImageDimension, unsigned int, 00096 OutputImageType::ImageDimension); 00098 00100 typedef typename InputImageType::ConstPointer InputImagePointer; 00101 00103 typedef BandNode< IndexType, PixelType > BandNodeType; 00104 typedef NarrowBand< BandNodeType > NarrowBandType; 00105 typedef typename NarrowBandType::Pointer NarrowBandPointer; 00106 00107 typedef FixedArray< float, ImageDimension > WeightsType; 00108 00110 itkSetMacro(Weights, WeightsType); 00111 itkGetConstReferenceMacro(Weights, WeightsType); 00113 00115 itkSetMacro(MaximumDistance, float); 00116 itkGetConstMacro(MaximumDistance, float); 00118 00120 void SetRegionToProcess(const RegionType & r); 00121 00122 RegionType GetRegionToProcess() const; 00123 00124 void SetNarrowBand(NarrowBandType *ptr); 00125 00126 NarrowBandPointer GetNarrowBand() const; 00127 00128 #ifdef ITK_USE_CONCEPT_CHECKING 00129 00130 itkConceptMacro( SameDimensionCheck, 00131 ( Concept::SameDimension< ImageDimension, OutputImageDimension > ) ); 00132 itkConceptMacro( SameTypeCheck, 00133 ( Concept::SameType< PixelType, typename TOutputImage::PixelType > ) ); 00134 itkConceptMacro( FloatConvertibleToPixelTypeCheck, 00135 ( Concept::Convertible< float, PixelType > ) ); 00136 itkConceptMacro( PixelTypeConvertibleToFloatCheck, 00137 ( Concept::Convertible< PixelType, float > ) ); 00138 itkConceptMacro( PixelTypeGreaterThanFloatCheck, 00139 ( Concept::GreaterThanComparable< PixelType, float > ) ); 00140 itkConceptMacro( PixelTypeLessThanFloatCheck, 00141 ( Concept::LessThanComparable< PixelType, float > ) ); 00142 itkConceptMacro( PixelTypeFloatAdditiveOperatorsCheck, 00143 ( Concept::AdditiveOperators< PixelType, float, float > ) ); 00144 itkConceptMacro( FloatGreaterThanPixelTypeCheck, 00145 ( Concept::GreaterThanComparable< float, PixelType > ) ); 00146 itkConceptMacro( FloatLessThanPixelTypeCheck, 00147 ( Concept::LessThanComparable< float, PixelType > ) ); 00148 00150 #endif 00151 protected: 00152 FastChamferDistanceImageFilter(); 00153 virtual ~FastChamferDistanceImageFilter() {} 00154 void PrintSelf(std::ostream & os, Indent indent) const; 00156 00159 void GenerateDataND(); 00160 00163 void GenerateData(); 00164 00165 private: 00166 FastChamferDistanceImageFilter(const Self &); //purposely not implemented 00167 void operator=(const Self &); //purposely not implemented 00168 00169 float m_MaximumDistance; 00170 00172 WeightsType m_Weights; 00173 00174 NarrowBandPointer m_NarrowBand; 00175 00177 RegionType m_RegionToProcess; 00178 }; // end of FastChamferDistanceImageFilter class 00179 } //end namespace itk 00180 00181 #ifndef ITK_MANUAL_INSTANTIATION 00182 #include "itkFastChamferDistanceImageFilter.hxx" 00183 #endif 00184 00185 #endif 00186