Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
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
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
00121
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&);
00135 void operator=(const Self&);
00136
00137 bool m_UseImageSpacing;
00138
00139 };
00140
00141 }
00142 #endif
00143