]> Creatis software - FrontAlgorithms.git/blobdiff - lib/fpa/Image/SkeletonReader.hxx
...
[FrontAlgorithms.git] / lib / fpa / Image / SkeletonReader.hxx
diff --git a/lib/fpa/Image/SkeletonReader.hxx b/lib/fpa/Image/SkeletonReader.hxx
deleted file mode 100644 (file)
index 95e93fb..0000000
+++ /dev/null
@@ -1,209 +0,0 @@
-// =========================================================================
-// @author Leonardo Florez Valencia
-// @email florez-l@javeriana.edu.co
-// =========================================================================
-
-#ifndef __fpa__Image__SkeletonReader__hxx__
-#define __fpa__Image__SkeletonReader__hxx__
-
-// -------------------------------------------------------------------------
-template< class _TSkeleton >
-_TSkeleton* fpa::Image::SkeletonReader< _TSkeleton >::
-GetOutput( )
-{
-  return(
-    itkDynamicCastInDebugMode< TSkeleton* >( this->GetPrimaryOutput( ) )
-    );
-}
-
-// -------------------------------------------------------------------------
-template< class _TSkeleton >
-_TSkeleton* fpa::Image::SkeletonReader< _TSkeleton >::
-GetOutput( unsigned int i )
-{
-  return(
-    itkDynamicCastInDebugMode< TSkeleton* >(
-      this->itk::ProcessObject::GetOutput( i )
-      )
-    );
-}
-
-// -------------------------------------------------------------------------
-template< class _TSkeleton >
-void fpa::Image::SkeletonReader< _TSkeleton >::
-GraftOutput( itk::DataObject* out )
-{
-  this->GraftNthOutput( 0, out );
-}
-
-// -------------------------------------------------------------------------
-template< class _TSkeleton >
-void fpa::Image::SkeletonReader< _TSkeleton >::
-GraftOutput(
-  const typename Superclass::DataObjectIdentifierType& key,
-  itk::DataObject* out
-  )
-{
-  if( out == NULL )
-  {
-    itkExceptionMacro(
-      << "Requested to graft output that is a NULL pointer"
-      );
-
-  } // fi
-  itk::DataObject* output = this->itk::ProcessObject::GetOutput( key );
-  output->Graft( out );
-}
-
-// -------------------------------------------------------------------------
-template< class _TSkeleton >
-void fpa::Image::SkeletonReader< _TSkeleton >::
-GraftNthOutput( unsigned int i, itk::DataObject* out )
-{
-  if( i >= this->GetNumberOfIndexedOutputs( ) )
-  {
-    itkExceptionMacro(
-      << "Requested to graft output " << i
-      << " but this filter only has "
-      << this->GetNumberOfIndexedOutputs( )
-      << " indexed Outputs."
-      );
-
-  } // fi
-  this->GraftOutput( this->MakeNameFromOutputIndex( i ), out );
-}
-
-// -------------------------------------------------------------------------
-template< class _TSkeleton >
-itk::DataObject::Pointer
-fpa::Image::SkeletonReader< _TSkeleton >::
-MakeOutput( itk::ProcessObject::DataObjectPointerArraySizeType i )
-{
-  return( TSkeleton::New( ).GetPointer( ) );
-}
-
-// -------------------------------------------------------------------------
-template< class _TSkeleton >
-fpa::Image::SkeletonReader< _TSkeleton >::
-SkeletonReader( )
-  : Superclass( )
-{
-  typename TSkeleton::Pointer out =
-    static_cast< TSkeleton* >( this->MakeOutput( 0 ).GetPointer( ) );
-  this->itk::ProcessObject::SetNumberOfRequiredInputs( 0 );
-  this->itk::ProcessObject::SetNumberOfRequiredOutputs( 1 );
-  this->itk::ProcessObject::SetNthOutput( 0, out.GetPointer( ) );
-}
-
-// -------------------------------------------------------------------------
-template< class _TSkeleton >
-fpa::Image::SkeletonReader< _TSkeleton >::
-~SkeletonReader( )
-{
-}
-
-// -------------------------------------------------------------------------
-template< class _TSkeleton >
-void fpa::Image::SkeletonReader< _TSkeleton >::
-GenerateData( )
-{
-  typedef typename TSkeleton::TPath   _TPath;
-  typedef typename _TPath::TIndex     _TIndex;
-  typedef typename _TPath::TSpacing   _TSpacing;
-  typedef typename _TPath::TPoint     _TPoint;
-  typedef typename _TPath::TDirection _TDirection;
-
-  std::string buffer;
-  std::ifstream file_stream( this->m_FileName.c_str( ) );
-  if( !file_stream )
-  {
-    itkExceptionMacro(
-      << "Error reading skeleton from \"" << this->m_FileName << "\""
-      );
-    return;
-
-  } // fi
-  file_stream.seekg( 0, std::ios::end );
-  buffer.reserve( ( unsigned int )( file_stream.tellg( ) ) );
-  file_stream.seekg( 0, std::ios::beg );
-  buffer.assign(
-    ( std::istreambuf_iterator< char >( file_stream ) ),
-    std::istreambuf_iterator< char >( )
-    );
-  file_stream.close( );
-
-  std::istringstream in( buffer );
-  unsigned int dim;
-  in >> dim;
-  if( dim != TSkeleton::Dimension )
-  {
-    itkExceptionMacro(
-      << "Mismatched skeletons dimension: " << dim
-      << " != " << TSkeleton::Dimension
-      );
-    return;
-
-  } // fi
-
-  // Read spatial parameters
-  _TSpacing spa;
-  _TDirection dir;
-  _TPoint ori;
-  for( unsigned int d = 0; d < dim; ++d )
-    in >> spa[ d ];
-  for( unsigned int d = 0; d < dim; ++d )
-    for( unsigned int e = 0; e < dim; ++e )
-      in >> dir[ d ][ e ];
-  for( unsigned int d = 0; d < dim; ++d )
-    in >> ori[ d ];
-
-  // Read end-points, just to ignore
-  unsigned int n;
-  in >> n;
-  for( unsigned int i = 0; i < n; ++i )
-  {
-    _TIndex idx;
-    for( unsigned int d = 0; d < dim; ++d )
-      in >> idx[ d ];
-
-  } // rof
-
-  // Read bifurcations, just to ignore
-  in >> n;
-  for( unsigned int i = 0; i < n; ++i )
-  {
-    _TIndex idx;
-    for( unsigned int d = 0; d < dim; ++d )
-      in >> idx[ d ];
-
-  } // rof
-
-  // Read paths
-  TSkeleton* out = this->GetOutput( );
-  unsigned int nPaths;
-  in >> nPaths;
-  for( unsigned int p = 0; p < nPaths; ++p )
-  {
-    typename _TPath::Pointer path = _TPath::New( );
-    path->SetSpacing( spa );
-    path->SetOrigin( ori );
-    path->SetDirection( dir );
-
-    unsigned long pathSize;
-    in >> pathSize;
-    for( unsigned long id = 0; id < pathSize; ++id )
-    {
-      _TIndex idx;
-      for( unsigned int d = 0; d < dim; ++d )
-        in >> idx[ d ];
-      path->AddVertex( idx );
-
-    } // rof
-    out->AddBranch( path );
-
-  } // rof
-}
-
-#endif // __fpa__Image__SkeletonReader__hxx__
-
-// eof - $RCSfile$