1 #include "bbSlicerModelMaker.h"
2 #include "bbSlicerPackage.h"
5 BBTK_ADD_BLACK_BOX_TO_PACKAGE ( Slicer, ModelMaker )
6 BBTK_BLACK_BOX_IMPLEMENTATION ( ModelMaker, bbtk::AtomicBlackBox );
8 void ModelMaker::Process ( ) {
13 std::string lib = "/home/riveros/.slicer/Slicer4-bin/Slicer-build/lib/Slicer-4.0/cli-modules/libModelMakerLib.so";
14 char * _argv[ ] = { Mthd::Aux::toCharArrray( Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputInputVolume( ) ) ) ,"@@@@@","") ),
15 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--color" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputColorTable( ) ) ) ,"@@@@@"," --color ") ),
16 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--modelSceneFile" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputModelSceneFile( ) ) ) ,"@@@@@"," --modelSceneFile ") ),
17 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "-n" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputName( ) ) ) ,"@@@@@"," -n ") ),
18 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--generateAll" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputGenerateAll( ) ) ) ,"@@@@@"," --generateAll ") ),
19 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "-l" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputLabels( ) ) ) ,"@@@@@"," -l ") ),
20 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "-s" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputStartLabel( ) ) ) ,"@@@@@"," -s ") ),
21 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "-e" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputEndLabel( ) ) ) ,"@@@@@"," -e ") ),
22 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--skipUnNamed" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputSkipUnNamed( ) ) ) ,"@@@@@"," --skipUnNamed ") ),
23 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "-j" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputJointSmoothing( ) ) ) ,"@@@@@"," -j ") ),
24 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--smooth" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputSmooth( ) ) ) ,"@@@@@"," --smooth ") ),
25 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--filtertype" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputFilterType( ) ) ) ,"@@@@@"," --filtertype ") ),
26 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--decimate" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputDecimate( ) ) ) ,"@@@@@"," --decimate ") ),
27 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--splitnormals" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputSplitNormals( ) ) ) ,"@@@@@"," --splitnormals ") ),
28 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--pointnormals" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputPointNormals( ) ) ) ,"@@@@@"," --pointnormals ") ),
29 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--pad" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputPad( ) ) ) ,"@@@@@"," --pad ") ),
30 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "--saveIntermediateModels" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputSaveIntermediateModels( ) ) ) ,"@@@@@"," --saveIntermediateModels ") ),
31 Mthd::Aux::toCharArrray( Mthd::Aux::toString( "-d" ) + Mthd::Aux::replace_str ( ( Mthd::Aux::toString( bbGetInputdebug( ) ) ) ,"@@@@@"," -d ") ) };
34 this->execute( lib, _argc, _argv );
38 void ModelMaker::execute ( std::string lib, int _argc, char * _argv[] ) {
39 void* handle = dlopen( lib.c_str( ), RTLD_NOW | RTLD_GLOBAL );
41 std::cerr << "CAN'T OPEN LIBRARY: " << dlerror( ) << '\n';
44 typedef int (*method_t )( int argc, char * argv[] );
48 method_t myMethod = ( method_t ) dlsym( handle, "ModuleEntryPoint" );
49 const char *dlsym_error = dlerror( );
51 std::cerr << "CAN'T LOAD SYMBOL 'ModuleEntryPoint':" << dlsym_error << '\n';
56 myMethod( _argc, _argv );
61 void ModelMaker::bbUserSetDefaultValues ( ) {
64 void ModelMaker::bbUserInitializeProcessing ( ) {
67 void ModelMaker::bbUserFinalizeProcessing ( ) {
70 // EO namespace bbSlicer