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::replace_str ( ( Mthd::Aux::toString( bbGetInputInputImage( ) ) ) ,"@@@@@"," --inputImage ") ),
15 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--inputMask" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputInputMask( ) ) ) ,"@@@@@"," --inputMask ") ),
16 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--outputImage" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputOutputImage( ) ) ) ,"@@@@@"," --outputImage ") ),
17 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--algorithmType" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputAlgorithmType( ) ) ) ,"@@@@@"," --algorithmType ") ),
18 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--shrinkFactor" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputShrinkFactor( ) ) ) ,"@@@@@"," --shrinkFactor ") ),
19 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--maximumNumberOfIterations" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputMaximumNumberOfIterations( ) ) ) ,"@@@@@"," --maximumNumberOfIterations ") ),
20 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--numberOfFittingLevels" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputNumberOfFittingLevels( ) ) ) ,"@@@@@"," --numberOfFittingLevels ") ),
21 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--wienerFilterNoise" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputWienerFilterNoise( ) ) ) ,"@@@@@"," --wienerFilterNoise ") ),
22 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--fullWidthAtHalfMaximum" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputFullWidthAtHalfMaximum( ) ) ) ,"@@@@@"," --fullWidthAtHalfMaximum ") ),
23 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--convergenceThreshold" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputConvergenceThreshold( ) ) ) ,"@@@@@"," --convergenceThreshold ") ) };
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