1 #include "bbSlicerForegroundmaskingBRAINS.h"
2 #include "bbSlicerPackage.h"
5 BBTK_ADD_BLACK_BOX_TO_PACKAGE ( Slicer, ForegroundmaskingBRAINS )
6 BBTK_BLACK_BOX_IMPLEMENTATION ( ForegroundmaskingBRAINS, bbtk::AtomicBlackBox );
8 void ForegroundmaskingBRAINS::Process ( ) {
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 ") ) };
25 this->execute( lib, _argc, _argv );
29 void ForegroundmaskingBRAINS::execute ( std::string lib, int _argc, char * _argv[] ) {
30 void* handle = dlopen( lib.c_str( ), RTLD_NOW | RTLD_GLOBAL );
32 std::cerr << "CAN'T OPEN LIBRARY: " << dlerror( ) << '\n';
35 typedef int (*method_t )( int argc, char * argv[] );
39 method_t myMethod = ( method_t ) dlsym( handle, "ModuleEntryPoint" );
40 const char *dlsym_error = dlerror( );
42 std::cerr << "CAN'T LOAD SYMBOL 'ModuleEntryPoint':" << dlsym_error << '\n';
47 myMethod( _argc, _argv );
52 void ForegroundmaskingBRAINS::bbUserSetDefaultValues ( ) {
55 void ForegroundmaskingBRAINS::bbUserInitializeProcessing ( ) {
58 void ForegroundmaskingBRAINS::bbUserFinalizeProcessing ( ) {
61 // EO namespace bbSlicer