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