ITK  4.3.0
Insight Segmentation and Registration Toolkit
itkLabelMapFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 /*=========================================================================
19  *
20  * Portions of this file are subject to the VTK Toolkit Version 3 copyright.
21  *
22  * Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
23  *
24  * For complete copyright, license and disclaimer of warranty information
25  * please refer to the NOTICE file at the top of the ITK source tree.
26  *
27  *=========================================================================*/
28 #ifndef __itkLabelMapFilter_h
29 #define __itkLabelMapFilter_h
30 
31 #include "itkImageToImageFilter.h"
32 #include "itkProgressReporter.h"
33 #include "itkFastMutexLock.h"
34 
35 namespace itk
36 {
57 template< class TInputImage, class TOutputImage >
58 class ITK_EXPORT LabelMapFilter:
59  public
60  ImageToImageFilter< TInputImage, TOutputImage >
61 {
62 public:
68 
70  itkTypeMacro(LabelMapFilter, ImageToImageFilter);
71 
73  itkNewMacro(Self);
74 
76  typedef TInputImage InputImageType;
77  typedef typename InputImageType::Pointer InputImagePointer;
78  typedef typename InputImageType::ConstPointer InputImageConstPointer;
79  typedef typename InputImageType::RegionType InputImageRegionType;
80  typedef typename InputImageType::PixelType InputImagePixelType;
81  typedef typename InputImageType::LabelObjectType LabelObjectType;
82 
83  typedef TOutputImage OutputImageType;
84  typedef typename OutputImageType::Pointer OutputImagePointer;
85  typedef typename OutputImageType::ConstPointer OutputImageConstPointer;
86  typedef typename OutputImageType::RegionType OutputImageRegionType;
87  typedef typename OutputImageType::PixelType OutputImagePixelType;
88 
90  itkStaticConstMacro(InputImageDimension, unsigned int, TInputImage::ImageDimension);
91  itkStaticConstMacro(OutputImageDimension, unsigned int, TOutputImage::ImageDimension);
93 
97  void GenerateInputRequestedRegion();
98 
100  void EnlargeOutputRequestedRegion( DataObject * itkNotUsed(output) );
101 
102 protected:
103  LabelMapFilter();
104  ~LabelMapFilter();
105 
106  virtual void BeforeThreadedGenerateData();
107 
108  virtual void AfterThreadedGenerateData();
109 
110  virtual void ThreadedGenerateData(const OutputImageRegionType & outputRegionForThread, ThreadIdType threadId);
111 
112  virtual void ThreadedProcessLabelObject(LabelObjectType *labelObject);
113 
118  virtual InputImageType * GetLabelMap()
119  {
120  return static_cast< InputImageType * >( const_cast< DataObject * >( this->ProcessObject::GetInput(0) ) );
121  }
122 
124 
125 private:
126  LabelMapFilter(const Self &); //purposely not implemented
127  void operator=(const Self &); //purposely not implemented
128 
129  typename InputImageType::Iterator m_LabelObjectIterator;
130 
132 };
133 } // end namespace itk
134 
135 #ifndef ITK_MANUAL_INSTANTIATION
136 #include "itkLabelMapFilter.hxx"
137 #endif
138 
139 #endif
140