Orfeo Toolbox  3.16
itkLabelMapToRGBImageFilter.txx
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Insight Segmentation & Registration Toolkit
4  Module: $RCSfile: itkLabelMapToRGBImageFilter.txx,v $
5  Language: C++
6  Date: $Date: 2005/08/23 15:09:03 $
7  Version: $Revision: 1.6 $
8 
9  Copyright (c) Insight Software Consortium. All rights reserved.
10  See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
11 
12  This software is distributed WITHOUT ANY WARRANTY; without even
13  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14  PURPOSE. See the above copyright notices for more information.
15 
16 =========================================================================*/
17 #ifndef __itkLabelMapToRGBImageFilter_txx
18 #define __itkLabelMapToRGBImageFilter_txx
19 
21 #include "itkNumericTraits.h"
22 #include "itkProgressReporter.h"
24 
25 namespace itk {
26 
27 template <class TInputImage, class TOutputImage>
30 {
31 }
32 
33 
34 template<class TInputImage, class TOutputImage>
35 void
38 {
39  OutputImageType * output = this->GetOutput();
40  const InputImageType * input = this->GetInput();
41 
42  FunctorType function;
43  function.SetBackgroundValue( input->GetBackgroundValue() );
44  output->FillBuffer( function( input->GetBackgroundValue() ) );
45 
46  Superclass::BeforeThreadedGenerateData();
47 
48 }
49 
50 
51 template<class TInputImage, class TOutputImage>
52 void
55 {
56  const typename LabelObjectType::LabelType & label = labelObject->GetLabel();
57 
58  FunctorType function;
59  function.SetBackgroundValue( this->GetInput()->GetBackgroundValue() );
60 
61  typename InputImageType::LabelObjectType::LineContainerType::const_iterator lit;
62  typename InputImageType::LabelObjectType::LineContainerType & lineContainer = labelObject->GetLineContainer();
63 
64  for( lit = lineContainer.begin(); lit != lineContainer.end(); lit++ )
65  {
66  IndexType idx = lit->GetIndex();
67  unsigned long length = lit->GetLength();
68  for( unsigned int i=0; i<length; i++)
69  {
70  this->GetOutput()->SetPixel( idx, function( label ) );
71  idx[0]++;
72  }
73  }
74 }
75 
76 }// end namespace itk
77 #endif

Generated at Sat Feb 2 2013 23:49:36 for Orfeo Toolbox with doxygen 1.8.1.1