]> Creatis software - FrontAlgorithms.git/blobdiff - lib/fpa/IO/MinimumSpanningTreeWriter.hxx
...
[FrontAlgorithms.git] / lib / fpa / IO / MinimumSpanningTreeWriter.hxx
diff --git a/lib/fpa/IO/MinimumSpanningTreeWriter.hxx b/lib/fpa/IO/MinimumSpanningTreeWriter.hxx
deleted file mode 100644 (file)
index d4b1f12..0000000
+++ /dev/null
@@ -1,183 +0,0 @@
-#ifndef __FPA__IO__MINIMUMSPANNINGTREEWRITER__HXX__
-#define __FPA__IO__MINIMUMSPANNINGTREEWRITER__HXX__
-
-#include <fstream>
-#include <sstream>
-#include <itkMacro.h>
-#include <itkOffset.h>
-#include <itkImageRegionConstIteratorWithIndex.h>
-
-// -------------------------------------------------------------------------
-template< class _TTree >
-void fpa::IO::MinimumSpanningTreeWriter< _TTree >::
-SetInput( const _TTree* input )
-{
-  this->itk::ProcessObject::SetNthInput( 0, const_cast< _TTree* >( input ) );
-}
-
-// -------------------------------------------------------------------------
-template< class _TTree >
-_TTree* fpa::IO::MinimumSpanningTreeWriter< _TTree >::
-GetInput( )
-{
-  return(
-    dynamic_cast< _TTree* >( this->itk::ProcessObject::GetInput( 0 ) )
-    );
-}
-
-// -------------------------------------------------------------------------
-template< class _TTree >
-const _TTree* fpa::IO::MinimumSpanningTreeWriter< _TTree >::
-GetInput( ) const
-{
-  return(
-    dynamic_cast< const _TTree* >( this->itk::ProcessObject::GetInput( 0 ) )
-    );
-}
-
-// -------------------------------------------------------------------------
-template< class _TTree >
-void fpa::IO::MinimumSpanningTreeWriter< _TTree >::
-Update( )
-{
-  _TTree* input = this->GetInput( );
-  if( input != NULL )
-  {
-    input->UpdateOutputInformation( );
-    input->UpdateOutputData( );
-    this->GenerateData( );
-    this->ReleaseInputs( );
-
-  } // fi
-}
-
-// -------------------------------------------------------------------------
-template< class _TTree >
-fpa::IO::MinimumSpanningTreeWriter< _TTree >::
-MinimumSpanningTreeWriter( )
-  : Superclass( ),
-    m_FileName( "" )
-{
-  this->SetNumberOfRequiredInputs( 1 );
-}
-
-// -------------------------------------------------------------------------
-template< class _TTree >
-fpa::IO::MinimumSpanningTreeWriter< _TTree >::
-~MinimumSpanningTreeWriter( )
-{
-}
-
-// -------------------------------------------------------------------------
-template< class _TTree >
-void fpa::IO::MinimumSpanningTreeWriter< _TTree >::
-GenerateData( )
-{
-  typedef itk::Offset< _TTree::ImageDimension > _TOffset;
-  _TOffset zero_off;
-  zero_off.Fill( 0 );
-  const _TTree* input = this->GetInput( );
-
-  // Create buffer
-  std::stringstream out;
-
-  // Get tree properties
-  unsigned int dim = _TTree::ImageDimension;
-  auto lr = input->GetLargestPossibleRegion( );
-  auto rr = input->GetRequestedRegion( );
-  auto br = input->GetBufferedRegion( );
-  auto ori = input->GetOrigin( );
-  auto spc = input->GetSpacing( );
-  auto dir = input->GetDirection( );
-
-  // Write tree dimension
-  out << dim << std::endl;
-  out << ( ( input->GetFillNodeQueue( ) )? 1: 0 ) << std::endl;
-
-  // Write tree regions
-  out << lr.GetIndex( )[ 0 ] << " " << lr.GetSize( )[ 0 ];
-  for( unsigned int d = 1; d < dim; ++d )
-    out << " " << lr.GetIndex( )[ d ] << " " << lr.GetSize( )[ d ];
-  out << std::endl;
-  out << rr.GetIndex( )[ 0 ] << " " << rr.GetSize( )[ 0 ];
-  for( unsigned int d = 1; d < dim; ++d )
-    out << " " << rr.GetIndex( )[ d ] << " " << rr.GetSize( )[ d ];
-  out << std::endl;
-  out << br.GetIndex( )[ 0 ] << " " << br.GetSize( )[ 0 ];
-  for( unsigned int d = 1; d < dim; ++d )
-    out << " " << br.GetIndex( )[ d ] << " " << br.GetSize( )[ d ];
-  out << std::endl;
-
-  // Write spatial properties
-  out << ori[ 0 ];
-  for( unsigned int d = 1; d < dim; ++d )
-    out << " " << ori[ d ];
-  out << std::endl;
-  out << spc[ 0 ];
-  for( unsigned int d = 1; d < dim; ++d )
-    out << " " << spc[ d ];
-  out << std::endl;
-  out << dir[ 0 ][ 0 ];
-  for( unsigned int d = 0; d < dim; ++d )
-    for( unsigned int e = 0; e < dim; ++e )
-      if( d != 0 || e != 0 )
-        out << " " << dir[ d ][ e ];
-  out << std::endl;
-
-  // Write collisions
-  auto& coll = input->GetCollisions( );
-  out << coll.size( ) << std::endl;
-  for( unsigned long i = 0; i < coll.size( ); ++i )
-  {
-    out << coll[ i ].size( );
-    for( unsigned long j = 0; j < coll[ i ].size( ); ++j )
-    {
-      for( unsigned int d = 0; d < dim; ++d )
-        out << " " << coll[ i ][ j ].first[ d ];
-      out << " " << coll[ i ][ j ].second << std::endl;
-
-    } // rof
-
-  } // rof
-
-  // Write vertices
-  itk::ImageRegionConstIteratorWithIndex< _TTree > vIt( input, rr );
-  for( vIt.GoToBegin( ); !vIt.IsAtEnd( ); ++vIt )
-  {
-    if(
-      vIt.Get( ).Parent != zero_off ||
-      vIt.Get( ).GlobalCost > double( 0 )
-      )
-    {
-      out << vIt.Get( ).FrontId << " " << vIt.Get( ).GlobalCost;
-      for( unsigned int d = 0; d < dim; ++d )
-        out << " " << vIt.GetIndex( )[ d ];
-      for( unsigned int d = 0; d < dim; ++d )
-        out << " " << vIt.Get( ).Parent[ d ];
-      out << std::endl;
-
-    } // fi
-
-  } // rof
-
-  // Real file write
-  std::ofstream file(
-    this->m_FileName.c_str( ), std::ios::binary | std::ios::trunc
-    );
-  if( !file )
-  {
-    itkExceptionMacro(
-      << "Error opening file to write a minimum spanning tree: \""
-      << this->m_FileName
-      << "\""
-      );
-    return;
-
-  } // fi
-  file.write( out.str( ).c_str( ), out.str( ).size( ) );
-  file.close( );
-}
-
-#endif // __FPA__IO__MINIMUMSPANNINGTREEWRITER__HXX__
-
-// eof - $RCSfile$