1 #ifndef __FPA__IO__MATRIXVALUESCONTAINERREADER__HXX__
2 #define __FPA__IO__MATRIXVALUESCONTAINERREADER__HXX__
6 // -------------------------------------------------------------------------
8 T* fpa::IO::MatrixValuesContainerReader< T >::
11 return( itkDynamicCastInDebugMode< T* >( this->GetPrimaryOutput( ) ) );
14 // -------------------------------------------------------------------------
16 void fpa::IO::MatrixValuesContainerReader< T >::
19 this->GenerateData( );
22 // -------------------------------------------------------------------------
24 fpa::IO::MatrixValuesContainerReader< T >::
25 MatrixValuesContainerReader( )
29 this->itk::ProcessObject::SetNumberOfRequiredOutputs( 1 );
30 this->itk::ProcessObject::SetNthOutput( 0, T::New( ) );
33 // -------------------------------------------------------------------------
35 fpa::IO::MatrixValuesContainerReader< T >::
36 ~MatrixValuesContainerReader( )
40 // -------------------------------------------------------------------------
42 void fpa::IO::MatrixValuesContainerReader< T >::
45 T* output = this->GetOutput( );
48 std::ifstream in( this->m_FileName.c_str( ) );
52 << "Error opening file to read a minimum spanning tree: \""
61 unsigned long nTuples;
63 this->m_NumberOfLabels = 0;
64 for( unsigned long tId = 0; tId < nTuples; ++tId )
66 unsigned long nCouples;
68 typename T::TIndex v0;
69 for( unsigned int d = 0; d < dim; ++d )
73 if( d < T::TIndex::Dimension )
78 for( unsigned long cId = 0; cId < nCouples; ++cId )
80 typename T::TIndex v1;
81 for( unsigned int d = 0; d < dim; ++d )
85 if( d < T::TIndex::Dimension )
89 typename T::TValue val;
91 output->SetValue( v0, v1, val );
92 if( val > this->m_NumberOfLabels )
93 this->m_NumberOfLabels = val;
101 #endif // __FPA__IO__MATRIXVALUESCONTAINERREADER__HXX__