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