itkAreaOpeningImageFilter.h
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
00051 template <class TInputImage, class TOutputImage, class TAttribute=ITK_TYPENAME TInputImage::SpacingType::ValueType>
00052 class ITK_EXPORT AreaOpeningImageFilter :
00053 public AttributeMorphologyBaseImageFilter<TInputImage, TOutputImage, TAttribute, std::greater<typename TInputImage::PixelType> >
00054
00055 {
00056 public:
00057 typedef AreaOpeningImageFilter Self;
00058 typedef AttributeMorphologyBaseImageFilter<TInputImage, TOutputImage, TAttribute, std::greater<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(AreaOpeningImageFilter,
00085 AttributeMorphologyBaseImageFilter);
00086
00090 itkSetMacro(UseImageSpacing, bool);
00091 itkGetConstReferenceMacro(UseImageSpacing, bool);
00092 itkBooleanMacro(UseImageSpacing);
00094
00095 protected:
00096 AreaOpeningImageFilter()
00097 {
00098 m_UseImageSpacing = true;
00099 }
00100 virtual ~AreaOpeningImageFilter() {}
00101
00102 void GenerateData()
00103 {
00104 this->m_AttributeValuePerPixel = 1;
00105 if( m_UseImageSpacing )
00106 {
00107
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
00115
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 AreaOpeningImageFilter(const Self&);
00129 void operator=(const Self&);
00130
00131 bool m_UseImageSpacing;
00132
00133 };
00134
00135 }
00136 #endif
00137