]> Creatis software - creaCLI.git/blob - bbtk_Slicer_PKG/src/bbSlicerModelMaker.cxx
All Slicer modules succesfully compiled into BBTK boxes :P
[creaCLI.git] / bbtk_Slicer_PKG / src / bbSlicerModelMaker.cxx
1 #include "bbSlicerModelMaker.h"
2 #include "bbSlicerPackage.h"
3
4 namespace bbSlicer {
5     BBTK_ADD_BLACK_BOX_TO_PACKAGE ( Slicer, ModelMaker )
6     BBTK_BLACK_BOX_IMPLEMENTATION ( ModelMaker, bbtk::AtomicBlackBox );
7
8     void ModelMaker::Process ( ) {
9
10         // GENERATED
11
12 int _argc =18;
13 std::string lib = "/home/riveros/.slicer/Slicer4-bin/Slicer-build/lib/Slicer-4.0/cli-modules/libModelMakerLib.so";
14 char * _argv[ ] = { Mthd::Aux::toCharArrray( Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputInputVolume( ) ) ) ,"@@@@@","") ),
15 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--color"  ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputColorTable( ) ) ) ,"@@@@@"," --color ") ),
16 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--modelSceneFile"  ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputModelSceneFile( ) ) ) ,"@@@@@"," --modelSceneFile ") ),
17 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "-n"  ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputName( ) ) ) ,"@@@@@"," -n ") ),
18 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--generateAll"  ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputGenerateAll( ) ) ) ,"@@@@@"," --generateAll ") ),
19 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "-l"  ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputLabels( ) ) ) ,"@@@@@"," -l ") ),
20 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "-s"  ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputStartLabel( ) ) ) ,"@@@@@"," -s ") ),
21 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "-e"  ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputEndLabel( ) ) ) ,"@@@@@"," -e ") ),
22 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--skipUnNamed"  ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputSkipUnNamed( ) ) ) ,"@@@@@"," --skipUnNamed ") ),
23 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "-j"  ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputJointSmoothing( ) ) ) ,"@@@@@"," -j ") ),
24 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--smooth"  ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputSmooth( ) ) ) ,"@@@@@"," --smooth ") ),
25 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--filtertype"  ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputFilterType( ) ) ) ,"@@@@@"," --filtertype ") ),
26 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--decimate"  ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputDecimate( ) ) ) ,"@@@@@"," --decimate ") ),
27 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--splitnormals"  ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputSplitNormals( ) ) ) ,"@@@@@"," --splitnormals ") ),
28 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--pointnormals"  ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputPointNormals( ) ) ) ,"@@@@@"," --pointnormals ") ),
29 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--pad"  ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputPad( ) ) ) ,"@@@@@"," --pad ") ),
30 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--saveIntermediateModels"  ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputSaveIntermediateModels( ) ) ) ,"@@@@@"," --saveIntermediateModels ") ),
31 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "-d"  ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputdebug( ) ) ) ,"@@@@@"," -d ") ) };
32
33         // EO GENERATED
34         this->execute( lib, _argc, _argv );
35
36     }
37
38     void ModelMaker::execute ( std::string lib, int _argc, char * _argv[] ) {
39         void* handle = dlopen( lib.c_str( ), RTLD_NOW | RTLD_GLOBAL );
40         if ( ! handle ) {
41             std::cerr << "CAN'T OPEN LIBRARY: " << dlerror( ) << '\n';
42             return;
43         }
44         typedef int (*method_t )( int argc, char * argv[] );
45         // RESET ERROR
46         dlerror( );
47         // PROTOTYPE
48         method_t myMethod = ( method_t ) dlsym( handle, "ModuleEntryPoint" );
49         const char *dlsym_error = dlerror( );
50         if ( dlsym_error ) {
51             std::cerr << "CAN'T LOAD SYMBOL 'ModuleEntryPoint':" << dlsym_error << '\n';
52             dlclose( handle );
53             return;
54         }
55         // METHOD CALL
56         myMethod( _argc, _argv );
57         // CLOSING LIB
58         dlclose( handle );
59     }
60
61     void ModelMaker::bbUserSetDefaultValues ( ) {
62     }
63
64     void ModelMaker::bbUserInitializeProcessing ( ) {
65     }
66
67     void ModelMaker::bbUserFinalizeProcessing ( ) {
68     }
69 }
70 // EO namespace bbSlicer
71
72