/*========================================================================= Program: Insight Segmentation & Registration Toolkit Module: $RCSfile: itkLabelMapToLabelImageFilter.txx,v $ Language: C++ Date: $Date: 2005/08/23 15:09:03 $ Version: $Revision: 1.6 $ Copyright (c) Insight Software Consortium. All rights reserved. See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef __itkLabelMapToLabelImageFilter_txx #define __itkLabelMapToLabelImageFilter_txx #include "itkLabelMapToLabelImageFilter.h" #include "itkNumericTraits.h" #include "itkProgressReporter.h" #include "itkImageRegionConstIteratorWithIndex.h" namespace itk { template LabelMapToLabelImageFilter ::LabelMapToLabelImageFilter() { } template void LabelMapToLabelImageFilter ::BeforeThreadedGenerateData() { OutputImageType * output = this->GetOutput(); const InputImageType * input = this->GetInput(); output->FillBuffer( input->GetBackgroundValue() ); Superclass::BeforeThreadedGenerateData(); } template void LabelMapToLabelImageFilter ::ThreadedGenerateData( LabelObjectType * labelObject ) { const typename LabelObjectType::LabelType & label = labelObject->GetLabel(); typename InputImageType::LabelObjectType::LineContainerType::const_iterator lit; typename InputImageType::LabelObjectType::LineContainerType & lineContainer = labelObject->GetLineContainer(); for( lit = lineContainer.begin(); lit != lineContainer.end(); lit++ ) { IndexType idx = lit->GetIndex(); unsigned long length = lit->GetLength(); for( int i=0; iGetOutput()->SetPixel( idx, label ); idx[0]++; } } } }// end namespace itk #endif