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