Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

itkAreaClosingImageFilter.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkAreaClosingImageFilter.h,v $
00005   Language:  C++
00006   Date:      $Date: 2009-02-20 17:33:47 $
00007   Version:   $Revision: 1.3 $
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 
00018 #ifndef __itkAreaClosingImageFilter_h
00019 #define __itkAreaClosingImageFilter_h
00020 
00021 #include "itkAttributeMorphologyBaseImageFilter.h"
00022 
00023 namespace itk
00024 {
00025 
00051 template <class TInputImage, class TOutputImage, class TAttribute=ITK_TYPENAME TInputImage::SpacingType::ValueType>
00052 class ITK_EXPORT AreaClosingImageFilter :
00053     public AttributeMorphologyBaseImageFilter<TInputImage, TOutputImage, TAttribute, std::less<typename TInputImage::PixelType> >
00054 
00055 {
00056 public:
00057   typedef AreaClosingImageFilter Self;
00058   typedef AttributeMorphologyBaseImageFilter<TInputImage, TOutputImage, TAttribute, std::less<typename TInputImage::PixelType> >
00059                                  Superclass;
00060 
00061   typedef SmartPointer<Self>        Pointer;
00062   typedef SmartPointer<const Self>  ConstPointer;
00063 
00068   typedef typename TOutputImage::PixelType         OutputPixelType;
00069   typedef typename TOutputImage::InternalPixelType OutputInternalPixelType;
00070   typedef typename TInputImage::PixelType          InputPixelType;
00071   typedef typename TInputImage::InternalPixelType  InputInternalPixelType;
00072   typedef typename TInputImage::IndexType          IndexType;
00073   typedef typename TInputImage::OffsetType         OffsetType;
00074   typedef typename TInputImage::SizeType           SizeType;
00075   typedef TAttribute                               AttributeType;
00076 
00077   itkStaticConstMacro(ImageDimension, unsigned int,
00078                       TOutputImage::ImageDimension);
00079   
00081   itkNewMacro(Self);
00082 
00084   itkTypeMacro(AreaClosingImageFilter, 
00085                AttributeMorphologyBaseImageFilter);
00086 
00090   itkSetMacro(UseImageSpacing, bool);
00091   itkGetConstReferenceMacro(UseImageSpacing, bool);
00092   itkBooleanMacro(UseImageSpacing);
00094 
00095 protected:
00096   AreaClosingImageFilter()
00097     {
00098     m_UseImageSpacing = true;
00099     }
00100   virtual ~AreaClosingImageFilter() {}
00101 
00102   void GenerateData()
00103     {
00104     this->m_AttributeValuePerPixel = 1;
00105     if( m_UseImageSpacing )
00106       {
00107       // compute pixel size
00108       double psize = 1.0;
00109       for( unsigned i=0; i<ImageDimension; i++)
00110         {
00111         psize *= this->GetInput()->GetSpacing()[i];
00112         }
00113       this->m_AttributeValuePerPixel = static_cast<AttributeType>( psize );
00114       // std::cout << "m_AttributeValuePerPixel: " << this->m_AttributeValuePerPixel << std::endl;
00115       // and call superclass implementation of GenerateData()
00116       }
00117     Superclass::GenerateData();
00118     }
00119 
00120   void PrintSelf(std::ostream& os, Indent indent) const
00121     {
00122     Superclass::PrintSelf(os,indent);
00123     os << indent << "UseImageSpacing: "  << m_UseImageSpacing << std::endl;
00124     }
00125 
00126 private:
00127 
00128   AreaClosingImageFilter(const Self&); //purposely not implemented
00129   void operator=(const Self&); //purposely not implemented
00130 
00131   bool m_UseImageSpacing;
00132 
00133 };
00134 
00135 } // namespace itk
00136 #endif
00137 

Generated at Mon Jul 12 2010 17:44:25 for ITK by doxygen 1.7.1 written by Dimitri van Heesch, © 1997-2000