Orfeo Toolbox  3.16
itkBinaryReconstructionLabelMapFilter.txx
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Insight Segmentation & Registration Toolkit
4  Module: $RCSfile: itkBinaryReconstructionLabelMapFilter.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 __itkBinaryReconstructionLabelMapFilter_txx
18 #define __itkBinaryReconstructionLabelMapFilter_txx
19 
21 #include "itkProgressReporter.h"
22 
23 
24 namespace itk {
25 
26 template <class TImage, class TMarkerImage, class TAttributeAccessor>
29 {
30  this->SetNumberOfRequiredInputs(2);
31  m_ForegroundValue = NumericTraits< MarkerImagePixelType >::max();
32 }
33 
34 
35 template <class TImage, class TMarkerImage, class TAttributeAccessor>
36 void
39 {
40  AttributeAccessorType accessor;
41 
42  const MarkerImageType * maskImage = this->GetMarkerImage();
43 
44  typename LabelObjectType::LineContainerType::const_iterator lit;
45  typename LabelObjectType::LineContainerType & lineContainer = labelObject->GetLineContainer();
46 
47  // iterate over all the lines to find a pixel inside the object
48  for( lit = lineContainer.begin(); lit != lineContainer.end(); lit++ )
49  {
50  const IndexType & firstIdx = lit->GetIndex();
51  unsigned long length = lit->GetLength();
52 
53  long endIdx0 = firstIdx[0] + length;
54  for( IndexType idx = firstIdx; idx[0]<endIdx0; idx[0]++ )
55  {
56  const MarkerImagePixelType & v = maskImage->GetPixel( idx );
57  if( v == m_ForegroundValue )
58  {
59  // keep the object
60  accessor( labelObject, true );
61  return;
62  }
63  }
64  }
65 
66  // remove the object
67  accessor( labelObject, false );
68 
69 }
70 
71 
72 template <class TImage, class TMarkerImage, class TAttributeAccessor>
73 void
75 ::PrintSelf(std::ostream &os, Indent indent) const
76 {
77  Superclass::PrintSelf(os, indent);
78 
79  os << indent << "ForegroundValue: " << static_cast<typename NumericTraits<MarkerImagePixelType>::PrintType>(m_ForegroundValue) << std::endl;
80 }
81 
82 }// end namespace itk
83 #endif

Generated at Sat May 18 2013 23:29:37 for Orfeo Toolbox with doxygen 1.8.3.1