--- /dev/null
+# This code depends on make tool being used
+DEPFILES=$(wildcard $(addsuffix .d, ${OBJECTFILES}))
+ifneq (${DEPFILES},)
+include ${DEPFILES}
+endif
--- /dev/null
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+project (Inter)
+set (Inter_VERSION_MAJOR 1)
+set (Inter_VERSION_MINOR 0)
+
+SET(CMAKE_CXX_FLAGS "-ldl -w")
+
+FIND_PACKAGE (GenerateCLP REQUIRED)
+if (GenerateCLP_FOUND)
+ INCLUDE(${GenerateCLP_USE_FILE})
+endif (GenerateCLP_FOUND)
+
+FIND_PACKAGE (ModuleDescriptionParser REQUIRED)
+if (ModuleDescriptionParser_FOUND)
+ INCLUDE(${ModuleDescriptionParser_USE_FILE})
+endif (ModuleDescriptionParser_FOUND)
+
+SET(INCLUDE_DIRS
+ ${GenerateCLP_BINARY_DIR}
+ ${GenerateCLP_SOURCE_DIR}
+ ${ModuleDescriptionParser_BINARY_DIR}
+ ${ModuleDescriptionParser_SOURCE_DIR}
+ )
+
+SET(LINK_DIRECTORIES
+ ${GenerateCLP_LINK_DIRECTORY}
+ ${ModuleDescriptionParser_LINK_DIRECTORY}
+ )
+
+ADD_EXECUTABLE (interoperating_Baby main.cpp CreationTool.cxx)
+TARGET_LINK_LIBRARIES (interoperating_Baby ${ModuleDescriptionParser_LIBRARY} ModuleDescriptionParser )
+
--- /dev/null
+/*
+ * File: CreationTool.cxx
+ * Author: riveros
+ *
+ * Created on 23 mars 2012, 10:12
+ */
+
+#include "CreationTool.h"
+
+std::string Mthd::Aux::toString ( float n ) {
+ std::ostringstream oss;
+ oss << n;
+ return oss.str( );
+}
+
+std::string Mthd::Aux::toString ( double n ) {
+ std::ostringstream oss;
+ oss << n;
+ return oss.str( );
+}
+
+std::string Mthd::Aux::toString ( long double n ) {
+ std::ostringstream oss;
+ oss << n;
+ return oss.str( );
+}
+
+std::string Mthd::Aux::toString ( char n ) {
+ std::ostringstream oss;
+ oss << n;
+ return oss.str( );
+}
+
+std::string Mthd::Aux::toString ( unsigned char n ) {
+ std::ostringstream oss;
+ oss << n;
+ return oss.str( );
+}
+
+std::string Mthd::Aux::toString ( short n ) {
+ std::ostringstream oss;
+ oss << n;
+ return oss.str( );
+}
+
+std::string Mthd::Aux::toString ( unsigned short n ) {
+ std::ostringstream oss;
+ oss << n;
+ return oss.str( );
+}
+
+std::string Mthd::Aux::toString ( int n ) {
+ std::ostringstream oss;
+ oss << n;
+ return oss.str( );
+}
+
+std::string Mthd::Aux::toString ( long int n ) {
+ std::ostringstream oss;
+ oss << n;
+ return oss.str( );
+}
+
+std::string Mthd::Aux::toString ( unsigned int n ) {
+ std::ostringstream oss;
+ oss << n;
+ return oss.str( );
+}
+
+std::string Mthd::Aux::toString ( unsigned long n ) {
+ std::ostringstream oss;
+ oss << n;
+ return oss.str( );
+}
+
+std::string Mthd::Aux::toString ( unsigned long long n ) {
+ std::ostringstream oss;
+ oss << n;
+ return oss.str( );
+}
+
+std::string Mthd::Aux::toString ( std::string n ) {
+ return n;
+}
+
+char* Mthd::Aux::toCharArrray ( float n ) {
+ std::ostringstream oss;
+ oss << n;
+ return const_cast < char* > ( oss.str( ).data( ) );
+}
+
+char* Mthd::Aux::toCharArrray ( double n ) {
+ std::ostringstream oss;
+ oss << n;
+ return const_cast < char* > ( oss.str( ).data( ) );
+}
+
+char* Mthd::Aux::toCharArrray ( long double n ) {
+ std::ostringstream oss;
+ oss << n;
+ return const_cast < char* > ( oss.str( ).data( ) );
+}
+
+char* Mthd::Aux::toCharArrray ( char n ) {
+ std::ostringstream oss;
+ oss << n;
+ return const_cast < char* > ( oss.str( ).data( ) );
+}
+
+char* Mthd::Aux::toCharArrray ( unsigned char n ) {
+ std::ostringstream oss;
+ oss << n;
+ return const_cast < char* > ( oss.str( ).data( ) );
+}
+
+char* Mthd::Aux::toCharArrray ( short n ) {
+ std::ostringstream oss;
+ oss << n;
+ return const_cast < char* > ( oss.str( ).data( ) );
+}
+
+char* Mthd::Aux::toCharArrray ( unsigned short n ) {
+ std::ostringstream oss;
+ oss << n;
+ return const_cast < char* > ( oss.str( ).data( ) );
+}
+
+char* Mthd::Aux::toCharArrray ( int n ) {
+ std::ostringstream oss;
+ oss << n;
+ return const_cast < char* > ( oss.str( ).data( ) );
+}
+
+char* Mthd::Aux::toCharArrray ( long int n ) {
+ std::ostringstream oss;
+ oss << n;
+ return const_cast < char* > ( oss.str( ).data( ) );
+}
+
+char* Mthd::Aux::toCharArrray ( unsigned int n ) {
+ std::ostringstream oss;
+ oss << n;
+ return const_cast < char* > ( oss.str( ).data( ) );
+}
+
+char* Mthd::Aux::toCharArrray ( long unsigned int n ) {
+ std::ostringstream oss;
+ oss << n;
+ return const_cast < char* > ( oss.str( ).data( ) );
+}
+
+char* Mthd::Aux::toCharArrray ( std::string n ) {
+ return const_cast < char* > ( n.data( ) );
+}
+
+std::string Mthd::Aux::replace_str ( std::string input, std::string old_str, std::string new_str ) {
+ size_t found = input.find( old_str );
+ while ( found != std::string::npos ) {
+ input.replace( found, old_str.length( ), new_str );
+ found = input.find( old_str );
+ }
+ return input;
+}
+
--- /dev/null
+/*
+ * File: CreationTool.h
+ * Author: riveros
+ *
+ * Created on 23 mars 2012, 10:12
+ */
+
+#ifndef CREATIONTOOL_H
+#define CREATIONTOOL_H
+
+#include <string>
+#include <iostream>
+#include <sstream>
+
+namespace Mthd {
+
+ class Aux {
+ public:
+ static std::string toString ( float n ) ;
+ static std::string toString ( double n ) ;
+ static std::string toString ( long double n ) ;
+
+ static std::string toString ( char n ) ;
+ static std::string toString ( unsigned char n ) ;
+
+ static std::string toString ( short n ) ;
+ static std::string toString ( unsigned short n ) ;
+
+ static std::string toString ( int n ) ;
+ static std::string toString ( long int n ) ;
+ static std::string toString ( unsigned int n ) ;
+ static std::string toString ( unsigned long n ) ;
+ static std::string toString ( unsigned long long n ) ;
+
+ static std::string toString ( std::string n ) ;
+
+ static char* toCharArrray ( float n ) ;
+ static char* toCharArrray ( double n ) ;
+ static char* toCharArrray ( long double n ) ;
+
+ static char* toCharArrray ( char n ) ;
+ static char* toCharArrray ( unsigned char n ) ;
+
+ static char* toCharArrray ( short n ) ;
+ static char* toCharArrray ( unsigned short n ) ;
+
+ static char* toCharArrray ( int n ) ;
+ static char* toCharArrray ( long int n ) ;
+ static char* toCharArrray ( unsigned int n ) ;
+ static char* toCharArrray ( long unsigned int n ) ;
+
+ static char* toCharArrray ( std::string n ) ;
+
+ static std::string replace_str ( std::string input , std::string old_str , std::string new_str ) ;
+
+ } ;
+
+} ;
+
+
+
+#endif /* CREATIONTOOL_H */
+
--- /dev/null
+# CMAKE generated file: DO NOT EDIT!
+# Generated by "Unix Makefiles" Generator, CMake Version 2.8
+
+# Default target executed when no arguments are given to make.
+default_target: all
+.PHONY : default_target
+
+#=============================================================================
+# Special targets provided by cmake.
+
+# Disable implicit rules so canonical targets will work.
+.SUFFIXES:
+
+# Remove some rules from gmake that .SUFFIXES does not remove.
+SUFFIXES =
+
+.SUFFIXES: .hpux_make_needs_suffix_list
+
+# Produce verbose output by default.
+VERBOSE = 1
+
+# Suppress display of executed commands.
+$(VERBOSE).SILENT:
+
+# A target that is always out of date.
+cmake_force:
+.PHONY : cmake_force
+
+#=============================================================================
+# Set environment variables for the build.
+
+# The shell in which to execute make rules.
+SHELL = /bin/sh
+
+# The CMake executable.
+CMAKE_COMMAND = /usr/local/bin/cmake
+
+# The command to remove a file.
+RM = /usr/local/bin/cmake -E remove -f
+
+# The program to use to edit the cache.
+CMAKE_EDIT_COMMAND = /usr/local/bin/ccmake
+
+# The top-level source directory on which CMake was run.
+CMAKE_SOURCE_DIR = /home/riveros/NetBeansProjects/ModuleCall
+
+# The top-level build directory on which CMake was run.
+CMAKE_BINARY_DIR = /home/riveros/NetBeansProjects/ModuleCall
+
+#=============================================================================
+# Targets provided globally by CMake.
+
+# Special rule for the target edit_cache
+edit_cache:
+ @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake cache editor..."
+ /usr/local/bin/ccmake -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)
+.PHONY : edit_cache
+
+# Special rule for the target edit_cache
+edit_cache/fast: edit_cache
+.PHONY : edit_cache/fast
+
+# Special rule for the target rebuild_cache
+rebuild_cache:
+ @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake to regenerate build system..."
+ /usr/local/bin/cmake -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)
+.PHONY : rebuild_cache
+
+# Special rule for the target rebuild_cache
+rebuild_cache/fast: rebuild_cache
+.PHONY : rebuild_cache/fast
+
+# The main all target
+all: cmake_check_build_system
+ $(CMAKE_COMMAND) -E cmake_progress_start /home/riveros/NetBeansProjects/ModuleCall/CMakeFiles /home/riveros/NetBeansProjects/ModuleCall/CMakeFiles/progress.marks
+ $(MAKE) -f CMakeFiles/Makefile2 all
+ $(CMAKE_COMMAND) -E cmake_progress_start /home/riveros/NetBeansProjects/ModuleCall/CMakeFiles 0
+.PHONY : all
+
+# The main clean target
+clean:
+ $(MAKE) -f CMakeFiles/Makefile2 clean
+.PHONY : clean
+
+# The main clean target
+clean/fast: clean
+.PHONY : clean/fast
+
+# Prepare targets for installation.
+preinstall: all
+ $(MAKE) -f CMakeFiles/Makefile2 preinstall
+.PHONY : preinstall
+
+# Prepare targets for installation.
+preinstall/fast:
+ $(MAKE) -f CMakeFiles/Makefile2 preinstall
+.PHONY : preinstall/fast
+
+# clear depends
+depend:
+ $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1
+.PHONY : depend
+
+#=============================================================================
+# Target rules for targets named interoperating_Baby
+
+# Build rule for target.
+interoperating_Baby: cmake_check_build_system
+ $(MAKE) -f CMakeFiles/Makefile2 interoperating_Baby
+.PHONY : interoperating_Baby
+
+# fast build rule for target.
+interoperating_Baby/fast:
+ $(MAKE) -f CMakeFiles/interoperating_Baby.dir/build.make CMakeFiles/interoperating_Baby.dir/build
+.PHONY : interoperating_Baby/fast
+
+CreationTool.o: CreationTool.cxx.o
+.PHONY : CreationTool.o
+
+# target to build an object file
+CreationTool.cxx.o:
+ $(MAKE) -f CMakeFiles/interoperating_Baby.dir/build.make CMakeFiles/interoperating_Baby.dir/CreationTool.cxx.o
+.PHONY : CreationTool.cxx.o
+
+CreationTool.i: CreationTool.cxx.i
+.PHONY : CreationTool.i
+
+# target to preprocess a source file
+CreationTool.cxx.i:
+ $(MAKE) -f CMakeFiles/interoperating_Baby.dir/build.make CMakeFiles/interoperating_Baby.dir/CreationTool.cxx.i
+.PHONY : CreationTool.cxx.i
+
+CreationTool.s: CreationTool.cxx.s
+.PHONY : CreationTool.s
+
+# target to generate assembly for a file
+CreationTool.cxx.s:
+ $(MAKE) -f CMakeFiles/interoperating_Baby.dir/build.make CMakeFiles/interoperating_Baby.dir/CreationTool.cxx.s
+.PHONY : CreationTool.cxx.s
+
+main.o: main.cpp.o
+.PHONY : main.o
+
+# target to build an object file
+main.cpp.o:
+ $(MAKE) -f CMakeFiles/interoperating_Baby.dir/build.make CMakeFiles/interoperating_Baby.dir/main.cpp.o
+.PHONY : main.cpp.o
+
+main.i: main.cpp.i
+.PHONY : main.i
+
+# target to preprocess a source file
+main.cpp.i:
+ $(MAKE) -f CMakeFiles/interoperating_Baby.dir/build.make CMakeFiles/interoperating_Baby.dir/main.cpp.i
+.PHONY : main.cpp.i
+
+main.s: main.cpp.s
+.PHONY : main.s
+
+# target to generate assembly for a file
+main.cpp.s:
+ $(MAKE) -f CMakeFiles/interoperating_Baby.dir/build.make CMakeFiles/interoperating_Baby.dir/main.cpp.s
+.PHONY : main.cpp.s
+
+# Help Target
+help:
+ @echo "The following are some of the valid targets for this Makefile:"
+ @echo "... all (the default if no target is provided)"
+ @echo "... clean"
+ @echo "... depend"
+ @echo "... edit_cache"
+ @echo "... interoperating_Baby"
+ @echo "... rebuild_cache"
+ @echo "... CreationTool.o"
+ @echo "... CreationTool.i"
+ @echo "... CreationTool.s"
+ @echo "... main.o"
+ @echo "... main.i"
+ @echo "... main.s"
+.PHONY : help
+
+
+
+#=============================================================================
+# Special targets to cleanup operation of make.
+
+# Special rule to run CMake to check the build system integrity.
+# No rule that depends on this can have commands that come from listfiles
+# because they might be regenerated.
+cmake_check_build_system:
+ $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0
+.PHONY : cmake_check_build_system
+
--- /dev/null
+#include "bbSlicerDummy.h"
+#include "bbSlicerPackage.h"
+
+namespace bbSlicer {
+ BBTK_ADD_BLACK_BOX_TO_PACKAGE ( Slicer, Dummy )
+ BBTK_BLACK_BOX_IMPLEMENTATION ( Dummy, bbtk::AtomicBlackBox );
+
+ void Dummy::Process ( ) {
+
+ // GENERATED
+_33333_
+ // EO GENERATED
+ this->execute( lib, _argc, _argv );
+
+ }
+
+ void Dummy::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 Dummy::bbUserSetDefaultValues ( ) {
+ }
+
+ void Dummy::bbUserInitializeProcessing ( ) {
+ }
+
+ void Dummy::bbUserFinalizeProcessing ( ) {
+ }
+}
+// EO namespace bbSlicer
+
--- /dev/null
+#ifndef __bbSlicerDummy_h_INCLUDED__
+#define __bbSlicerDummy_h_INCLUDED__
+
+#include "bbSlicer_EXPORT.h"
+#include "bbtkAtomicBlackBox.h"
+
+#include <vector>
+#include <cstdlib>
+#include <dlfcn.h>
+#include <sstream>
+#include <fstream>
+#include <iostream>
+
+#include <ModuleDescriptionUtilities.h>
+#include <ModuleDescriptionParser.h>
+#include <ModuleParameterGroup.h>
+#include <ModuleDescription.h>
+#include <ModuleParameter.h>
+
+#include "CreationTool.h"
+
+namespace bbSlicer {
+
+ class bbSlicer_EXPORT Dummy
+ :
+ public bbtk::AtomicBlackBox {
+ BBTK_BLACK_BOX_INTERFACE ( Dummy , bbtk::AtomicBlackBox ) ;
+
+ // GENERATED ARGS
+ _11111_
+ // EO GENERATED ARGS
+
+ BBTK_PROCESS ( Process ) ;
+ void Process ( ) ;
+ private:
+ void execute ( std::string lib , int _argc , char * _argv[] ) ;
+ } ;
+
+ BBTK_BEGIN_DESCRIBE_BLACK_BOX ( Dummy , bbtk::AtomicBlackBox ) ;
+ BBTK_NAME ( "_NNNNN_" ) ;
+ BBTK_AUTHOR ( "_AAAAA_" ) ;
+ BBTK_DESCRIPTION ( "_DDDDD_" ) ;
+ BBTK_CATEGORY ( "_CCCCC_" ) ;
+
+ // GENERATED DESCRPTION
+ _22222_
+ // EO GENERATED DESCRIPTION
+
+ BBTK_END_DESCRIBE_BLACK_BOX ( Dummy ) ;
+}
+
+#endif // __bbSlicerDummy_h_INCLUDED__
+
--- /dev/null
+#ifndef __bbSlicerDummy_h_INCLUDED__
+#define __bbSlicerDummy_h_INCLUDED__
+
+#include "bbSlicer_EXPORT.h"
+#include "bbtkAtomicBlackBox.h"
+
+#include <cstdlib>
+#include <dlfcn.h>
+#include <iostream>
+
+namespace bbSlicer
+{
+class bbSlicer_EXPORT Dummy:public bbtk::AtomicBlackBox{
+ BBTK_BLACK_BOX_INTERFACE(Dummy,bbtk::AtomicBlackBox);
+// GENERATED
+ BBTK_DECLARE_INPUT(In,double);
+// EO GENERATED
+ BBTK_PROCESS(Process);
+ void Process();
+};
+
+BBTK_BEGIN_DESCRIBE_BLACK_BOX(Dummy,bbtk::AtomicBlackBox);
+BBTK_NAME("_NNNN");
+BBTK_AUTHOR("_AAAA");
+BBTK_DESCRIPTION("_DDDD");
+BBTK_CATEGORY("_CCCC");
+// GENERATED
+BBTK_INPUT(Dummy,In,"input",double,"");
+// EO GENERATED
+BBTK_END_DESCRIBE_BLACK_BOX(Dummy);
+}
+
+#endif // __bbSlicerDummy_h_INCLUDED__
+
--- /dev/null
+#include "bbSlicerGaussianBlur.h"
+#include "bbSlicerPackage.h"
+
+namespace bbSlicer {
+ BBTK_ADD_BLACK_BOX_TO_PACKAGE ( Slicer, GaussianBlur )
+ BBTK_BLACK_BOX_IMPLEMENTATION ( GaussianBlur, bbtk::AtomicBlackBox );
+
+ void GaussianBlur::Process ( ) {
+
+ // GENERATED
+
+int _argc =3;
+std::string lib = "/home/riveros/.slicer/Slicer4-bin/Slicer-build/lib/Slicer-4.0/cli-modules/libGaussianBlurImageFilterLib.so";
+char * _argv[ ] = { Mthd::Aux::toCharArrray( Mthd::Aux::toString( "-s" ) + Mthd::Aux::toString( bbGetInputsigma( ) ) ),
+Mthd::Aux::toCharArrray( Mthd::Aux::toString( bbGetInputinputVolume( ) ) ),
+Mthd::Aux::toCharArrray( Mthd::Aux::toString( bbGetInputoutputVolume( ) ) ) };
+
+ // EO GENERATED
+ this->execute( lib, _argc, _argv );
+
+ }
+
+ void GaussianBlur::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 GaussianBlur::bbUserSetDefaultValues ( ) {
+ }
+
+ void GaussianBlur::bbUserInitializeProcessing ( ) {
+ }
+
+ void GaussianBlur::bbUserFinalizeProcessing ( ) {
+ }
+}
+// EO namespace bbSlicer
+
+
--- /dev/null
+#ifndef __bbSlicerGaussianBlur_h_INCLUDED__
+#define __bbSlicerGaussianBlur_h_INCLUDED__
+
+#include "bbSlicer_EXPORT.h"
+#include "bbtkAtomicBlackBox.h"
+
+#include <vector>
+#include <cstdlib>
+#include <dlfcn.h>
+#include <sstream>
+#include <fstream>
+#include <iostream>
+
+#include <ModuleDescriptionUtilities.h>
+#include <ModuleDescriptionParser.h>
+#include <ModuleParameterGroup.h>
+#include <ModuleDescription.h>
+#include <ModuleParameter.h>
+
+#include "CreationTool.h"
+
+namespace bbSlicer {
+
+ class bbSlicer_EXPORT GaussianBlur
+ :
+ public bbtk::AtomicBlackBox {
+ BBTK_BLACK_BOX_INTERFACE ( GaussianBlur , bbtk::AtomicBlackBox ) ;
+
+ // GENERATED ARGS
+
+BBTK_DECLARE_INPUT ( sigma , double );
+BBTK_DECLARE_INPUT ( inputVolume , std::string );
+BBTK_DECLARE_INPUT ( outputVolume , std::string );
+
+ // EO GENERATED ARGS
+
+ BBTK_PROCESS ( Process ) ;
+ void Process ( ) ;
+ private:
+ void execute ( std::string lib , int _argc , char * _argv[] ) ;
+ } ;
+
+ BBTK_BEGIN_DESCRIBE_BLACK_BOX ( GaussianBlur , bbtk::AtomicBlackBox ) ;
+ BBTK_NAME ( "GaussianBlur" ) ;
+ BBTK_AUTHOR ( "Julien Jomier and Stephen Aylward" ) ;
+ BBTK_DESCRIPTION ( "Apply a gaussian blurr to an image" ) ;
+ BBTK_CATEGORY ( "Filtering.Denoising" ) ;
+
+ // GENERATED DESCRPTION
+
+BBTK_INPUT(GaussianBlur , sigma , "sigma" , double, "");
+BBTK_INPUT(GaussianBlur , inputVolume , "inputVolume" , std::string, "");
+BBTK_INPUT(GaussianBlur , outputVolume , "outputVolume" , std::string, "");
+
+ // EO GENERATED DESCRIPTION
+
+ BBTK_END_DESCRIBE_BLACK_BOX ( GaussianBlur ) ;
+}
+
+#endif // __bbSlicerGaussianBlur_h_INCLUDED__
+
+
--- /dev/null
+# Install script for directory: /home/riveros/NetBeansProjects/ModuleCall
+
+# Set the install prefix
+IF(NOT DEFINED CMAKE_INSTALL_PREFIX)
+ SET(CMAKE_INSTALL_PREFIX "/usr/local")
+ENDIF(NOT DEFINED CMAKE_INSTALL_PREFIX)
+STRING(REGEX REPLACE "/$" "" CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
+
+# Set the install configuration name.
+IF(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME)
+ IF(BUILD_TYPE)
+ STRING(REGEX REPLACE "^[^A-Za-z0-9_]+" ""
+ CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}")
+ ELSE(BUILD_TYPE)
+ SET(CMAKE_INSTALL_CONFIG_NAME "Debug")
+ ENDIF(BUILD_TYPE)
+ MESSAGE(STATUS "Install configuration: \"${CMAKE_INSTALL_CONFIG_NAME}\"")
+ENDIF(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME)
+
+# Set the component getting installed.
+IF(NOT CMAKE_INSTALL_COMPONENT)
+ IF(COMPONENT)
+ MESSAGE(STATUS "Install component: \"${COMPONENT}\"")
+ SET(CMAKE_INSTALL_COMPONENT "${COMPONENT}")
+ ELSE(COMPONENT)
+ SET(CMAKE_INSTALL_COMPONENT)
+ ENDIF(COMPONENT)
+ENDIF(NOT CMAKE_INSTALL_COMPONENT)
+
+# Install shared libraries without execute permission?
+IF(NOT DEFINED CMAKE_INSTALL_SO_NO_EXE)
+ SET(CMAKE_INSTALL_SO_NO_EXE "1")
+ENDIF(NOT DEFINED CMAKE_INSTALL_SO_NO_EXE)
+
+IF(CMAKE_INSTALL_COMPONENT)
+ SET(CMAKE_INSTALL_MANIFEST "install_manifest_${CMAKE_INSTALL_COMPONENT}.txt")
+ELSE(CMAKE_INSTALL_COMPONENT)
+ SET(CMAKE_INSTALL_MANIFEST "install_manifest.txt")
+ENDIF(CMAKE_INSTALL_COMPONENT)
+
+FILE(WRITE "/home/riveros/NetBeansProjects/ModuleCall/${CMAKE_INSTALL_MANIFEST}" "")
+FOREACH(file ${CMAKE_INSTALL_MANIFEST_FILES})
+ FILE(APPEND "/home/riveros/NetBeansProjects/ModuleCall/${CMAKE_INSTALL_MANIFEST}" "${file}\n")
+ENDFOREACH(file)
--- /dev/null
+/*
+ * File: main.cpp
+ * Author: gabriel
+ *
+ * Created on 15 février 2012, 19:50
+ */
+
+#include <vector>
+#include <cstdlib>
+#include <dlfcn.h>
+#include <sstream>
+#include <iostream>
+
+
+#include <ModuleDescriptionParser.h>
+#include <ModuleParameterGroup.h>
+#include <ModuleDescription.h>
+#include <ModuleParameter.h>
+
+#include <fstream>
+#include <ModuleDescriptionUtilities.h>
+
+#include "CreationTool.h"
+
+
+/// STD LD_OPEN CALLS ///
+
+char* getModuleDescription ( std::string lib ) {
+ void* handle = dlopen( lib.c_str( ), RTLD_NOW | RTLD_GLOBAL );
+ if ( ! handle ) {
+ std::cerr << "CAN'T OPEN LIBRARY: " << dlerror( ) << '\n';
+ return NULL;
+ }
+ typedef char* ( *method_t )( void );
+ // RESET ERRORS
+ dlerror( );
+ method_t myMethod = ( method_t ) dlsym( handle, "GetXMLModuleDescription" );
+ const char *dlsym_error = dlerror( );
+ if ( dlsym_error ) {
+ std::cerr << "CAN'T LOAD SYMBOL 'GetXMLModuleDescription: " << dlsym_error << '\n';
+ dlclose( handle );
+ return NULL;
+ }
+ // CALLING METHOD
+ char* descrption = myMethod( );
+ // CLOSING LIB
+ dlclose( handle );
+ return descrption;
+
+}
+
+void 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 ERRORS
+ dlerror( );
+ 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;
+ }
+ // CALLING METHOD
+ myMethod( _argc, _argv );
+ // CLOSING LIB
+ dlclose( handle );
+}
+
+/// FILE RELATED ///
+
+void saveFile ( std::string content, std::string file_name ) {
+ std::ofstream myfile;
+ myfile.open( file_name.c_str( ) );
+ myfile << content;
+ myfile.close( );
+}
+
+std::string loadFile ( std::string filename ) {
+ std::string line = std::string( "" );
+ std::string content = std::string( "" );
+
+ std::ifstream infile;
+ infile.open( filename.c_str( ) );
+ while ( ! infile.eof( ) ) {
+ getline( infile, line );
+ content += line + "\n";
+ line.clear( );
+ }
+ infile.close( );
+ return content;
+
+}
+
+std::string loadDummyBody ( ) {
+ return loadFile( "bbSlicerDummy.dummy_cxx" );
+}
+
+std::string loadDummyHeader ( ) {
+ return loadFile( "bbSlicerDummy.dummy_h" );
+}
+
+/// BBTK BOX CREATION ///
+
+std::string updateBoxDescription ( const ModuleDescription* module, std::string _header ) {
+ _header = Mthd::Aux::replace_str( _header, "_NNNNN_", Mthd::Aux::replace_str( module->GetTitle( ), " ", "" ) );
+ _header = Mthd::Aux::replace_str( _header, "_AAAAA_", module->GetContributor( ) );
+ _header = Mthd::Aux::replace_str( _header, "_DDDDD_", module->GetDescription( ) );
+ _header = Mthd::Aux::replace_str( _header, "_CCCCC_", module->GetCategory( ) );
+ return _header;
+}
+
+std::string updateBoxName ( const ModuleDescription* module, std::string content ) {
+ std::string _new_box_name = Mthd::Aux::replace_str( module->GetTitle( ), " ", "" );
+ content = Mthd::Aux::replace_str( content, "Dummy", _new_box_name );
+ return content;
+}
+
+std::string getHeaderFileName ( const ModuleDescription* module ) {
+ std::string name = Mthd::Aux::replace_str( module->GetTitle( ), " ", "" );
+
+ return "bbSlicer" + name + ".h";
+}
+
+std::string getBodyFileName ( const ModuleDescription* module ) {
+ std::string name = Mthd::Aux::replace_str( module->GetTitle( ), " ", "" );
+
+ return "bbSlicer" + name + ".cxx";
+}
+
+std::string updateBoxInputs ( const ModuleDescription* module, std::string content ) {
+
+ std::string _cxx_inputs = std::string( "\n" );
+ std::string _cxx_inputs_end = std::string( "\n" );
+ std::string _box_name = Mthd::Aux::replace_str( module->GetTitle( ), " ", "" );
+
+ for ( unsigned long int i = 0; i < module->GetParameterGroups( ).size( ); i ++ ) {
+ ModuleParameterGroup pGroup = module->GetParameterGroups( ).at( i );
+ for ( unsigned long int j = 0; j < pGroup.GetParameters( ).size( ); j ++ ) {
+ ModuleParameter mPara = pGroup.GetParameters( ).at( j );
+ _cxx_inputs +=
+ "BBTK_DECLARE_INPUT ( " +
+ mPara.GetName( ) + " , " +
+ mPara.GetCPPType( ) + " );\n";
+
+ _cxx_inputs_end +=
+ "BBTK_INPUT(" +
+ _box_name + " , " +
+ mPara.GetName( ) + " , " +
+ "\"" + mPara.GetName( ) + "\"" + " , " +
+ mPara.GetCPPType( ) + ", \"\");\n";
+ }
+ }
+ content = Mthd::Aux::replace_str( content, "_11111_", _cxx_inputs );
+ content = Mthd::Aux::replace_str( content, "_22222_", _cxx_inputs_end );
+
+ return content;
+}
+
+const int getNumberOfArguments ( const ModuleDescription* module ) {
+ int number = 0;
+ for ( unsigned long int i = 0; i < module->GetParameterGroups( ).size( ); i ++ ) {
+ ModuleParameterGroup pGroup = module->GetParameterGroups( ).at( i );
+ for ( unsigned long int j = 0; j < pGroup.GetParameters( ).size( ); j ++ ) {
+
+ ModuleParameter mPara = pGroup.GetParameters( ).at( j );
+ number ++;
+ }
+ }
+ return number;
+}
+
+std::string updateProcessMethod ( const ModuleDescription* module, std::string content, std::string lib ) {
+ int number = 0;
+ std::string arg_list = std::string( "" );
+ for ( unsigned long int i = 0; i < module->GetParameterGroups( ).size( ); i ++ ) {
+ ModuleParameterGroup pGroup = module->GetParameterGroups( ).at( i );
+ for ( unsigned long int j = 0; j < pGroup.GetParameters( ).size( ); j ++ ) {
+
+ ModuleParameter mPara = pGroup.GetParameters( ).at( j );
+
+ arg_list += "Mthd::Aux::toCharArrray( ";
+ if ( mPara.GetFlag( ) != "" ) {
+ arg_list += "Mthd::Aux::toString( \"";
+ arg_list += "-" + mPara.GetFlag( ) + "\" ";
+ arg_list += " ) + ";
+
+ } else if ( mPara.GetLongFlag( ) != "" ) {
+ arg_list += "Mthd::Aux::toString( \"";
+ arg_list += "--" + mPara.GetLongFlag( ) + "\" ";
+ arg_list += " ) + ";
+ }
+
+ arg_list += "Mthd::Aux::toString( bbGetInput" + mPara.GetName( ) + "( ) )";
+ arg_list += " ),\n";
+ number ++;
+ }
+
+ }
+ arg_list += "_EEENNNDDD_";
+ arg_list = Mthd::Aux::replace_str( arg_list, ",\n_EEENNNDDD_", "" );
+ std::string _argc = "\nint _argc =" + Mthd::Aux::toString( number ) + ";\n";
+ std::string _slib = "std::string lib = \"" + lib + "\";\n";
+ std::string _argv = "char * _argv[ ] = { " + arg_list + " };\n";
+ return Mthd::Aux::replace_str( content, "_33333_", _argc + _slib + _argv );
+}
+
+int main ( int argc, char* argv[] ) {
+
+ int _argc = 3;
+ char * _argv[] = { "-s 20", "/home/riveros/Desktop/Experiments/RA1.mhd", "/home/riveros/Desktop/Experiments/RA1-OUT-MAIN.mhd" };
+ std::string gblib = "/home/riveros/.slicer/Slicer4-bin/Slicer-build/lib/Slicer-4.0/cli-modules/libGaussianBlurImageFilterLib.so";
+
+ execute( gblib, _argc, _argv );
+
+ /// MODULE INFORMATION ///
+ const std::string des = getModuleDescription( gblib );
+
+ // std::cout << "====================================" << std::endl << std::endl;
+ // std::cout << "====================================" << std::endl << std::endl;
+ // std::cout << "====================================" << std::endl << std::endl;
+ // std::cout << "====================================" << std::endl << std::endl;
+ //
+ // std::cout << des << std::endl << std::endl;
+
+ ModuleDescription module;
+ ModuleDescriptionParser parser;
+
+ parser.Parse( des, module );
+
+ /// LOADING DUMMY FILES ///
+ std::string _body = loadDummyBody( );
+ std::string _header = loadDummyHeader( );
+
+ /// SETTING HEADER FILE ///
+ _header = updateBoxName( &module, _header );
+ _header = updateBoxDescription( &module, _header );
+ _header = updateBoxInputs( &module, _header );
+ saveFile( _header, getHeaderFileName( &module ) );
+
+ /// SETTING BODY FILE ///
+ _body = updateBoxName( &module, _body );
+ _body = updateProcessMethod( &module, _body, gblib );
+ saveFile( _body, getBodyFileName( &module ) );
+
+
+ // std::cout << "====================================" << std::endl << std::endl;
+ // std::cout << "====================================" << std::endl << std::endl;
+ // std::cout << "====================================" << std::endl << std::endl;
+ // std::cout << "====================================" << std::endl << std::endl;
+ //
+ // std::cout << _header << std::endl;
+ //
+ // std::cout << "====================================" << std::endl << std::endl;
+ // std::cout << "====================================" << std::endl << std::endl;
+ // std::cout << "====================================" << std::endl << std::endl;
+ // std::cout << "====================================" << std::endl << std::endl;
+ //
+ // std::cout << _body << std::endl;
+
+ return EXIT_SUCCESS;
+}