1 #include "bbSlicerMRIBiasFieldCorrection.h"
2 #include "bbSlicerPackage.h"
5 BBTK_ADD_BLACK_BOX_TO_PACKAGE ( Slicer, MRIBiasFieldCorrection )
6 BBTK_BLACK_BOX_IMPLEMENTATION ( MRIBiasFieldCorrection, bbtk::AtomicBlackBox );
8 void MRIBiasFieldCorrection::Process ( ) {
13 std::string lib = "/home/riveros/.slicer/Slicer4-bin/Slicer-build/lib/Slicer-4.0/cli-modules/libMRIBiasFieldCorrectionLib.so";
14 char * _argv[ ] = { Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--inputImage" ) + Mthd::Aux::toString( bbGetInputInputImage( ) ) ),
15 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--inputMask" ) + Mthd::Aux::toString( bbGetInputInputMask( ) ) ),
16 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--outputImage" ) + Mthd::Aux::toString( bbGetInputOutputImage( ) ) ),
17 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--algorithmType" ) + Mthd::Aux::toString( bbGetInputAlgorithmType( ) ) ),
18 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--shrinkFactor" ) + Mthd::Aux::toString( bbGetInputShrinkFactor( ) ) ),
19 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--maximumNumberOfIterations" ) + Mthd::Aux::toString( bbGetInputMaximumNumberOfIterations( ) ) ),
20 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--numberOfFittingLevels" ) + Mthd::Aux::toString( bbGetInputNumberOfFittingLevels( ) ) ),
21 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--wienerFilterNoise" ) + Mthd::Aux::toString( bbGetInputWienerFilterNoise( ) ) ),
22 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--fullWidthAtHalfMaximum" ) + Mthd::Aux::toString( bbGetInputFullWidthAtHalfMaximum( ) ) ),
23 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--convergenceThreshold" ) + Mthd::Aux::toString( bbGetInputConvergenceThreshold( ) ) ) };
26 this->execute( lib, _argc, _argv );
30 void MRIBiasFieldCorrection::execute ( std::string lib, int _argc, char * _argv[] ) {
31 void* handle = dlopen( lib.c_str( ), RTLD_NOW | RTLD_GLOBAL );
33 std::cerr << "CAN'T OPEN LIBRARY: " << dlerror( ) << '\n';
36 typedef int (*method_t )( int argc, char * argv[] );
40 method_t myMethod = ( method_t ) dlsym( handle, "ModuleEntryPoint" );
41 const char *dlsym_error = dlerror( );
43 std::cerr << "CAN'T LOAD SYMBOL 'ModuleEntryPoint':" << dlsym_error << '\n';
48 myMethod( _argc, _argv );
53 void MRIBiasFieldCorrection::bbUserSetDefaultValues ( ) {
56 void MRIBiasFieldCorrection::bbUserInitializeProcessing ( ) {
59 void MRIBiasFieldCorrection::bbUserFinalizeProcessing ( ) {
62 // EO namespace bbSlicer