ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkNormalizedCorrelationImageFilter.h
Go to the documentation of this file.
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 __itkNormalizedCorrelationImageFilter_h
00019 #define __itkNormalizedCorrelationImageFilter_h
00020 
00021 #include "itkNeighborhoodOperatorImageFilter.h"
00022 
00023 namespace itk
00024 {
00049 template< class TInputImage, class TMaskImage, class TOutputImage, class TOperatorValueType =
00050             typename TOutputImage::PixelType >
00051 class ITK_EXPORT NormalizedCorrelationImageFilter:
00052   public NeighborhoodOperatorImageFilter< TInputImage, TOutputImage, TOperatorValueType >
00053 {
00054 public:
00056   typedef NormalizedCorrelationImageFilter Self;
00057   typedef NeighborhoodOperatorImageFilter<
00058     TInputImage, TOutputImage, TOperatorValueType > Superclass;
00059 
00060   typedef SmartPointer< Self >       Pointer;
00061   typedef SmartPointer< const Self > ConstPointer;
00062 
00064   itkNewMacro(Self);
00065 
00067   itkTypeMacro(NormalizedCorrelationImageFilter, NeighborhoodOperatorImageFilter);
00068 
00071   typedef typename TOutputImage::PixelType         OutputPixelType;
00072   typedef typename TOutputImage::InternalPixelType OutputInternalPixelType;
00073   typedef typename  TInputImage::PixelType         InputPixelType;
00074   typedef typename  TInputImage::InternalPixelType InputInternalPixelType;
00075   typedef typename   TMaskImage::PixelType         MaskPixelType;
00076   typedef typename   TMaskImage::InternalPixelType MaskInternalPixelType;
00077 
00080   itkStaticConstMacro(InputImageDimension, unsigned int,
00081                       TInputImage::ImageDimension);
00082   itkStaticConstMacro(ImageDimension, unsigned int,
00083                       TOutputImage::ImageDimension);
00084   itkStaticConstMacro(MaskImageDimension, unsigned int,
00085                       TMaskImage::ImageDimension);
00087 
00089   typedef TInputImage                      InputImageType;
00090   typedef TMaskImage                       MaskImageType;
00091   typedef TOutputImage                     OutputImageType;
00092   typedef typename InputImageType::Pointer InputImagePointer;
00093   typedef typename MaskImageType::Pointer  MaskImagePointer;
00094 
00096   typedef ImageBoundaryCondition< OutputImageType > *ImageBoundaryConditionPointerType;
00097 
00099   typedef typename Superclass::OutputImageRegionType OutputImageRegionType;
00100   typedef typename Superclass::OperatorValueType     OperatorValueType;
00101 
00103   typedef typename Superclass::OutputNeighborhoodType OutputNeighborhoodType;
00104 
00108   void SetMaskImage(const TMaskImage *mask);
00109 
00113   const TMaskImage * GetMaskImage() const;
00114 
00118   void SetTemplate(const OutputNeighborhoodType & t)
00119   {
00120     this->SetOperator(t);
00121   }
00122 
00123 #ifdef ITK_USE_CONCEPT_CHECKING
00124 
00125   itkConceptMacro( SameDimensionCheck,
00126                    ( Concept::SameDimension< InputImageDimension, MaskImageDimension > ) );
00127   itkConceptMacro( OutputHasNumericTraitsCheck,
00128                    ( Concept::HasNumericTraits< OutputPixelType > ) );
00129   itkConceptMacro( OperatorHasNumericTraitsCheck,
00130                    ( Concept::HasNumericTraits< OperatorValueType > ) );
00131   // This filter can only operate on data types that are signed.
00132   itkConceptMacro( SignedOutputPixelType,
00133                    ( Concept::Signed< OutputPixelType > ) );
00134 
00136 #endif
00137 protected:
00138   NormalizedCorrelationImageFilter() {}
00139   virtual ~NormalizedCorrelationImageFilter() {}
00141 
00147   void GenerateInputRequestedRegion()
00148   throw ( InvalidRequestedRegionError );
00149 
00161   void ThreadedGenerateData(const OutputImageRegionType & outputRegionForThread,
00162                             ThreadIdType threadId);
00163 
00165   void PrintSelf(std::ostream & os, Indent indent) const
00166   {  Superclass::PrintSelf(os, indent); }
00167 private:
00168   NormalizedCorrelationImageFilter(const Self &); //purposely not implemented
00169   void operator=(const Self &);                   //purposely not implemented
00170 };
00171 } // end namespace itk
00173 
00174 #ifndef ITK_MANUAL_INSTANTIATION
00175 #include "itkNormalizedCorrelationImageFilter.hxx"
00176 #endif
00177 
00178 #endif
00179