1 #include "bbSlicerMaskImage.h"
2 #include "bbSlicerPackage.h"
5 BBTK_ADD_BLACK_BOX_TO_PACKAGE ( Slicer, MaskImage )
6 BBTK_BLACK_BOX_IMPLEMENTATION ( MaskImage, bbtk::AtomicBlackBox );
8 void MaskImage::Process ( ) {
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 ") ) };
21 this->execute( lib, _argc, _argv );
25 void MaskImage::execute ( std::string lib, int _argc, char * _argv[] ) {
26 void* handle = dlopen( lib.c_str( ), RTLD_NOW | RTLD_GLOBAL );
28 std::cerr << "CAN'T OPEN LIBRARY: " << dlerror( ) << '\n';
31 typedef int (*method_t )( int argc, char * argv[] );
35 method_t myMethod = ( method_t ) dlsym( handle, "ModuleEntryPoint" );
36 const char *dlsym_error = dlerror( );
38 std::cerr << "CAN'T LOAD SYMBOL 'ModuleEntryPoint':" << dlsym_error << '\n';
43 myMethod( _argc, _argv );
48 void MaskImage::bbUserSetDefaultValues ( ) {
51 void MaskImage::bbUserInitializeProcessing ( ) {
54 void MaskImage::bbUserFinalizeProcessing ( ) {
57 // EO namespace bbSlicer