1 #include "bbSlicerExpertAutomatedRegistration.h"
2 #include "bbSlicerPackage.h"
5 BBTK_ADD_BLACK_BOX_TO_PACKAGE ( Slicer, ExpertAutomatedRegistration )
6 BBTK_BLACK_BOX_IMPLEMENTATION ( ExpertAutomatedRegistration, bbtk::AtomicBlackBox );
8 void ExpertAutomatedRegistration::Process ( ) {
13 std::string lib = "/home/riveros/.slicer/Slicer4-bin/Slicer-build/lib/Slicer-4.0/cli-modules/libRegisterImagesModule.so";
14 char * _argv[ ] = { Mthd::Aux::toCharArrray( Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputfixedImage( ) ) ) ,"@@@@@","") ),
15 Mthd::Aux::toCharArrray( Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputmovingImage( ) ) ) ,"@@@@@","") ),
16 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--resampledImage" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputresampledImage( ) ) ) ,"@@@@@"," --resampledImage ") ),
17 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--loadTransform" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputloadTransform( ) ) ) ,"@@@@@"," --loadTransform ") ),
18 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--saveTransform" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputsaveTransform( ) ) ) ,"@@@@@"," --saveTransform ") ),
19 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--initialization" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputinitialization( ) ) ) ,"@@@@@"," --initialization ") ),
20 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--registration" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputregistration( ) ) ) ,"@@@@@"," --registration ") ),
21 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--metric" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputmetric( ) ) ) ,"@@@@@"," --metric ") ),
22 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--expectedOffset" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputexpectedOffset( ) ) ) ,"@@@@@"," --expectedOffset ") ),
23 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--expectedRotation" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputexpectedRotation( ) ) ) ,"@@@@@"," --expectedRotation ") ),
24 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--expectedScale" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputexpectedScale( ) ) ) ,"@@@@@"," --expectedScale ") ),
25 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--expectedSkew" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputexpectedSkew( ) ) ) ,"@@@@@"," --expectedSkew ") ),
26 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--verbosityLevel" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputverbosityLevel( ) ) ) ,"@@@@@"," --verbosityLevel ") ),
27 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--sampleFromOverlap" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputsampleFromOverlap( ) ) ) ,"@@@@@"," --sampleFromOverlap ") ),
28 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--fixedImageMask" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputfixedImageMask( ) ) ) ,"@@@@@"," --fixedImageMask ") ),
29 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--randomNumberSeed" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputrandomNumberSeed( ) ) ) ,"@@@@@"," --randomNumberSeed ") ),
30 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--numberOfThreads" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputnumberOfThreads( ) ) ) ,"@@@@@"," --numberOfThreads ") ),
31 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--minimizeMemory" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputminimizeMemory( ) ) ) ,"@@@@@"," --minimizeMemory ") ),
32 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--interpolation" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputinterpolation( ) ) ) ,"@@@@@"," --interpolation ") ),
33 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--fixedLandmarks" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputfixedLandmarks( ) ) ) ,"@@@@@"," --fixedLandmarks ") ),
34 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--movingLandmarks" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputmovingLandmarks( ) ) ) ,"@@@@@"," --movingLandmarks ") ),
35 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--rigidMaxIterations" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputrigidMaxIterations( ) ) ) ,"@@@@@"," --rigidMaxIterations ") ),
36 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--rigidSamplingRatio" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputrigidSamplingRatio( ) ) ) ,"@@@@@"," --rigidSamplingRatio ") ),
37 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--affineMaxIterations" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputaffineMaxIterations( ) ) ) ,"@@@@@"," --affineMaxIterations ") ),
38 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--affineSamplingRatio" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputaffineSamplingRatio( ) ) ) ,"@@@@@"," --affineSamplingRatio ") ),
39 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--bsplineMaxIterations" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputbsplineMaxIterations( ) ) ) ,"@@@@@"," --bsplineMaxIterations ") ),
40 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--bsplineSamplingRatio" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputbsplineSamplingRatio( ) ) ) ,"@@@@@"," --bsplineSamplingRatio ") ),
41 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--controlPointSpacing" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputcontrolPointSpacing( ) ) ) ,"@@@@@"," --controlPointSpacing ") ) };
44 this->execute( lib, _argc, _argv );
48 void ExpertAutomatedRegistration::execute ( std::string lib, int _argc, char * _argv[] ) {
49 void* handle = dlopen( lib.c_str( ), RTLD_NOW | RTLD_GLOBAL );
51 std::cerr << "CAN'T OPEN LIBRARY: " << dlerror( ) << '\n';
54 typedef int (*method_t )( int argc, char * argv[] );
58 method_t myMethod = ( method_t ) dlsym( handle, "ModuleEntryPoint" );
59 const char *dlsym_error = dlerror( );
61 std::cerr << "CAN'T LOAD SYMBOL 'ModuleEntryPoint':" << dlsym_error << '\n';
66 myMethod( _argc, _argv );
71 void ExpertAutomatedRegistration::bbUserSetDefaultValues ( ) {
74 void ExpertAutomatedRegistration::bbUserInitializeProcessing ( ) {
77 void ExpertAutomatedRegistration::bbUserFinalizeProcessing ( ) {
80 // EO namespace bbSlicer