]> Creatis software - creaCLI.git/blob - bbtk_Slicer_PKG/src/bbSlicerDicomtoNrrdConverter.cxx
All Slicer modules succesfully compiled into BBTK boxes :P
[creaCLI.git] / bbtk_Slicer_PKG / src / bbSlicerDicomtoNrrdConverter.cxx
1 #include "bbSlicerDicomtoNrrdConverter.h"
2 #include "bbSlicerPackage.h"
3
4 namespace bbSlicer {
5     BBTK_ADD_BLACK_BOX_TO_PACKAGE ( Slicer, DicomtoNrrdConverter )
6     BBTK_BLACK_BOX_IMPLEMENTATION ( DicomtoNrrdConverter, bbtk::AtomicBlackBox );
7
8     void DicomtoNrrdConverter::Process ( ) {
9
10         // GENERATED
11
12 int _argc =7;
13 std::string lib = "/home/riveros/.slicer/Slicer4-bin/Slicer-build/lib/Slicer-4.0/cli-modules/libDicomToNrrdConverterLib.so";
14 char * _argv[ ] = { Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--inputDicomDirectory"  ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputinputDicomDirectory( ) ) ) ,"@@@@@"," --inputDicomDirectory ") ),
15 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--outputDirectory"  ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputoutputDirectory( ) ) ) ,"@@@@@"," --outputDirectory ") ),
16 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--outputVolume"  ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputoutputVolume( ) ) ) ,"@@@@@"," --outputVolume ") ),
17 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--smallGradientThreshold"  ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputsmallGradientThreshold( ) ) ) ,"@@@@@"," --smallGradientThreshold ") ),
18 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--writeProtocolGradientsFile"  ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputwriteProtocolGradientsFile( ) ) ) ,"@@@@@"," --writeProtocolGradientsFile ") ),
19 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--useIdentityMeaseurementFrame"  ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputuseIdentityMeaseurementFrame( ) ) ) ,"@@@@@"," --useIdentityMeaseurementFrame ") ),
20 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--useBMatrixGradientDirections"  ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputuseBMatrixGradientDirections( ) ) ) ,"@@@@@"," --useBMatrixGradientDirections ") ) };
21
22         // EO GENERATED
23         this->execute( lib, _argc, _argv );
24
25     }
26
27     void DicomtoNrrdConverter::execute ( std::string lib, int _argc, char * _argv[] ) {
28         void* handle = dlopen( lib.c_str( ), RTLD_NOW | RTLD_GLOBAL );
29         if ( ! handle ) {
30             std::cerr << "CAN'T OPEN LIBRARY: " << dlerror( ) << '\n';
31             return;
32         }
33         typedef int (*method_t )( int argc, char * argv[] );
34         // RESET ERROR
35         dlerror( );
36         // PROTOTYPE
37         method_t myMethod = ( method_t ) dlsym( handle, "ModuleEntryPoint" );
38         const char *dlsym_error = dlerror( );
39         if ( dlsym_error ) {
40             std::cerr << "CAN'T LOAD SYMBOL 'ModuleEntryPoint':" << dlsym_error << '\n';
41             dlclose( handle );
42             return;
43         }
44         // METHOD CALL
45         myMethod( _argc, _argv );
46         // CLOSING LIB
47         dlclose( handle );
48     }
49
50     void DicomtoNrrdConverter::bbUserSetDefaultValues ( ) {
51     }
52
53     void DicomtoNrrdConverter::bbUserInitializeProcessing ( ) {
54     }
55
56     void DicomtoNrrdConverter::bbUserFinalizeProcessing ( ) {
57     }
58 }
59 // EO namespace bbSlicer
60
61