+++ /dev/null
-#ifndef __FPA__IO__MATRIXVALUESCONTAINERREADER__HXX__
-#define __FPA__IO__MATRIXVALUESCONTAINERREADER__HXX__
-
-#include <fstream>
-
-// -------------------------------------------------------------------------
-template< class T >
-T* fpa::IO::MatrixValuesContainerReader< T >::
-GetOutput( )
-{
- return( itkDynamicCastInDebugMode< T* >( this->GetPrimaryOutput( ) ) );
-}
-
-// -------------------------------------------------------------------------
-template< class T >
-void fpa::IO::MatrixValuesContainerReader< T >::
-Update( )
-{
- this->GenerateData( );
-}
-
-// -------------------------------------------------------------------------
-template< class T >
-fpa::IO::MatrixValuesContainerReader< T >::
-MatrixValuesContainerReader( )
- : Superclass( ),
- m_FileName( "" )
-{
- this->itk::ProcessObject::SetNumberOfRequiredOutputs( 1 );
- this->itk::ProcessObject::SetNthOutput( 0, T::New( ) );
-}
-
-// -------------------------------------------------------------------------
-template< class T >
-fpa::IO::MatrixValuesContainerReader< T >::
-~MatrixValuesContainerReader( )
-{
-}
-
-// -------------------------------------------------------------------------
-template< class T >
-void fpa::IO::MatrixValuesContainerReader< T >::
-GenerateData( )
-{
- T* output = this->GetOutput( );
- output->Clear( );
-
- std::ifstream in( this->m_FileName.c_str( ) );
- if( !in )
- {
- itkExceptionMacro(
- << "Error opening file to read a minimum spanning tree: \""
- << this->m_FileName
- << "\""
- );
- return;
-
- } // fi
-
- unsigned int dim;
- unsigned long nTuples;
- in >> dim >> nTuples;
- this->m_NumberOfLabels = 0;
- for( unsigned long tId = 0; tId < nTuples; ++tId )
- {
- unsigned long nCouples;
- in >> nCouples;
- typename T::TIndex v0;
- for( unsigned int d = 0; d < dim; ++d )
- {
- long val;
- in >> val;
- if( d < T::TIndex::Dimension )
- v0[ d ] = val;
-
- } // rof
-
- for( unsigned long cId = 0; cId < nCouples; ++cId )
- {
- typename T::TIndex v1;
- for( unsigned int d = 0; d < dim; ++d )
- {
- long val;
- in >> val;
- if( d < T::TIndex::Dimension )
- v1[ d ] = val;
-
- } // rof
- typename T::TValue val;
- in >> val;
- output->SetValue( v0, v1, val );
- if( val > this->m_NumberOfLabels )
- this->m_NumberOfLabels = val;
-
- } // rof
-
- } // rof
- in.close( );
-}
-
-#endif // __FPA__IO__MATRIXVALUESCONTAINERREADER__HXX__
-
-// eof - $RCSfile$