ITK  4.0.0
Insight Segmentation and Registration Toolkit
itkLabelImageToShapeLabelMapFilter.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 __itkLabelImageToShapeLabelMapFilter_h
00019 #define __itkLabelImageToShapeLabelMapFilter_h
00020 
00021 #include "itkShapeLabelObject.h"
00022 #include "itkLabelImageToLabelMapFilter.h"
00023 #include "itkShapeLabelMapFilter.h"
00024 
00025 namespace itk
00026 {
00047 template< class TInputImage, class TOutputImage =
00048             LabelMap< ShapeLabelObject< typename TInputImage::PixelType,
00049                                         ::itk::GetImageDimension< TInputImage >::ImageDimension > > >
00050 class ITK_EXPORT LabelImageToShapeLabelMapFilter:
00051   public ImageToImageFilter< TInputImage, TOutputImage >
00052 {
00053 public:
00055   typedef LabelImageToShapeLabelMapFilter                 Self;
00056   typedef ImageToImageFilter< TInputImage, TOutputImage > Superclass;
00057   typedef SmartPointer< Self >                            Pointer;
00058   typedef SmartPointer< const Self >                      ConstPointer;
00059 
00061   typedef TInputImage                           InputImageType;
00062   typedef typename InputImageType::Pointer      InputImagePointer;
00063   typedef typename InputImageType::ConstPointer InputImageConstPointer;
00064   typedef typename InputImageType::RegionType   InputImageRegionType;
00065   typedef typename InputImageType::PixelType    InputImagePixelType;
00066 
00067   typedef TOutputImage                              OutputImageType;
00068   typedef typename OutputImageType::Pointer         OutputImagePointer;
00069   typedef typename OutputImageType::ConstPointer    OutputImageConstPointer;
00070   typedef typename OutputImageType::RegionType      OutputImageRegionType;
00071   typedef typename OutputImageType::PixelType       OutputImagePixelType;
00072   typedef typename OutputImageType::LabelObjectType LabelObjectType;
00073 
00075   itkStaticConstMacro(InputImageDimension, unsigned int, TInputImage::ImageDimension);
00076   itkStaticConstMacro(OutputImageDimension, unsigned int, TInputImage::ImageDimension);
00077   itkStaticConstMacro(ImageDimension, unsigned int, TInputImage::ImageDimension);
00079 
00080   typedef LabelImageToLabelMapFilter< InputImageType, OutputImageType >
00081   LabelizerType;
00082   typedef Image< typename OutputImageType::PixelType, itkGetStaticConstMacro(OutputImageDimension) >
00083   ShapeLabelFilterOutput;
00084   typedef ShapeLabelMapFilter< TOutputImage, ShapeLabelFilterOutput >
00085   LabelObjectValuatorType;
00086 
00088   itkNewMacro(Self);
00089 
00091   itkTypeMacro(LabelImageToShapeLabelMapFilter, ImageToImageFilter);
00092 
00093 #ifdef ITK_USE_CONCEPT_CHECKING
00094 
00095   itkConceptMacro( InputEqualityComparableCheck,
00096                    ( Concept::EqualityComparable< InputImagePixelType > ) );
00097   itkConceptMacro( IntConvertibleToInputCheck,
00098                    ( Concept::Convertible< int, InputImagePixelType > ) );
00099   itkConceptMacro( InputOStreamWritableCheck,
00100                    ( Concept::OStreamWritable< InputImagePixelType > ) );
00101 
00103 #endif
00104 
00109   itkSetMacro(BackgroundValue, OutputImagePixelType);
00110   itkGetConstMacro(BackgroundValue, OutputImagePixelType);
00112 
00117   itkSetMacro(ComputeFeretDiameter, bool);
00118   itkGetConstReferenceMacro(ComputeFeretDiameter, bool);
00119   itkBooleanMacro(ComputeFeretDiameter);
00121 
00126   itkSetMacro(ComputePerimeter, bool);
00127   itkGetConstReferenceMacro(ComputePerimeter, bool);
00128   itkBooleanMacro(ComputePerimeter);
00129 protected:
00130   LabelImageToShapeLabelMapFilter();
00131   ~LabelImageToShapeLabelMapFilter() {}
00132   void PrintSelf(std::ostream & os, Indent indent) const;
00134 
00137   void GenerateInputRequestedRegion();
00138 
00140   void EnlargeOutputRequestedRegion( DataObject *itkNotUsed(output) );
00141 
00144   void GenerateData();
00145 
00146 private:
00147   LabelImageToShapeLabelMapFilter(const Self &); //purposely not implemented
00148   void operator=(const Self &);                  //purposely not implemented
00149 
00150   OutputImagePixelType m_BackgroundValue;
00151   bool                 m_ComputeFeretDiameter;
00152   bool                 m_ComputePerimeter;
00153 }; // end of class
00154 } // end namespace itk
00155 
00156 #ifndef ITK_MANUAL_INSTANTIATION
00157 #include "itkLabelImageToShapeLabelMapFilter.hxx"
00158 #endif
00159 
00160 #endif
00161