X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2Ffpa%2FIO%2FMatrixValuesContainerReader.hxx;fp=lib%2Ffpa%2FIO%2FMatrixValuesContainerReader.hxx;h=0000000000000000000000000000000000000000;hb=8fafb83c41ab35dfc25eb637170882a612924433;hp=902462b0d30e37a2acaf8358e135e7ebfcb10dc0;hpb=1aff59e7c480d7448c63694da6f30e3dfb022edf;p=FrontAlgorithms.git diff --git a/lib/fpa/IO/MatrixValuesContainerReader.hxx b/lib/fpa/IO/MatrixValuesContainerReader.hxx deleted file mode 100644 index 902462b..0000000 --- a/lib/fpa/IO/MatrixValuesContainerReader.hxx +++ /dev/null @@ -1,103 +0,0 @@ -#ifndef __FPA__IO__MATRIXVALUESCONTAINERREADER__HXX__ -#define __FPA__IO__MATRIXVALUESCONTAINERREADER__HXX__ - -#include - -// ------------------------------------------------------------------------- -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$