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