X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=bbtk_Slicer_PKG%2Fsrc%2FbbSlicerGeneralRegistrationBRAINS.cxx;fp=bbtk_Slicer_PKG%2Fsrc%2FbbSlicerGeneralRegistrationBRAINS.cxx;h=43a0846b66414c6f038324bed94da30bb98cd152;hb=e7b4e2c9254e9e431f74acc92e3f0d40fc5e7ef6;hp=0000000000000000000000000000000000000000;hpb=cd590ce5fff20d69c7060340235a35e9c2a9ef86;p=creaCLI.git diff --git a/bbtk_Slicer_PKG/src/bbSlicerGeneralRegistrationBRAINS.cxx b/bbtk_Slicer_PKG/src/bbSlicerGeneralRegistrationBRAINS.cxx new file mode 100644 index 0000000..43a0846 --- /dev/null +++ b/bbtk_Slicer_PKG/src/bbSlicerGeneralRegistrationBRAINS.cxx @@ -0,0 +1,114 @@ +#include "bbSlicerGeneralRegistrationBRAINS.h" +#include "bbSlicerPackage.h" + +namespace bbSlicer { + BBTK_ADD_BLACK_BOX_TO_PACKAGE ( Slicer, GeneralRegistrationBRAINS ) + BBTK_BLACK_BOX_IMPLEMENTATION ( GeneralRegistrationBRAINS, bbtk::AtomicBlackBox ); + + void GeneralRegistrationBRAINS::Process ( ) { + + // GENERATED + +int _argc =60; +std::string lib = "/home/riveros/.slicer/Slicer4-bin/Slicer-build/lib/Slicer-4.0/cli-modules/libBRAINSFitLib.so"; +char * _argv[ ] = { Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--fixedVolume" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputfixedVolume( ) ) ) ,"@@@@@"," --fixedVolume ") ), +Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--movingVolume" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputmovingVolume( ) ) ) ,"@@@@@"," --movingVolume ") ), +Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--bsplineTransform" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputbsplineTransform( ) ) ) ,"@@@@@"," --bsplineTransform ") ), +Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--linearTransform" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputlinearTransform( ) ) ) ,"@@@@@"," --linearTransform ") ), +Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--outputVolume" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputoutputVolume( ) ) ) ,"@@@@@"," --outputVolume ") ), +Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--initialTransform" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputinitialTransform( ) ) ) ,"@@@@@"," --initialTransform ") ), +Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--initializeTransformMode" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputinitializeTransformMode( ) ) ) ,"@@@@@"," --initializeTransformMode ") ), +Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--useRigid" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputuseRigid( ) ) ) ,"@@@@@"," --useRigid ") ), +Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--useScaleVersor3D" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputuseScaleVersor3D( ) ) ) ,"@@@@@"," --useScaleVersor3D ") ), +Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--useScaleSkewVersor3D" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputuseScaleSkewVersor3D( ) ) ) ,"@@@@@"," --useScaleSkewVersor3D ") ), +Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--useAffine" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputuseAffine( ) ) ) ,"@@@@@"," --useAffine ") ), +Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--useBSpline" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputuseBSpline( ) ) ) ,"@@@@@"," --useBSpline ") ), +Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--numberOfSamples" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputnumberOfSamples( ) ) ) ,"@@@@@"," --numberOfSamples ") ), +Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--splineGridSize" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputsplineGridSize( ) ) ) ,"@@@@@"," --splineGridSize ") ), +Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--numberOfIterations" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputnumberOfIterations( ) ) ) ,"@@@@@"," --numberOfIterations ") ), +Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--maskProcessingMode" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputmaskProcessingMode( ) ) ) ,"@@@@@"," --maskProcessingMode ") ), +Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--fixedBinaryVolume" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputfixedBinaryVolume( ) ) ) ,"@@@@@"," --fixedBinaryVolume ") ), +Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--movingBinaryVolume" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputmovingBinaryVolume( ) ) ) ,"@@@@@"," --movingBinaryVolume ") ), +Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--outputFixedVolumeROI" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputoutputFixedVolumeROI( ) ) ) ,"@@@@@"," --outputFixedVolumeROI ") ), +Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--outputMovingVolumeROI" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputoutputMovingVolumeROI( ) ) ) ,"@@@@@"," --outputMovingVolumeROI ") ), +Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--outputVolumePixelType" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputoutputVolumePixelType( ) ) ) ,"@@@@@"," --outputVolumePixelType ") ), +Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--backgroundFillValue" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputbackgroundFillValue( ) ) ) ,"@@@@@"," --backgroundFillValue ") ), +Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--maskInferiorCutOffFromCenter" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputmaskInferiorCutOffFromCenter( ) ) ) ,"@@@@@"," --maskInferiorCutOffFromCenter ") ), +Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--scaleOutputValues" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputscaleOutputValues( ) ) ) ,"@@@@@"," --scaleOutputValues ") ), +Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--interpolationMode" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputinterpolationMode( ) ) ) ,"@@@@@"," --interpolationMode ") ), +Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--minimumStepLength" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputminimumStepLength( ) ) ) ,"@@@@@"," --minimumStepLength ") ), +Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--translationScale" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputtranslationScale( ) ) ) ,"@@@@@"," --translationScale ") ), +Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--reproportionScale" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputreproportionScale( ) ) ) ,"@@@@@"," --reproportionScale ") ), +Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--skewScale" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputskewScale( ) ) ) ,"@@@@@"," --skewScale ") ), +Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--maxBSplineDisplacement" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputmaxBSplineDisplacement( ) ) ) ,"@@@@@"," --maxBSplineDisplacement ") ), +Mthd::Aux::toCharArrray( Mthd::Aux::toString( "-e" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputhistogramMatch( ) ) ) ,"@@@@@"," -e ") ), +Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--numberOfHistogramBins" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputnumberOfHistogramBins( ) ) ) ,"@@@@@"," --numberOfHistogramBins ") ), +Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--numberOfMatchPoints" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputnumberOfMatchPoints( ) ) ) ,"@@@@@"," --numberOfMatchPoints ") ), +Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--strippedOutputTransform" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputstrippedOutputTransform( ) ) ) ,"@@@@@"," --strippedOutputTransform ") ), +Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--transformType" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputtransformType( ) ) ) ,"@@@@@"," --transformType ") ), +Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--outputTransform" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputoutputTransform( ) ) ) ,"@@@@@"," --outputTransform ") ), +Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--fixedVolumeTimeIndex" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputfixedVolumeTimeIndex( ) ) ) ,"@@@@@"," --fixedVolumeTimeIndex ") ), +Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--movingVolumeTimeIndex" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputmovingVolumeTimeIndex( ) ) ) ,"@@@@@"," --movingVolumeTimeIndex ") ), +Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--medianFilterSize" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputmedianFilterSize( ) ) ) ,"@@@@@"," --medianFilterSize ") ), +Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--removeIntensityOutliers" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputremoveIntensityOutliers( ) ) ) ,"@@@@@"," --removeIntensityOutliers ") ), +Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--useCachingOfBSplineWeightsMode" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputuseCachingOfBSplineWeightsMode( ) ) ) ,"@@@@@"," --useCachingOfBSplineWeightsMode ") ), +Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--useExplicitPDFDerivativesMode" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputuseExplicitPDFDerivativesMode( ) ) ) ,"@@@@@"," --useExplicitPDFDerivativesMode ") ), +Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--ROIAutoDilateSize" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputROIAutoDilateSize( ) ) ) ,"@@@@@"," --ROIAutoDilateSize ") ), +Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--ROIAutoClosingSize" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputROIAutoClosingSize( ) ) ) ,"@@@@@"," --ROIAutoClosingSize ") ), +Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--relaxationFactor" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputrelaxationFactor( ) ) ) ,"@@@@@"," --relaxationFactor ") ), +Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--maximumStepLength" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputmaximumStepLength( ) ) ) ,"@@@@@"," --maximumStepLength ") ), +Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--failureExitCode" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputfailureExitCode( ) ) ) ,"@@@@@"," --failureExitCode ") ), +Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--writeTransformOnFailure" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputwriteTransformOnFailure( ) ) ) ,"@@@@@"," --writeTransformOnFailure ") ), +Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--numberOfThreads" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputnumberOfThreads( ) ) ) ,"@@@@@"," --numberOfThreads ") ), +Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--forceMINumberOfThreads" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputforceMINumberOfThreads( ) ) ) ,"@@@@@"," --forceMINumberOfThreads ") ), +Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--debugLevel" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputdebugLevel( ) ) ) ,"@@@@@"," --debugLevel ") ), +Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--costFunctionConvergenceFactor" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputcostFunctionConvergenceFactor( ) ) ) ,"@@@@@"," --costFunctionConvergenceFactor ") ), +Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--projectedGradientTolerance" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputprojectedGradientTolerance( ) ) ) ,"@@@@@"," --projectedGradientTolerance ") ), +Mthd::Aux::toCharArrray( Mthd::Aux::toString( "-G" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputUseDebugImageViewer( ) ) ) ,"@@@@@"," -G ") ), +Mthd::Aux::toCharArrray( Mthd::Aux::toString( "-p" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputPromptAfterImageSend( ) ) ) ,"@@@@@"," -p ") ), +Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--NEVER_USE_THIS_FLAG_IT_IS_OUTDATED_00" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputuseMomentsAlign( ) ) ) ,"@@@@@"," --NEVER_USE_THIS_FLAG_IT_IS_OUTDATED_00 ") ), +Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--NEVER_USE_THIS_FLAG_IT_IS_OUTDATED_01" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputuseGeometryAlign( ) ) ) ,"@@@@@"," --NEVER_USE_THIS_FLAG_IT_IS_OUTDATED_01 ") ), +Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--NEVER_USE_THIS_FLAG_IT_IS_OUTDATED_02" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputuseCenterOfHeadAlign( ) ) ) ,"@@@@@"," --NEVER_USE_THIS_FLAG_IT_IS_OUTDATED_02 ") ), +Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--permitParameterVariation" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputpermitParameterVariation( ) ) ) ,"@@@@@"," --permitParameterVariation ") ), +Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--costMetric" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputcostMetric( ) ) ) ,"@@@@@"," --costMetric ") ) }; + + // EO GENERATED + this->execute( lib, _argc, _argv ); + + } + + void GeneralRegistrationBRAINS::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 GeneralRegistrationBRAINS::bbUserSetDefaultValues ( ) { + } + + void GeneralRegistrationBRAINS::bbUserInitializeProcessing ( ) { + } + + void GeneralRegistrationBRAINS::bbUserFinalizeProcessing ( ) { + } +} +// EO namespace bbSlicer + +