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