1 #include "bbSlicerHistogramMatching.h"
2 #include "bbSlicerPackage.h"
5 BBTK_ADD_BLACK_BOX_TO_PACKAGE ( Slicer, HistogramMatching )
6 BBTK_BLACK_BOX_IMPLEMENTATION ( HistogramMatching, bbtk::AtomicBlackBox );
8 void HistogramMatching::Process ( ) {
13 std::string lib = "/home/riveros/.slicer/Slicer4-bin/Slicer-build/lib/Slicer-4.0/cli-modules/libHistogramMatchingLib.so";
14 char * _argv[ ] = { Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--numberOfHistogramLevels" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputnumberOfHistogramLevels( ) ) ) ,"@@@@@"," --numberOfHistogramLevels ") ),
15 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--numberOfMatchPoints" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputnumberOfMatchPoints( ) ) ) ,"@@@@@"," --numberOfMatchPoints ") ),
16 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--threshold" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputthresholdAtMeanIntensity( ) ) ) ,"@@@@@"," --threshold ") ),
17 Mthd::Aux::toCharArrray( Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputinputVolume( ) ) ) ,"@@@@@","") ),
18 Mthd::Aux::toCharArrray( Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputreferenceVolume( ) ) ) ,"@@@@@","") ),
19 Mthd::Aux::toCharArrray( Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputoutputVolume( ) ) ) ,"@@@@@","") ) };
22 this->execute( lib, _argc, _argv );
26 void HistogramMatching::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 HistogramMatching::bbUserSetDefaultValues ( ) {
52 void HistogramMatching::bbUserInitializeProcessing ( ) {
55 void HistogramMatching::bbUserFinalizeProcessing ( ) {
58 // EO namespace bbSlicer