ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkBinaryImageToShapeLabelMapFilter.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 __itkBinaryImageToShapeLabelMapFilter_h
00019 #define __itkBinaryImageToShapeLabelMapFilter_h
00020 
00021 #include "itkShapeLabelObject.h"
00022 #include "itkBinaryImageToLabelMapFilter.h"
00023 #include "itkShapeLabelMapFilter.h"
00024 
00025 namespace itk
00026 {
00060 template< class TInputImage, class TOutputImage =
00061             LabelMap< ShapeLabelObject< SizeValueType, ::itk::GetImageDimension< TInputImage >::ImageDimension > > >
00062 class ITK_EXPORT BinaryImageToShapeLabelMapFilter:
00063   public ImageToImageFilter< TInputImage, TOutputImage >
00064 {
00065 public:
00067   typedef BinaryImageToShapeLabelMapFilter                Self;
00068   typedef ImageToImageFilter< TInputImage, TOutputImage > Superclass;
00069   typedef SmartPointer< Self >                            Pointer;
00070   typedef SmartPointer< const Self >                      ConstPointer;
00071 
00073   typedef TInputImage                           InputImageType;
00074   typedef typename InputImageType::Pointer      InputImagePointer;
00075   typedef typename InputImageType::ConstPointer InputImageConstPointer;
00076   typedef typename InputImageType::RegionType   InputImageRegionType;
00077   typedef typename InputImageType::PixelType    InputImagePixelType;
00078 
00079   typedef TOutputImage                              OutputImageType;
00080   typedef typename OutputImageType::Pointer         OutputImagePointer;
00081   typedef typename OutputImageType::ConstPointer    OutputImageConstPointer;
00082   typedef typename OutputImageType::RegionType      OutputImageRegionType;
00083   typedef typename OutputImageType::PixelType       OutputImagePixelType;
00084   typedef typename OutputImageType::LabelObjectType LabelObjectType;
00085 
00087   itkStaticConstMacro(InputImageDimension, unsigned int, TInputImage::ImageDimension);
00088   itkStaticConstMacro(OutputImageDimension, unsigned int, TInputImage::ImageDimension);
00089   itkStaticConstMacro(ImageDimension, unsigned int, TInputImage::ImageDimension);
00091 
00092   typedef BinaryImageToLabelMapFilter< InputImageType, OutputImageType > LabelizerType;
00093   typedef Image< typename OutputImageType::PixelType, itkGetStaticConstMacro(OutputImageDimension) >
00094   ShapeLabelFilterOutput;
00095   typedef ShapeLabelMapFilter< TOutputImage, ShapeLabelFilterOutput > LabelObjectValuatorType;
00096 
00098   itkNewMacro(Self);
00099 
00101   itkTypeMacro(BinaryImageToShapeLabelMapFilter, ImageToImageFilter);
00102 
00108   itkSetMacro(FullyConnected, bool);
00109   itkGetConstReferenceMacro(FullyConnected, bool);
00110   itkBooleanMacro(FullyConnected);
00112 
00113 #ifdef ITK_USE_CONCEPT_CHECKING
00114 
00115   itkConceptMacro( InputEqualityComparableCheck,
00116                    ( Concept::EqualityComparable< InputImagePixelType > ) );
00117   itkConceptMacro( IntConvertibleToInputCheck,
00118                    ( Concept::Convertible< int, InputImagePixelType > ) );
00119   itkConceptMacro( InputOStreamWritableCheck,
00120                    ( Concept::OStreamWritable< InputImagePixelType > ) );
00121 
00123 #endif
00124 
00129   itkSetMacro(OutputBackgroundValue, OutputImagePixelType);
00130   itkGetConstMacro(OutputBackgroundValue, OutputImagePixelType);
00132 
00137   itkSetMacro(InputForegroundValue, InputImagePixelType);
00138   itkGetConstMacro(InputForegroundValue, InputImagePixelType);
00140 
00145   itkSetMacro(ComputeFeretDiameter, bool);
00146   itkGetConstReferenceMacro(ComputeFeretDiameter, bool);
00147   itkBooleanMacro(ComputeFeretDiameter);
00149 
00154   itkSetMacro(ComputePerimeter, bool);
00155   itkGetConstReferenceMacro(ComputePerimeter, bool);
00156   itkBooleanMacro(ComputePerimeter);
00157 protected:
00158   BinaryImageToShapeLabelMapFilter();
00159   ~BinaryImageToShapeLabelMapFilter() {}
00160   void PrintSelf(std::ostream & os, Indent indent) const;
00162 
00165   void GenerateInputRequestedRegion();
00166 
00168   void EnlargeOutputRequestedRegion( DataObject *itkNotUsed(output) );
00169 
00172   void GenerateData();
00173 
00174 private:
00175   BinaryImageToShapeLabelMapFilter(const Self &); //purposely not implemented
00176   void operator=(const Self &);                   //purposely not implemented
00177 
00178   bool                 m_FullyConnected;
00179   OutputImagePixelType m_OutputBackgroundValue;
00180   InputImagePixelType  m_InputForegroundValue;
00181   bool                 m_ComputeFeretDiameter;
00182   bool                 m_ComputePerimeter;
00183 }; // end of class
00184 } // end namespace itk
00185 
00186 #ifndef ITK_MANUAL_INSTANTIATION
00187 #include "itkBinaryImageToShapeLabelMapFilter.hxx"
00188 #endif
00189 
00190 #endif
00191