/*========================================================================= Program: Insight Segmentation & Registration Toolkit Module: $RCSfile: itkLabelCollectionImageToLabelImageFilter.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 __itkLabelCollectionImageToLabelImageFilter_txx #define __itkLabelCollectionImageToLabelImageFilter_txx #include "itkLabelCollectionImageToLabelImageFilter.h" #include "itkNumericTraits.h" #include "itkProgressReporter.h" #include "itkImageRegionConstIteratorWithIndex.h" namespace itk { template LabelCollectionImageToLabelImageFilter ::LabelCollectionImageToLabelImageFilter() { } template void LabelCollectionImageToLabelImageFilter ::BeforeThreadedGenerateData() { OutputImageType * output = this->GetOutput(); const InputImageType * input = this->GetInput(); if( input->GetUseBackground() ) { output->FillBuffer( input->GetBackgroundValue() ); } Superclass::BeforeThreadedGenerateData(); } template void LabelCollectionImageToLabelImageFilter ::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