ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkLabelImageToLabelMapFilter.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 __itkLabelImageToLabelMapFilter_h
00019 #define __itkLabelImageToLabelMapFilter_h
00020 
00021 #include "itkImageToImageFilter.h"
00022 #include "itkLabelMap.h"
00023 #include "itkLabelObject.h"
00024 
00025 namespace itk
00026 {
00047 template< class TInputImage, class TOutputImage =
00048             LabelMap< LabelObject< typename TInputImage::PixelType,
00049                                    ::itk::GetImageDimension< TInputImage >::ImageDimension > > >
00050 class ITK_EXPORT LabelImageToLabelMapFilter:
00051   public ImageToImageFilter< TInputImage, TOutputImage >
00052 {
00053 public:
00055   typedef LabelImageToLabelMapFilter                      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 TOutputImage                          OutputImageType;
00063   typedef typename InputImageType::Pointer      InputImagePointer;
00064   typedef typename InputImageType::ConstPointer InputImageConstPointer;
00065   typedef typename InputImageType::RegionType   InputImageRegionType;
00066   typedef typename InputImageType::PixelType    InputImagePixelType;
00067   typedef typename InputImageType::IndexType    IndexType;
00068 
00069   typedef typename OutputImageType::Pointer         OutputImagePointer;
00070   typedef typename OutputImageType::ConstPointer    OutputImageConstPointer;
00071   typedef typename OutputImageType::RegionType      OutputImageRegionType;
00072   typedef typename OutputImageType::PixelType       OutputImagePixelType;
00073   typedef typename OutputImageType::LabelObjectType LabelObjectType;
00074   typedef typename LabelObjectType::LengthType      LengthType;
00075 
00077   itkStaticConstMacro(InputImageDimension, unsigned int,
00078                       TInputImage::ImageDimension);
00079   itkStaticConstMacro(OutputImageDimension, unsigned int,
00080                       TOutputImage::ImageDimension);
00082 
00084   itkNewMacro(Self);
00085 
00087   itkTypeMacro(LabelImageToLabelMapFilter,
00088                ImageToImageFilter);
00089 
00094   itkSetMacro(BackgroundValue, OutputImagePixelType);
00095   itkGetConstMacro(BackgroundValue, OutputImagePixelType);
00097 
00098 #ifdef ITK_USE_CONCEPT_CHECKING
00099   itkConceptMacro( SameDimensionCheck,
00100                    ( Concept::SameDimension< InputImageDimension, OutputImageDimension > ) );
00101 #endif
00102 protected:
00103   LabelImageToLabelMapFilter();
00104   ~LabelImageToLabelMapFilter() {}
00105   void PrintSelf(std::ostream & os, Indent indent) const;
00106 
00110   void GenerateInputRequestedRegion();
00111 
00113   void EnlargeOutputRequestedRegion( DataObject *itkNotUsed(output) );
00114 
00115   virtual void BeforeThreadedGenerateData();
00116 
00117   virtual void ThreadedGenerateData(const OutputImageRegionType & outputRegionForThread, ThreadIdType threadId);
00118 
00119   virtual void AfterThreadedGenerateData();
00120 
00121 private:
00122   LabelImageToLabelMapFilter(const Self &); //purposely not implemented
00123   void operator=(const Self &);             //purposely not implemented
00124 
00125   OutputImagePixelType m_BackgroundValue;
00126 
00127   typename std::vector< OutputImagePointer > m_TemporaryImages;
00128 }; // end of class
00129 } // end namespace itk
00130 
00131 #ifndef ITK_MANUAL_INSTANTIATION
00132 #include "itkLabelImageToLabelMapFilter.hxx"
00133 #endif
00134 
00135 #endif
00136