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