]> Creatis software - cpPlugins.git/blob - appli/examples/ReadRawFile_01.cxx
Moved to version 1.0
[cpPlugins.git] / appli / examples / ReadRawFile_01.cxx
1 // =========================================================================
2 // @author Leonardo Florez-Valencia (florez-l@javeriana.edu.co)
3 // =========================================================================
4
5 #include <iostream>
6 #include <cpPlugins/DataObject.h>
7 #include <cpPlugins/Filter.h>
8 #include <cpPlugins/Pipeline.h>
9
10 int main( int argc, char* argv[] )
11 {
12   typedef cpPlugins::Pipeline TPipeline;
13   typedef cpPlugins::Filter   TFilter;
14
15   if( argc != 2 )
16   {
17     std::cerr << "Usage: " << argv[ 0 ] << " file" << std::endl;
18     return( 1 );
19   } // end if
20
21   try
22   {
23     TPipeline::SharedPtr pipeline = TPipeline::New( );
24     TFilter* reader =
25       pipeline->CreateNode( "cpPluginsBase::RawFileReader" )->
26       Cast< TFilter >( );
27     reader->SetInValue( "FileName", std::string( argv[ 1 ] ) );
28     reader->Update( );
29
30     std::cout << *( reader->GetOutput( "Output" ) ) << std::endl;
31   }
32   catch( std::exception& err )
33   {
34     std::cerr << "ERROR CAUGHT: " << err.what( ) << std::endl;
35     return( 1 );
36   } // end try
37   return( 0 );
38 }
39
40 // eof - $RCSfile$