ITK  4.13.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< typename TInputImage, typename TOutputImage >
57 class ITK_TEMPLATE_EXPORT LabelMapFilter:
58  public
59  ImageToImageFilter< TInputImage, TOutputImage >
60 {
61 public:
67 
69  itkTypeMacro(LabelMapFilter, ImageToImageFilter);
70 
72  itkNewMacro(Self);
73 
75  typedef typename Superclass::InputImageType InputImageType;
76  typedef typename Superclass::InputImagePointer InputImagePointer;
77  typedef typename Superclass::InputImageConstPointer InputImageConstPointer;
78  typedef typename Superclass::InputImageRegionType InputImageRegionType;
79  typedef typename Superclass::InputImagePixelType 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() ITK_OVERRIDE;
97 
99  void EnlargeOutputRequestedRegion( DataObject * itkNotUsed(output) ) ITK_OVERRIDE;
100 
101 protected:
102  LabelMapFilter();
103  ~LabelMapFilter() ITK_OVERRIDE;
104 
105  virtual void BeforeThreadedGenerateData() ITK_OVERRIDE;
106 
107  virtual void AfterThreadedGenerateData() ITK_OVERRIDE;
108 
109  virtual void ThreadedGenerateData(const OutputImageRegionType & outputRegionForThread, ThreadIdType threadId) ITK_OVERRIDE;
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  ITK_DISALLOW_COPY_AND_ASSIGN(LabelMapFilter);
126 
127  typename InputImageType::Iterator m_LabelObjectIterator;
130 };
131 } // end namespace itk
132 
133 #ifndef ITK_MANUAL_INSTANTIATION
134 #include "itkLabelMapFilter.hxx"
135 #endif
136 
137 #endif
SmartPointer< Self > Pointer
SmartPointer< const Self > ConstPointer
Superclass::InputImageRegionType InputImageRegionType
Light weight base class for most itk classes.
OutputImageType::RegionType OutputImageRegionType
OutputImageType::PixelType OutputImagePixelType
Superclass::InputImagePixelType InputImagePixelType
unsigned long SizeValueType
Definition: itkIntTypes.h:143
ImageToImageFilter< TInputImage, TOutputImage > Superclass
Superclass::InputImageConstPointer InputImageConstPointer
Base class for filters that take an image as input and overwrite that image as the output...
unsigned int ThreadIdType
Definition: itkIntTypes.h:159
DataObject * GetInput(const DataObjectIdentifierType &key)
Return an input.
Superclass::InputImageType InputImageType
InputImageType::Iterator m_LabelObjectIterator
OutputImageType::ConstPointer OutputImageConstPointer
Superclass::InputImagePointer InputImagePointer
InputImageType::LabelObjectType LabelObjectType
Base class for filters that take an image as input and produce an image as output.
OutputImageType::RegionType OutputImageRegionType
OutputImageType::Pointer OutputImagePointer
TOutputImage OutputImageType
FastMutexLock::Pointer m_LabelObjectContainerLock
Base class for all data objects in ITK.
SizeValueType m_NumberOfLabelObjectsProcessed