itkBinaryShapeOpeningImageFilter.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 #ifndef __itkBinaryShapeOpeningImageFilter_h
00018 #define __itkBinaryShapeOpeningImageFilter_h
00019
00020 #include "itkImageToImageFilter.h"
00021 #include "itkShapeLabelObject.h"
00022 #include "itkLabelMap.h"
00023 #include "itkBinaryImageToLabelMapFilter.h"
00024 #include "itkShapeLabelMapFilter.h"
00025 #include "itkShapeOpeningLabelMapFilter.h"
00026 #include "itkLabelMapToBinaryImageFilter.h"
00027
00028
00029 namespace itk {
00030
00047 template<class TInputImage>
00048 class ITK_EXPORT BinaryShapeOpeningImageFilter :
00049 public ImageToImageFilter<TInputImage, TInputImage>
00050 {
00051 public:
00053 typedef BinaryShapeOpeningImageFilter Self;
00054 typedef ImageToImageFilter<TInputImage, TInputImage> Superclass;
00055 typedef SmartPointer<Self> Pointer;
00056 typedef SmartPointer<const Self> ConstPointer;
00057
00059 typedef TInputImage InputImageType;
00060 typedef TInputImage OutputImageType;
00061 typedef typename InputImageType::Pointer InputImagePointer;
00062 typedef typename InputImageType::ConstPointer InputImageConstPointer;
00063 typedef typename InputImageType::RegionType InputImageRegionType;
00064 typedef typename InputImageType::PixelType InputImagePixelType;
00065 typedef typename OutputImageType::Pointer OutputImagePointer;
00066 typedef typename OutputImageType::ConstPointer OutputImageConstPointer;
00067 typedef typename OutputImageType::RegionType OutputImageRegionType;
00068 typedef typename OutputImageType::PixelType OutputImagePixelType;
00069
00071 itkStaticConstMacro(InputImageDimension, unsigned int, TInputImage::ImageDimension);
00072 itkStaticConstMacro(OutputImageDimension, unsigned int, TInputImage::ImageDimension);
00073 itkStaticConstMacro(ImageDimension, unsigned int, TInputImage::ImageDimension);
00075
00076 typedef ShapeLabelObject<unsigned long, itkGetStaticConstMacro(ImageDimension)> LabelObjectType;
00077 typedef LabelMap< LabelObjectType > LabelMapType;
00078 typedef BinaryImageToLabelMapFilter< InputImageType, LabelMapType > LabelizerType;
00079 typedef Image< typename OutputImageType::PixelType, itkGetStaticConstMacro(OutputImageDimension)>
00080 ShapeLabelFilterOutput;
00081 typedef ShapeLabelMapFilter< LabelMapType,ShapeLabelFilterOutput > LabelObjectValuatorType;
00082 typedef typename LabelObjectType::AttributeType AttributeType;
00083 typedef ShapeOpeningLabelMapFilter< LabelMapType > OpeningType;
00084 typedef LabelMapToBinaryImageFilter< LabelMapType, OutputImageType > BinarizerType;
00085
00087 itkNewMacro(Self);
00088
00090 itkTypeMacro(BinaryShapeOpeningImageFilter, ImageToImageFilter );
00091
00098 itkSetMacro( FullyConnected, bool );
00099 itkGetConstReferenceMacro( FullyConnected, bool );
00100 itkBooleanMacro( FullyConnected );
00102
00103 #ifdef ITK_USE_CONCEPT_CHECKING
00104
00105 itkConceptMacro(InputEqualityComparableCheck,
00106 (Concept::EqualityComparable<InputImagePixelType>));
00107 itkConceptMacro(IntConvertibleToInputCheck,
00108 (Concept::Convertible<int, InputImagePixelType>));
00109 itkConceptMacro(InputOStreamWritableCheck,
00110 (Concept::OStreamWritable<InputImagePixelType>));
00111
00113 #endif
00114
00119 itkSetMacro( BackgroundValue, OutputImagePixelType );
00120 itkGetConstMacro( BackgroundValue, OutputImagePixelType );
00122
00127 itkSetMacro( ForegroundValue, OutputImagePixelType );
00128 itkGetConstMacro( ForegroundValue, OutputImagePixelType);
00130
00134 itkGetConstMacro( Lambda, double );
00135 itkSetMacro( Lambda, double );
00137
00144 itkGetConstMacro( ReverseOrdering, bool );
00145 itkSetMacro( ReverseOrdering, bool );
00146 itkBooleanMacro( ReverseOrdering );
00148
00153 itkGetConstMacro( Attribute, AttributeType );
00154 itkSetMacro( Attribute, AttributeType );
00155 void SetAttribute( const std::string & s )
00156 {
00157 this->SetAttribute( LabelObjectType::GetAttributeFromName( s ) );
00158 }
00160
00161
00162 protected:
00163 BinaryShapeOpeningImageFilter();
00164 ~BinaryShapeOpeningImageFilter() {}
00165 void PrintSelf( std::ostream& os, Indent indent ) const;
00166
00169 void GenerateInputRequestedRegion();
00170
00172 void EnlargeOutputRequestedRegion( DataObject *itkNotUsed(output) );
00173
00176 void GenerateData();
00177
00178
00179 private:
00180 BinaryShapeOpeningImageFilter( const Self& );
00181 void operator=( const Self& );
00182
00183 bool m_FullyConnected;
00184 OutputImagePixelType m_BackgroundValue;
00185 OutputImagePixelType m_ForegroundValue;
00186 double m_Lambda;
00187 bool m_ReverseOrdering;
00188 AttributeType m_Attribute;
00189 };
00190
00191 }
00192
00193 #ifndef ITK_MANUAL_INSTANTIATION
00194 #include "itkBinaryShapeOpeningImageFilter.txx"
00195 #endif
00196
00197 #endif
00198