]> Creatis software - creaCLI.git/blob - bbtk_Slicer_PKG/src/bbSlicerMRIBiasFieldCorrection.cxx
946408f6d6f6154cf69f162afd48ea99501f36e8
[creaCLI.git] / bbtk_Slicer_PKG / src / bbSlicerMRIBiasFieldCorrection.cxx
1 #include "bbSlicerMRIBiasFieldCorrection.h"
2 #include "bbSlicerPackage.h"
3
4 namespace bbSlicer {
5     BBTK_ADD_BLACK_BOX_TO_PACKAGE ( Slicer, MRIBiasFieldCorrection )
6     BBTK_BLACK_BOX_IMPLEMENTATION ( MRIBiasFieldCorrection, bbtk::AtomicBlackBox );
7
8     void MRIBiasFieldCorrection::Process ( ) {
9
10         // GENERATED
11
12 int _argc =10;
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( ) ) ) };
24
25         // EO GENERATED
26         this->execute( lib, _argc, _argv );
27
28     }
29
30     void MRIBiasFieldCorrection::execute ( std::string lib, int _argc, char * _argv[] ) {
31         void* handle = dlopen( lib.c_str( ), RTLD_NOW | RTLD_GLOBAL );
32         if ( ! handle ) {
33             std::cerr << "CAN'T OPEN LIBRARY: " << dlerror( ) << '\n';
34             return;
35         }
36         typedef int (*method_t )( int argc, char * argv[] );
37         // RESET ERROR
38         dlerror( );
39         // PROTOTYPE
40         method_t myMethod = ( method_t ) dlsym( handle, "ModuleEntryPoint" );
41         const char *dlsym_error = dlerror( );
42         if ( dlsym_error ) {
43             std::cerr << "CAN'T LOAD SYMBOL 'ModuleEntryPoint':" << dlsym_error << '\n';
44             dlclose( handle );
45             return;
46         }
47         // METHOD CALL
48         myMethod( _argc, _argv );
49         // CLOSING LIB
50         dlclose( handle );
51     }
52
53     void MRIBiasFieldCorrection::bbUserSetDefaultValues ( ) {
54     }
55
56     void MRIBiasFieldCorrection::bbUserInitializeProcessing ( ) {
57     }
58
59     void MRIBiasFieldCorrection::bbUserFinalizeProcessing ( ) {
60     }
61 }
62 // EO namespace bbSlicer
63
64