1 #include "bbSlicerResampleDTIVolume.h"
2 #include "bbSlicerPackage.h"
5 BBTK_ADD_BLACK_BOX_TO_PACKAGE ( Slicer, ResampleDTIVolume )
6 BBTK_BLACK_BOX_IMPLEMENTATION ( ResampleDTIVolume, bbtk::AtomicBlackBox );
8 void ResampleDTIVolume::Process ( ) {
13 std::string lib = "/home/riveros/.slicer/Slicer4-bin/Slicer-build/lib/Slicer-4.0/cli-modules/libResampleDTILib.so";
14 char * _argv[ ] = { Mthd::Aux::toCharArrray( Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputinputVolume( ) ) ) ,"@@@@@","") ),
15 Mthd::Aux::toCharArrray( Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputoutputVolume( ) ) ) ,"@@@@@","") ),
16 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "-R" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputreferenceVolume( ) ) ) ,"@@@@@"," -R ") ),
17 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "-f" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputtransformationFile( ) ) ) ,"@@@@@"," -f ") ),
18 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "-H" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputdeffield( ) ) ) ,"@@@@@"," -H ") ),
19 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--hfieldtype" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputtypeOfField( ) ) ) ,"@@@@@"," --hfieldtype ") ),
20 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "-i" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputinterpolationType( ) ) ) ,"@@@@@"," -i ") ),
21 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--correction" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputcorrection( ) ) ) ,"@@@@@"," --correction ") ),
22 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "-T" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputppd( ) ) ) ,"@@@@@"," -T ") ),
23 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--transform_order" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputtransformsOrder( ) ) ) ,"@@@@@"," --transform_order ") ),
24 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--notbulk" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputnotbulk( ) ) ) ,"@@@@@"," --notbulk ") ),
25 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--spaceChange" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputspace( ) ) ) ,"@@@@@"," --spaceChange ") ),
26 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "-r" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputrotationPoint( ) ) ) ,"@@@@@"," -r ") ),
27 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "-c" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputcenteredTransform( ) ) ) ,"@@@@@"," -c ") ),
28 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--image_center" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputimageCenter( ) ) ) ,"@@@@@"," --image_center ") ),
29 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "-b" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputinverseITKTransformation( ) ) ) ,"@@@@@"," -b ") ),
30 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "-s" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputoutputImageSpacing( ) ) ) ,"@@@@@"," -s ") ),
31 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "-z" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputoutputImageSize( ) ) ) ,"@@@@@"," -z ") ),
32 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "-O" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputoutputImageOrigin( ) ) ) ,"@@@@@"," -O ") ),
33 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "-d" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputdirectionMatrix( ) ) ) ,"@@@@@"," -d ") ),
34 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "-n" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputnumberOfThread( ) ) ) ,"@@@@@"," -n ") ),
35 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "-p" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputdefaultPixelValue( ) ) ) ,"@@@@@"," -p ") ),
36 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "-W" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputwindowFunction( ) ) ) ,"@@@@@"," -W ") ),
37 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "-o" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputsplineOrder( ) ) ) ,"@@@@@"," -o ") ),
38 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "-m" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputtransformMatrix( ) ) ) ,"@@@@@"," -m ") ),
39 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "-t" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputtransformType( ) ) ) ,"@@@@@"," -t ") ) };
42 this->execute( lib, _argc, _argv );
46 void ResampleDTIVolume::execute ( std::string lib, int _argc, char * _argv[] ) {
47 void* handle = dlopen( lib.c_str( ), RTLD_NOW | RTLD_GLOBAL );
49 std::cerr << "CAN'T OPEN LIBRARY: " << dlerror( ) << '\n';
52 typedef int (*method_t )( int argc, char * argv[] );
56 method_t myMethod = ( method_t ) dlsym( handle, "ModuleEntryPoint" );
57 const char *dlsym_error = dlerror( );
59 std::cerr << "CAN'T LOAD SYMBOL 'ModuleEntryPoint':" << dlsym_error << '\n';
64 myMethod( _argc, _argv );
69 void ResampleDTIVolume::bbUserSetDefaultValues ( ) {
72 void ResampleDTIVolume::bbUserInitializeProcessing ( ) {
75 void ResampleDTIVolume::bbUserFinalizeProcessing ( ) {
78 // EO namespace bbSlicer