00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
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 #ifdef ITK_USE_CONCEPT_CHECKING
00114
00115 itkConceptMacro(Input1HasNumericTraitsCheck,
00116 (Concept::HasNumericTraits<InputImage1PixelType>));
00117 itkConceptMacro(Input2HasNumericTraitsCheck,
00118 (Concept::HasNumericTraits<InputImage2PixelType>));
00119
00121 #endif
00122
00123 protected:
00124 SimilarityIndexImageFilter();
00125 ~SimilarityIndexImageFilter(){};
00126 void PrintSelf(std::ostream& os, Indent indent) const;
00127
00130 void AllocateOutputs();
00131
00133 void BeforeThreadedGenerateData ();
00134
00136 void AfterThreadedGenerateData ();
00137
00139 void ThreadedGenerateData (const RegionType&
00140 outputRegionForThread,
00141 int threadId);
00142
00143
00144 void GenerateInputRequestedRegion();
00145
00146
00147 void EnlargeOutputRequestedRegion(DataObject *data);
00148
00149 private:
00150 SimilarityIndexImageFilter(const Self&);
00151 void operator=(const Self&);
00152
00153 RealType m_SimilarityIndex;
00154
00155 Array<unsigned long> m_CountOfImage1;
00156 Array<unsigned long> m_CountOfImage2;
00157 Array<unsigned long> m_CountOfIntersection;
00158
00159 };
00160
00161 }
00162
00163 #ifndef ITK_MANUAL_INSTANTIATION
00164 #include "itkSimilarityIndexImageFilter.txx"
00165 #endif
00166
00167 #endif
00168