1 #include "bbSlicerOtsuThresholdSegmentation.h"
2 #include "bbSlicerPackage.h"
5 BBTK_ADD_BLACK_BOX_TO_PACKAGE ( Slicer, OtsuThresholdSegmentation )
6 BBTK_BLACK_BOX_IMPLEMENTATION ( OtsuThresholdSegmentation, bbtk::AtomicBlackBox );
8 void OtsuThresholdSegmentation::Process ( ) {
13 std::string lib = "/home/riveros/.slicer/Slicer4-bin/Slicer-build/lib/Slicer-4.0/cli-modules/libOtsuThresholdSegmentationLib.so";
14 char * _argv[ ] = { Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--brightObjects" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputbrightObjects( ) ) ) ,"@@@@@"," --brightObjects ") ),
15 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--numberOfBins" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputnumberOfBins( ) ) ) ,"@@@@@"," --numberOfBins ") ),
16 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--faceConnected" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputfaceConnected( ) ) ) ,"@@@@@"," --faceConnected ") ),
17 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--minimumObjectSize" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputminimumObjectSize( ) ) ) ,"@@@@@"," --minimumObjectSize ") ),
18 Mthd::Aux::toCharArrray( Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputinputVolume( ) ) ) ,"@@@@@","") ),
19 Mthd::Aux::toCharArrray( Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputoutputVolume( ) ) ) ,"@@@@@","") ) };
22 this->execute( lib, _argc, _argv );
26 void OtsuThresholdSegmentation::execute ( std::string lib, int _argc, char * _argv[] ) {
27 void* handle = dlopen( lib.c_str( ), RTLD_NOW | RTLD_GLOBAL );
29 std::cerr << "CAN'T OPEN LIBRARY: " << dlerror( ) << '\n';
32 typedef int (*method_t )( int argc, char * argv[] );
36 method_t myMethod = ( method_t ) dlsym( handle, "ModuleEntryPoint" );
37 const char *dlsym_error = dlerror( );
39 std::cerr << "CAN'T LOAD SYMBOL 'ModuleEntryPoint':" << dlsym_error << '\n';
44 myMethod( _argc, _argv );
49 void OtsuThresholdSegmentation::bbUserSetDefaultValues ( ) {
52 void OtsuThresholdSegmentation::bbUserInitializeProcessing ( ) {
55 void OtsuThresholdSegmentation::bbUserFinalizeProcessing ( ) {
58 // EO namespace bbSlicer