]> Creatis software - creaCLI.git/blob - bbtk_Slicer_PKG/src/bbSlicerOrientImages.cxx
All Slicer modules succesfully compiled into BBTK boxes :P
[creaCLI.git] / bbtk_Slicer_PKG / src / bbSlicerOrientImages.cxx
1 #include "bbSlicerOrientImages.h"
2 #include "bbSlicerPackage.h"
3
4 namespace bbSlicer {
5     BBTK_ADD_BLACK_BOX_TO_PACKAGE ( Slicer, OrientImages )
6     BBTK_BLACK_BOX_IMPLEMENTATION ( OrientImages, bbtk::AtomicBlackBox );
7
8     void OrientImages::Process ( ) {
9
10         // GENERATED
11
12 int _argc =3;
13 std::string lib = "/home/riveros/.slicer/Slicer4-bin/Slicer-build/lib/Slicer-4.0/cli-modules/libOrientImageLib.so";
14 char * _argv[ ] = { Mthd::Aux::toCharArrray( Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputinputVolume1( ) ) ) ,"@@@@@","") ),
15 Mthd::Aux::toCharArrray( Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputoutputVolume( ) ) ) ,"@@@@@","") ),
16 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "-o"  ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputorientation( ) ) ) ,"@@@@@"," -o ") ) };
17
18         // EO GENERATED
19         this->execute( lib, _argc, _argv );
20
21     }
22
23     void OrientImages::execute ( std::string lib, int _argc, char * _argv[] ) {
24         void* handle = dlopen( lib.c_str( ), RTLD_NOW | RTLD_GLOBAL );
25         if ( ! handle ) {
26             std::cerr << "CAN'T OPEN LIBRARY: " << dlerror( ) << '\n';
27             return;
28         }
29         typedef int (*method_t )( int argc, char * argv[] );
30         // RESET ERROR
31         dlerror( );
32         // PROTOTYPE
33         method_t myMethod = ( method_t ) dlsym( handle, "ModuleEntryPoint" );
34         const char *dlsym_error = dlerror( );
35         if ( dlsym_error ) {
36             std::cerr << "CAN'T LOAD SYMBOL 'ModuleEntryPoint':" << dlsym_error << '\n';
37             dlclose( handle );
38             return;
39         }
40         // METHOD CALL
41         myMethod( _argc, _argv );
42         // CLOSING LIB
43         dlclose( handle );
44     }
45
46     void OrientImages::bbUserSetDefaultValues ( ) {
47     }
48
49     void OrientImages::bbUserInitializeProcessing ( ) {
50     }
51
52     void OrientImages::bbUserFinalizeProcessing ( ) {
53     }
54 }
55 // EO namespace bbSlicer
56
57