ITK  4.3.0
Insight Segmentation and Registration Toolkit
itkLabelMapContourOverlayImageFilter.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 #ifndef __itkLabelMapContourOverlayImageFilter_h
19 #define __itkLabelMapContourOverlayImageFilter_h
20 
21 #include "itkLabelMapFilter.h"
22 #include "itkBarrier.h"
23 #include "itkLabelOverlayFunctor.h"
24 #include "itkRGBPixel.h"
25 
26 namespace itk {
27 
56 template<class TLabelMap, class TFeatureImage, class TOutputImage=Image< RGBPixel< typename TFeatureImage::PixelType >, TFeatureImage::ImageDimension > >
58  public LabelMapFilter<TLabelMap, TOutputImage>
59 {
60 public:
66 
68  typedef TLabelMap LabelMapType;
69  typedef typename LabelMapType::Pointer LabelMapPointer;
70  typedef typename LabelMapType::ConstPointer LabelMapConstPointer;
71  typedef typename LabelMapType::RegionType LabelMapRegionType;
72  typedef typename LabelMapType::PixelType LabelMapPixelType;
73  typedef typename LabelMapType::LabelObjectType LabelObjectType;
74  typedef typename LabelObjectType::LabelType LabelType;
75 
76  typedef TFeatureImage FeatureImageType;
77  typedef typename FeatureImageType::Pointer FeatureImagePointer;
78  typedef typename FeatureImageType::ConstPointer FeatureImageConstPointer;
79  typedef typename FeatureImageType::RegionType FeatureImageRegionType;
80  typedef typename FeatureImageType::PixelType FeatureImagePixelType;
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  typedef typename OutputImageType::IndexType IndexType;
88  typedef typename OutputImageType::SizeType SizeType;
89  typedef typename OutputImageType::RegionType RegionType;
90 
92 
94  itkStaticConstMacro(LabelMapDimension, unsigned int,
95  TLabelMap::ImageDimension);
96  itkStaticConstMacro(OutputImageDimension, unsigned int,
97  TOutputImage::ImageDimension);
98  itkStaticConstMacro(ImageDimension, unsigned int,
99  TOutputImage::ImageDimension);
101 
102  enum
103  {
104  PLAIN = 0,
105  CONTOUR = 1,
106  SLICE_CONTOUR=2
107  };
108 
109  enum
110  {
111  HIGH_LABEL_ON_TOP = 0,
112  LOW_LABEL_ON_TOP = 1
113  };
114 
116  itkNewMacro(Self);
117 
121 
123  void SetFeatureImage(TFeatureImage *input)
124  {
125  // Process object is not const-correct so the const casting is required.
126  this->SetNthInput( 1, const_cast<TFeatureImage *>(input) );
127  }
128 
130  FeatureImageType * GetFeatureImage()
131  {
132  return itkDynamicCastInDebugMode<FeatureImageType*>(const_cast<DataObject *>(this->ProcessObject::GetInput(1)));
133  }
134 
136  void SetInput1(TLabelMap *input)
137  {
138  this->SetInput( input );
139  }
140 
142  void SetInput2(TFeatureImage *input)
143  {
144  this->SetFeatureImage( input );
145  }
146 
150  itkSetMacro( Opacity, double );
151  itkGetConstReferenceMacro( Opacity, double );
153 
156  itkSetMacro( Type, int );
157  itkGetConstReferenceMacro( Type, int );
159 
162  itkSetMacro( Priority, int );
163  itkGetConstReferenceMacro( Priority, int );
165 
168  itkSetMacro( DilationRadius, SizeType );
169  itkGetConstReferenceMacro( DilationRadius, SizeType );
171 
174  itkSetMacro( ContourThickness, SizeType );
175  itkGetConstReferenceMacro( ContourThickness, SizeType );
177 
180  itkSetMacro( SliceDimension, int );
181  itkGetConstReferenceMacro( SliceDimension, int );
183 
184 protected:
187 
191  void GenerateInputRequestedRegion();
192 
194  void EnlargeOutputRequestedRegion(DataObject *itkNotUsed(output));
195 
196  virtual void BeforeThreadedGenerateData();
197 
198  virtual void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, ThreadIdType threadId );
199 
200  virtual void ThreadedProcessLabelObject( LabelObjectType * labelObject );
201 
202  virtual void GenerateOutputInformation();
203 
204  void PrintSelf(std::ostream& os, Indent indent) const;
205 
206  virtual LabelMapType * GetLabelMap()
207  {
208  return m_TempImage;
209  }
210 
211 private:
212  LabelMapContourOverlayImageFilter(const Self&); //purposely not implemented
213  void operator=(const Self&); //purposely not implemented
214 
215  double m_Opacity;
217  int m_Type;
222 
224 
225 }; // end of class
226 
227 } // end namespace itk
228 
229 #ifndef ITK_MANUAL_INSTANTIATION
230 #include "itkLabelMapContourOverlayImageFilter.hxx"
231 #endif
232 
233 #endif
234