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

itkAreaOpeningImageFilter.h

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

Generated at Tue Sep 15 02:09:51 2009 for ITK by doxygen 1.5.8 written by Dimitri van Heesch, © 1997-2000