ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkLabelShapeOpeningImageFilter.h
Go to the documentation of this file.
00001 /*=========================================================================
00002  *
00003  *  Copyright Insight Software Consortium
00004  *
00005  *  Licensed under the Apache License, Version 2.0 (the "License");
00006  *  you may not use this file except in compliance with the License.
00007  *  You may obtain a copy of the License at
00008  *
00009  *         http://www.apache.org/licenses/LICENSE-2.0.txt
00010  *
00011  *  Unless required by applicable law or agreed to in writing, software
00012  *  distributed under the License is distributed on an "AS IS" BASIS,
00013  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  *  See the License for the specific language governing permissions and
00015  *  limitations under the License.
00016  *
00017  *=========================================================================*/
00018 #ifndef __itkLabelShapeOpeningImageFilter_h
00019 #define __itkLabelShapeOpeningImageFilter_h
00020 
00021 #include "itkShapeLabelObject.h"
00022 #include "itkLabelImageToLabelMapFilter.h"
00023 #include "itkShapeLabelMapFilter.h"
00024 #include "itkShapeOpeningLabelMapFilter.h"
00025 #include "itkLabelMapToLabelImageFilter.h"
00026 
00027 namespace itk
00028 {
00046 template< class TInputImage >
00047 class ITK_EXPORT LabelShapeOpeningImageFilter:
00048   public ImageToImageFilter< TInputImage, TInputImage >
00049 {
00050 public:
00052   typedef LabelShapeOpeningImageFilter                   Self;
00053   typedef ImageToImageFilter< TInputImage, TInputImage > Superclass;
00054   typedef SmartPointer< Self >                           Pointer;
00055   typedef SmartPointer< const Self >                     ConstPointer;
00056 
00058   typedef TInputImage                            InputImageType;
00059   typedef TInputImage                            OutputImageType;
00060   typedef typename InputImageType::Pointer       InputImagePointer;
00061   typedef typename InputImageType::ConstPointer  InputImageConstPointer;
00062   typedef typename InputImageType::RegionType    InputImageRegionType;
00063   typedef typename InputImageType::PixelType     InputImagePixelType;
00064   typedef typename OutputImageType::Pointer      OutputImagePointer;
00065   typedef typename OutputImageType::ConstPointer OutputImageConstPointer;
00066   typedef typename OutputImageType::RegionType   OutputImageRegionType;
00067   typedef typename OutputImageType::PixelType    OutputImagePixelType;
00068 
00070   itkStaticConstMacro(InputImageDimension, unsigned int,
00071                       TInputImage::ImageDimension);
00072   itkStaticConstMacro(OutputImageDimension, unsigned int,
00073                       TInputImage::ImageDimension);
00074   itkStaticConstMacro(ImageDimension, unsigned int,
00075                       TInputImage::ImageDimension);
00077 
00078   typedef ShapeLabelObject< InputImagePixelType, itkGetStaticConstMacro(ImageDimension) > LabelObjectType;
00079   typedef LabelMap< LabelObjectType >                                                     LabelMapType;
00080   typedef LabelImageToLabelMapFilter< InputImageType, LabelMapType >                      LabelizerType;
00081   typedef Image< typename OutputImageType::PixelType, itkGetStaticConstMacro(OutputImageDimension) >
00082   ShapeLabelFilterOutput;
00083   typedef ShapeLabelMapFilter< LabelMapType, ShapeLabelFilterOutput > LabelObjectValuatorType;
00084   typedef typename LabelObjectType::AttributeType                     AttributeType;
00085   typedef ShapeOpeningLabelMapFilter< LabelMapType >                  OpeningType;
00086   typedef LabelMapToLabelImageFilter< LabelMapType, OutputImageType > BinarizerType;
00087 
00089   itkNewMacro(Self);
00090 
00092   itkTypeMacro(LabelShapeOpeningImageFilter,
00093                ImageToImageFilter);
00094 
00095 #ifdef ITK_USE_CONCEPT_CHECKING
00096 
00097   itkConceptMacro( InputEqualityComparableCheck,
00098                    ( Concept::EqualityComparable< InputImagePixelType > ) );
00099   itkConceptMacro( IntConvertibleToInputCheck,
00100                    ( Concept::Convertible< int, InputImagePixelType > ) );
00101   itkConceptMacro( InputOStreamWritableCheck,
00102                    ( Concept::OStreamWritable< InputImagePixelType > ) );
00103 
00105 #endif
00106 
00111   itkSetMacro(BackgroundValue, OutputImagePixelType);
00112   itkGetConstMacro(BackgroundValue, OutputImagePixelType);
00114 
00118   itkGetConstMacro(Lambda, double);
00119   itkSetMacro(Lambda, double);
00121 
00128   itkGetConstMacro(ReverseOrdering, bool);
00129   itkSetMacro(ReverseOrdering, bool);
00130   itkBooleanMacro(ReverseOrdering);
00132 
00137   itkGetConstMacro(Attribute, AttributeType);
00138   itkSetMacro(Attribute, AttributeType);
00139   void SetAttribute(const std::string & s)
00140   {
00141     this->SetAttribute( LabelObjectType::GetAttributeFromName(s) );
00142   }
00144 
00145 protected:
00146   LabelShapeOpeningImageFilter();
00147   ~LabelShapeOpeningImageFilter() {}
00148   void PrintSelf(std::ostream & os, Indent indent) const;
00149 
00153   void GenerateInputRequestedRegion();
00154 
00156   void EnlargeOutputRequestedRegion( DataObject *itkNotUsed(output) );
00157 
00160   void GenerateData();
00161 
00162 private:
00163   LabelShapeOpeningImageFilter(const Self &); //purposely not implemented
00164   void operator=(const Self &);               //purposely not implemented
00165 
00166   OutputImagePixelType m_BackgroundValue;
00167   double               m_Lambda;
00168   bool                 m_ReverseOrdering;
00169   AttributeType        m_Attribute;
00170 }; // end of class
00171 } // end namespace itk
00172 
00173 #ifndef ITK_MANUAL_INSTANTIATION
00174 #include "itkLabelShapeOpeningImageFilter.hxx"
00175 #endif
00176 
00177 #endif
00178