00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkSimilarityIndexImageFilter.h,v $ 00005 Language: C++ 00006 Date: $Date: 2003/09/10 14:28:56 $ 00007 Version: $Revision: 1.7 $ 00008 00009 Copyright (c) Insight Software Consortium. All rights reserved. 00010 See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details. 00011 00012 This software is distributed WITHOUT ANY WARRANTY; without even 00013 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00014 PURPOSE. See the above copyright notices for more information. 00015 00016 =========================================================================*/ 00017 #ifndef __itkSimilarityIndexImageFilter_h 00018 #define __itkSimilarityIndexImageFilter_h 00019 00020 #include "itkImageToImageFilter.h" 00021 #include "itkNumericTraits.h" 00022 #include "itkArray.h" 00023 00024 namespace itk { 00025 00057 template<class TInputImage1, class TInputImage2> 00058 class ITK_EXPORT SimilarityIndexImageFilter : 00059 public ImageToImageFilter<TInputImage1, TInputImage1> 00060 { 00061 public: 00063 typedef SimilarityIndexImageFilter Self; 00064 typedef ImageToImageFilter<TInputImage1,TInputImage1> Superclass; 00065 typedef SmartPointer<Self> Pointer; 00066 typedef SmartPointer<const Self> ConstPointer; 00067 00069 itkNewMacro(Self); 00070 00072 itkTypeMacro(SimilarityIndexImageFilter, ImageToImageFilter); 00073 00075 typedef TInputImage1 InputImage1Type; 00076 typedef TInputImage2 InputImage2Type; 00077 typedef typename TInputImage1::Pointer InputImage1Pointer; 00078 typedef typename TInputImage2::Pointer InputImage2Pointer; 00079 typedef typename TInputImage1::ConstPointer InputImage1ConstPointer; 00080 typedef typename TInputImage2::ConstPointer InputImage2ConstPointer; 00081 00082 typedef typename TInputImage1::RegionType RegionType ; 00083 typedef typename TInputImage1::SizeType SizeType ; 00084 typedef typename TInputImage1::IndexType IndexType ; 00085 00086 typedef typename TInputImage1::PixelType InputImage1PixelType; 00087 typedef typename TInputImage2::PixelType InputImage2PixelType; 00088 00090 itkStaticConstMacro(ImageDimension, unsigned int, 00091 TInputImage1::ImageDimension ); 00092 00094 typedef typename NumericTraits<InputImage1PixelType>::RealType RealType; 00095 00097 void SetInput1( const InputImage1Type * image ) 00098 { this->SetInput( image ); } 00099 00101 void SetInput2( const InputImage2Type * image ); 00102 00104 const InputImage1Type * GetInput1(void) 00105 { return this->GetInput(); } 00106 00108 const InputImage2Type * GetInput2(void); 00109 00111 itkGetMacro(SimilarityIndex,RealType); 00112 00113 protected: 00114 SimilarityIndexImageFilter(); 00115 ~SimilarityIndexImageFilter(){}; 00116 void PrintSelf(std::ostream& os, Indent indent) const; 00117 00119 void AllocateOutputs(); 00120 00122 void BeforeThreadedGenerateData (); 00123 00125 void AfterThreadedGenerateData (); 00126 00128 void ThreadedGenerateData (const RegionType& 00129 outputRegionForThread, 00130 int threadId) ; 00131 00132 // Override since the filter needs all the data for the algorithm 00133 void GenerateInputRequestedRegion(); 00134 00135 // Override since the filter produces all of its output 00136 void EnlargeOutputRequestedRegion(DataObject *data); 00137 00138 private: 00139 SimilarityIndexImageFilter(const Self&); //purposely not implemented 00140 void operator=(const Self&); //purposely not implemented 00141 00142 RealType m_SimilarityIndex; 00143 00144 Array<unsigned long> m_CountOfImage1; 00145 Array<unsigned long> m_CountOfImage2; 00146 Array<unsigned long> m_CountOfIntersection; 00147 00148 } ; // end of class 00149 00150 } // end namespace itk 00151 00152 #ifndef ITK_MANUAL_INSTANTIATION 00153 #include "itkSimilarityIndexImageFilter.txx" 00154 #endif 00155 00156 #endif