ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkLevelSetDomainMapImageFilter.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 
00019 #ifndef __itkLevelSetDomainMapImageFilter_h
00020 #define __itkLevelSetDomainMapImageFilter_h
00021 
00022 #include "itkImageToImageFilter.h"
00023 #include "itkImageRegionIterator.h"
00024 #include "itkImageRegionIteratorWithIndex.h"
00025 #include <list>
00026 #include <vector>
00027 
00028 namespace itk
00029 {
00038 template < class TInputImage, class TOutputImage >
00039 class ITK_EXPORT LevelSetDomainMapImageFilter : public ImageToImageFilter< TInputImage, TOutputImage >
00040 {
00041   public:
00042     typedef LevelSetDomainMapImageFilter                      Self;
00043     typedef ImageToImageFilter< TInputImage,TOutputImage >    Superclass;
00044     typedef SmartPointer< Self >                              Pointer;
00045     typedef SmartPointer< const Self >                        ConstPointer;
00046 
00047     itkStaticConstMacro ( ImageDimension, unsigned int,
00048                           TInputImage::ImageDimension );
00049 
00051     itkNewMacro ( Self );
00052 
00054     itkTypeMacro ( LevelSetDomainMapImageFilter, ImageToImageFilter );
00055 
00056     typedef TInputImage                                 InputImageType;
00057     typedef typename InputImageType::ConstPointer       InputImageConstPointer;
00058     typedef typename InputImageType::PixelType          InputImagePixelType;
00059     typedef typename InputImageType::RegionType         InputImageRegionType;
00060     typedef typename InputImageType::SizeType           InputImageSizeType;
00061     typedef typename InputImageSizeType::SizeValueType  InputImageSizeValueType;
00062     typedef typename InputImageType::IndexType          InputImageIndexType;
00063 
00064     typedef TOutputImage                           OutputImageType;
00065     typedef typename OutputImageType::Pointer      OutputImagePointer;
00066     typedef typename OutputImageType::IndexType    OutputImageIndexType;
00067     typedef typename OutputImageType::PixelType    OutputImagePixelType;
00068 
00069     typedef ImageRegionConstIteratorWithIndex< InputImageType >   InputConstIteratorType;
00070     typedef ImageRegionIteratorWithIndex< InputImageType >        InputIndexIteratorType;
00071     typedef ImageRegionIterator< InputImageType >                 InputIteratorType;
00072 
00073     typedef ImageRegionConstIteratorWithIndex< OutputImageType >  OutputConstIteratorType;
00074     typedef ImageRegionIteratorWithIndex< OutputImageType >       OutputIndexIteratorType;
00075     typedef ImageRegionIterator< OutputImageType >                OutputIteratorType;
00076 
00080     class LevelSetDomain
00081       {
00082       public:
00083         LevelSetDomain() {}
00084 
00085         LevelSetDomain( const InputImageRegionType& reg,
00086                         const InputImagePixelType& iList ) :
00087           m_Region( reg ), m_IdList( iList ) {}
00088 
00089         const InputImageRegionType * GetRegion() const
00090           {
00091           return &(this->m_Region);
00092           }
00093 
00094         const InputImagePixelType * GetIdList() const
00095           {
00096           return &(this->m_IdList);
00097           }
00098 
00099       private:
00100         InputImageRegionType m_Region;
00101         InputImagePixelType m_IdList;
00102       };
00103 
00105     typedef std::map< IdentifierType, LevelSetDomain > DomainMapType;
00106 
00110     const DomainMapType & GetDomainMap() const;
00111 
00112   protected:
00113     LevelSetDomainMapImageFilter();
00114     ~LevelSetDomainMapImageFilter();
00115 
00118     InputImageRegionType ComputeConsistentRegion( const InputImageRegionType & subRegion ) const;
00119 
00122     virtual void GenerateData();
00123 
00125     virtual void PrintSelf ( std::ostream& os, Indent indent ) const;
00126 
00127   private:
00128     DomainMapType m_DomainMap;
00129 
00130     LevelSetDomainMapImageFilter ( Self& );   // intentionally not implemented
00131     void operator= ( const Self& );   // intentionally not implemented
00132   };
00133 
00134 } /* namespace itk */
00135 
00136 #ifndef ITK_MANUAL_INSTANTIATION
00137 #include "itkLevelSetDomainMapImageFilter.hxx"
00138 #endif
00139 
00140 #endif
00141