ITK  4.4.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 "itkFastMutexLock.h"
33 
34 namespace itk
35 {
56 template< class TInputImage, class TOutputImage >
57 class ITK_EXPORT LabelMapFilter:
58  public
59  ImageToImageFilter< TInputImage, TOutputImage >
60 {
61 public:
67 
69  itkTypeMacro(LabelMapFilter, ImageToImageFilter);
70 
72  itkNewMacro(Self);
73 
75  typedef TInputImage InputImageType;
76  typedef typename InputImageType::Pointer InputImagePointer;
77  typedef typename InputImageType::ConstPointer InputImageConstPointer;
78  typedef typename InputImageType::RegionType InputImageRegionType;
79  typedef typename InputImageType::PixelType InputImagePixelType;
80  typedef typename InputImageType::LabelObjectType LabelObjectType;
81 
82  typedef TOutputImage OutputImageType;
83  typedef typename OutputImageType::Pointer OutputImagePointer;
84  typedef typename OutputImageType::ConstPointer OutputImageConstPointer;
85  typedef typename OutputImageType::RegionType OutputImageRegionType;
86  typedef typename OutputImageType::PixelType OutputImagePixelType;
87 
89  itkStaticConstMacro(InputImageDimension, unsigned int, TInputImage::ImageDimension);
90  itkStaticConstMacro(OutputImageDimension, unsigned int, TOutputImage::ImageDimension);
92 
96  void GenerateInputRequestedRegion();
97 
99  void EnlargeOutputRequestedRegion( DataObject * itkNotUsed(output) );
100 
101 protected:
102  LabelMapFilter();
103  ~LabelMapFilter();
104 
105  virtual void BeforeThreadedGenerateData();
106 
107  virtual void AfterThreadedGenerateData();
108 
109  virtual void ThreadedGenerateData(const OutputImageRegionType & outputRegionForThread, ThreadIdType threadId);
110 
111  virtual void ThreadedProcessLabelObject(LabelObjectType *labelObject);
112 
117  virtual InputImageType * GetLabelMap()
118  {
119  return static_cast< InputImageType * >( const_cast< DataObject * >( this->ProcessObject::GetInput(0) ) );
120  }
121 
123 
124 private:
125  LabelMapFilter(const Self &); //purposely not implemented
126  void operator=(const Self &); //purposely not implemented
127 
128  typename InputImageType::Iterator m_LabelObjectIterator;
131 };
132 } // end namespace itk
133 
134 #ifndef ITK_MANUAL_INSTANTIATION
135 #include "itkLabelMapFilter.hxx"
136 #endif
137 
138 #endif
139