freSpatialRegionOfInterestImageFilter.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   F.R.E.E. - flexible registration evaluation engine
00004   Version:   v.1.0.0
00005   Date:      $Date: 2006/09/01 12:00:00 $
00006   Module:    $RCSfile: freSpatialRegionOfInterestImageFilter.h,v $
00007   Language:  C++
00008 
00009 
00010 
00011   Copyright (c) 2007 Ralf o Floca (Department of Medical Informatics,
00012   Institute for Medical Biometry and Informatics, University of Heidelberg,
00013   Germany). All rights reserved.
00014   See FREECopyright.txt or http://www.mi.med.uni-hd.de/free/copyright.htm
00015   for details.
00016 
00017      This software is distributed WITHOUT ANY WARRANTY; without even 
00018      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00019      PURPOSE.  See the above copyright notices for more information.
00020 
00021 =========================================================================*/
00022 #ifndef __freSpatialRegionOfInterestImageFilter_h
00023 #define __freSpatialRegionOfInterestImageFilter_h
00024 
00025 #include "itkImageToImageFilter.h"
00026 #include "itkSmartPointer.h"
00027 #include "itkSpatialObject.h"
00028 
00029 namespace FREE
00030 {
00031 
00049 template <class TInputImage, class TOutputImage>
00050 class ITK_EXPORT SpatialRegionOfInterestImageFilter:
00051   public itk::ImageToImageFilter<TInputImage,TOutputImage>
00052 {
00053 public:
00055   typedef SpatialRegionOfInterestImageFilter         Self;
00056   typedef itk::ImageToImageFilter< TInputImage, TOutputImage>  Superclass;
00057   typedef itk::SmartPointer<Self>  Pointer;
00058   typedef itk::SmartPointer<const Self>  ConstPointer;
00059   typedef typename Superclass::InputImageRegionType InputImageRegionType;
00060 
00062   itkNewMacro(Self);  
00063 
00065   itkTypeMacro(SpatialRegionOfInterestImageFilter, ImageToImageFilter);
00066 
00068   typedef typename TInputImage::RegionType   RegionType;
00069   typedef typename TInputImage::IndexType    IndexType;
00070   typedef typename TInputImage::SizeType     SizeType;
00071   typedef typename TInputImage::PointType    PointType;
00072 
00074   typedef typename TOutputImage::PixelType OutputImagePixelType;
00075   typedef typename TInputImage::PixelType  InputImagePixelType;
00076 
00078   typedef itk::SpatialObject< TInputImage::ImageDimension >  SpatialObjectType;
00079   typedef typename SpatialObjectType::Pointer  SpatialObjectPointer;
00080 
00082   virtual void SetSpatialRegionOfInterest(SpatialObjectType* pROI);
00083   virtual SpatialObjectType* GetSpatialRegionOfInterest();
00084 
00085   itkSetMacro(OutsideValue, OutputImagePixelType);
00086   itkGetMacro(OutsideValue, OutputImagePixelType);
00087 
00088   itkSetMacro(CropByInput, bool);
00089   itkGetMacro(CropByInput, bool);
00090 
00092   itkStaticConstMacro(ImageDimension, unsigned int,
00093                       TInputImage::ImageDimension);
00094   itkStaticConstMacro(OutputImageDimension, unsigned int,
00095                       TOutputImage::ImageDimension);
00096 
00097 #ifdef ITK_USE_CONCEPT_CHECKING
00098 
00099   itkConceptMacro(SameDimensionCheck,
00100     (Concept::SameDimension<ImageDimension, OutputImageDimension>));
00101   itkConceptMacro(InputConvertibleToOutputCheck,
00102     (Concept::Convertible<InputImagePixelType, OutputImagePixelType>));
00104 #endif
00105 
00106 protected:
00107   SpatialRegionOfInterestImageFilter();
00108   ~SpatialRegionOfInterestImageFilter() {};
00109   void PrintSelf(std::ostream& os, itk::Indent indent) const;
00110 
00111 
00112   virtual void GenerateInputRequestedRegion();
00113   virtual void EnlargeOutputRequestedRegion(itk::DataObject *output);
00114   
00123   virtual void GenerateOutputInformation();
00124 
00125 
00135   void ThreadedGenerateData(const RegionType& outputRegionForThread,
00136                             int threadId );
00137 
00143   RegionType GenerateLargestSpatialRegion(const TInputImage* pInput);
00144 
00145 private:
00146   SpatialRegionOfInterestImageFilter(const Self&); //purposely not implemented
00147   void operator=(const Self&); //purposely not implemented
00148   
00149   SpatialObjectPointer  m_SpatialObject;
00150   OutputImagePixelType  m_OutsideValue;
00151   bool m_CropByInput;
00152 };
00153 
00154   
00155 } // end namespace itk
00156   
00157 #ifndef ITK_MANUAL_INSTANTIATION
00158 #include "freSpatialRegionOfInterestImageFilter.txx"
00159 #endif
00160   
00161 #endif

Generated at Sat Oct 13 17:36:22 2007 for f.r.e.e. - Flexible Registration and Evaluation Engine by doxygen 1.5.3 written by Dimitri van Heesch, © 1997-2000