X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=bbtk_Slicer_PKG%2Fsrc%2FbbSlicerExpertAutomatedRegistration.cxx;fp=bbtk_Slicer_PKG%2Fsrc%2FbbSlicerExpertAutomatedRegistration.cxx;h=61ea18d9ead03c1c22f8615103bce4766560b5cb;hb=e7b4e2c9254e9e431f74acc92e3f0d40fc5e7ef6;hp=0000000000000000000000000000000000000000;hpb=cd590ce5fff20d69c7060340235a35e9c2a9ef86;p=creaCLI.git diff --git a/bbtk_Slicer_PKG/src/bbSlicerExpertAutomatedRegistration.cxx b/bbtk_Slicer_PKG/src/bbSlicerExpertAutomatedRegistration.cxx new file mode 100644 index 0000000..61ea18d --- /dev/null +++ b/bbtk_Slicer_PKG/src/bbSlicerExpertAutomatedRegistration.cxx @@ -0,0 +1,82 @@ +#include "bbSlicerExpertAutomatedRegistration.h" +#include "bbSlicerPackage.h" + +namespace bbSlicer { + BBTK_ADD_BLACK_BOX_TO_PACKAGE ( Slicer, ExpertAutomatedRegistration ) + BBTK_BLACK_BOX_IMPLEMENTATION ( ExpertAutomatedRegistration, bbtk::AtomicBlackBox ); + + void ExpertAutomatedRegistration::Process ( ) { + + // GENERATED + +int _argc =28; +std::string lib = "/home/riveros/.slicer/Slicer4-bin/Slicer-build/lib/Slicer-4.0/cli-modules/libRegisterImagesModule.so"; +char * _argv[ ] = { Mthd::Aux::toCharArrray( Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputfixedImage( ) ) ) ,"@@@@@","") ), +Mthd::Aux::toCharArrray( Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputmovingImage( ) ) ) ,"@@@@@","") ), +Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--resampledImage" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputresampledImage( ) ) ) ,"@@@@@"," --resampledImage ") ), +Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--loadTransform" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputloadTransform( ) ) ) ,"@@@@@"," --loadTransform ") ), +Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--saveTransform" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputsaveTransform( ) ) ) ,"@@@@@"," --saveTransform ") ), +Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--initialization" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputinitialization( ) ) ) ,"@@@@@"," --initialization ") ), +Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--registration" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputregistration( ) ) ) ,"@@@@@"," --registration ") ), +Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--metric" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputmetric( ) ) ) ,"@@@@@"," --metric ") ), +Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--expectedOffset" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputexpectedOffset( ) ) ) ,"@@@@@"," --expectedOffset ") ), +Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--expectedRotation" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputexpectedRotation( ) ) ) ,"@@@@@"," --expectedRotation ") ), +Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--expectedScale" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputexpectedScale( ) ) ) ,"@@@@@"," --expectedScale ") ), +Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--expectedSkew" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputexpectedSkew( ) ) ) ,"@@@@@"," --expectedSkew ") ), +Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--verbosityLevel" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputverbosityLevel( ) ) ) ,"@@@@@"," --verbosityLevel ") ), +Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--sampleFromOverlap" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputsampleFromOverlap( ) ) ) ,"@@@@@"," --sampleFromOverlap ") ), +Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--fixedImageMask" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputfixedImageMask( ) ) ) ,"@@@@@"," --fixedImageMask ") ), +Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--randomNumberSeed" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputrandomNumberSeed( ) ) ) ,"@@@@@"," --randomNumberSeed ") ), +Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--numberOfThreads" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputnumberOfThreads( ) ) ) ,"@@@@@"," --numberOfThreads ") ), +Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--minimizeMemory" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputminimizeMemory( ) ) ) ,"@@@@@"," --minimizeMemory ") ), +Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--interpolation" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputinterpolation( ) ) ) ,"@@@@@"," --interpolation ") ), +Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--fixedLandmarks" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputfixedLandmarks( ) ) ) ,"@@@@@"," --fixedLandmarks ") ), +Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--movingLandmarks" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputmovingLandmarks( ) ) ) ,"@@@@@"," --movingLandmarks ") ), +Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--rigidMaxIterations" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputrigidMaxIterations( ) ) ) ,"@@@@@"," --rigidMaxIterations ") ), +Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--rigidSamplingRatio" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputrigidSamplingRatio( ) ) ) ,"@@@@@"," --rigidSamplingRatio ") ), +Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--affineMaxIterations" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputaffineMaxIterations( ) ) ) ,"@@@@@"," --affineMaxIterations ") ), +Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--affineSamplingRatio" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputaffineSamplingRatio( ) ) ) ,"@@@@@"," --affineSamplingRatio ") ), +Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--bsplineMaxIterations" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputbsplineMaxIterations( ) ) ) ,"@@@@@"," --bsplineMaxIterations ") ), +Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--bsplineSamplingRatio" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputbsplineSamplingRatio( ) ) ) ,"@@@@@"," --bsplineSamplingRatio ") ), +Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--controlPointSpacing" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputcontrolPointSpacing( ) ) ) ,"@@@@@"," --controlPointSpacing ") ) }; + + // EO GENERATED + this->execute( lib, _argc, _argv ); + + } + + void ExpertAutomatedRegistration::execute ( std::string lib, int _argc, char * _argv[] ) { + void* handle = dlopen( lib.c_str( ), RTLD_NOW | RTLD_GLOBAL ); + if ( ! handle ) { + std::cerr << "CAN'T OPEN LIBRARY: " << dlerror( ) << '\n'; + return; + } + typedef int (*method_t )( int argc, char * argv[] ); + // RESET ERROR + dlerror( ); + // PROTOTYPE + method_t myMethod = ( method_t ) dlsym( handle, "ModuleEntryPoint" ); + const char *dlsym_error = dlerror( ); + if ( dlsym_error ) { + std::cerr << "CAN'T LOAD SYMBOL 'ModuleEntryPoint':" << dlsym_error << '\n'; + dlclose( handle ); + return; + } + // METHOD CALL + myMethod( _argc, _argv ); + // CLOSING LIB + dlclose( handle ); + } + + void ExpertAutomatedRegistration::bbUserSetDefaultValues ( ) { + } + + void ExpertAutomatedRegistration::bbUserInitializeProcessing ( ) { + } + + void ExpertAutomatedRegistration::bbUserFinalizeProcessing ( ) { + } +} +// EO namespace bbSlicer + +