1 /*=========================================================================
7 =========================================================================*/
9 /* ---------------------------------------------------------------------
11 * Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale)
12 * Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux
14 * This software is governed by the CeCILL-B license under French law and
15 * abiding by the rules of distribution of free software. You can use,
16 * modify and/ or redistribute the software under the terms of the CeCILL-B
17 * license as circulated by CEA, CNRS and INRIA at the following URL
18 * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
19 * or in the file LICENSE.txt.
21 * As a counterpart to the access to the source code and rights to copy,
22 * modify and redistribute granted by the license, users are provided only
23 * with a limited warranty and the software's author, the holder of the
24 * economic rights, and the successive licensors have only limited
27 * The fact that you are presently reading this means that you have had
28 * knowledge of the CeCILL-B license and that you accept its terms.
29 * ------------------------------------------------------------------------ */
33 * \brief Class bbtk::GConnectorModel
37 #include "ExecuterBBSG.h"
39 #include "bbtkExecuter.h"
40 #include "bbtkMessageManager.h"
41 #include "bbtkFactory.h"
42 #include "bbtkUtilities.h"
51 EExecuterBBSG::Pointer EExecuterBBSG::New( wxVtkSceneManager* sceneManager, Factory::Pointer factory )
53 return MakePointer( new EExecuterBBSG( sceneManager, factory) );
57 //=========================================================================
59 EExecuterBBSG::EExecuterBBSG( wxVtkSceneManager* sceneManager, Factory::Pointer factory )
62 _sceneManager = sceneManager;
66 _zGeneral = 900; // ?????
70 //=========================================================================
72 EExecuterBBSG::~EExecuterBBSG()
76 //=========================================================================
81 /// Sets the inputs of the workspace :
82 void EExecuterBBSG::SetInputs(const std::map<std::string,std::string>& m)
86 /// Puts the executer in "no exec" mode,
87 /// which creates but does not execute pipelines
88 void EExecuterBBSG::SetNoExecMode(bool b)
92 bool EExecuterBBSG::GetNoExecMode() const
97 /// Sets the mode of dialog of the executer for Root inputs
98 void EExecuterBBSG::SetDialogMode(DialogModeType t)
102 /// Puts the executer in "no error" mode,
103 /// Errors do not stop execution (but warnings are produced)
104 void EExecuterBBSG::SetNoErrorMode(bool b)
108 bool EExecuterBBSG::GetNoErrorMode() const
113 //=================================================================
115 void EExecuterBBSG::LoadPackage(const std::string &name )
119 /// Unloads a package
120 void EExecuterBBSG::UnLoadPackage(const std::string &name )
124 /// Starts a package block
125 void EExecuterBBSG::BeginPackage (const std::string &name )
129 /// Ends a package block
130 void EExecuterBBSG::EndPackage ()
134 /// Starts the definition of a new ComplexBlackBox in package pack
135 /// scriptfilename is the file from which the def is read
136 void EExecuterBBSG::Define (const std::string &name,
137 const std::string& pack,
138 const std::string &scriptfilename)
142 /// Sets the file name to use for the current definition
143 /// (Used to set it after the Define command)
144 void EExecuterBBSG::SetCurrentFileName (const std::string &name )
148 /// End the definition of a ComplexBlackBox
149 void EExecuterBBSG::EndDefine ()
153 /// Sets the kind of the currently defined ComplexBlackBox
154 void EExecuterBBSG::Kind(const std::string& kind)
158 /// Creates a new black box in current complex box
159 void EExecuterBBSG::Create ( const std::string& boxType, const std::string& boxName)
161 std::string packagename = _factory->GetPackageNameOfaBlackBox(boxType);
162 // int idBox = _sceneManager->createGBlackBox( 0,0, packagename ,boxType);
163 // _sceneManager->configGBlackBox(idBox, _xGeneral,_yGeneral,_zGeneral,boxName, false , _xGeneral+100, _yGeneral-10 , _zGeneral );
164 _yGeneral = _yGeneral + 30;
165 printf("EED EExecuterBBSG::Create packagename=%s boxtype=%s boxname=%s \n", packagename.c_str(), boxType.c_str(), boxName.c_str() );
168 /// Destroys a black box
169 void EExecuterBBSG::Destroy (const std::string &boxName)
173 /// Clears the currently defined ComplexBlackBox
174 void EExecuterBBSG::Clear()
178 /// Connects the output boxOutput to the input boxInput
179 void EExecuterBBSG::Connect (const std::string &boxfrom,
180 const std::string &output,
181 const std::string &boxto,
182 const std::string &input)
184 printf("EED EExecuterBBSG::Connect\n");
188 void EExecuterBBSG::Execute (const std::string &box)
192 /// Defines an input of the current complex box
193 void EExecuterBBSG::DefineInput (const std::string &name,
194 const std::string &box,
195 const std::string &input,
196 const std::string &help)
200 /// Defines an output of the current complex box
201 void EExecuterBBSG::DefineOutput (const std::string &name,
202 const std::string &box,
203 const std::string &output,
204 const std::string &help)
208 /// sets the input of the box with the value
209 void EExecuterBBSG::Set (const std::string &box,
210 const std::string &input,
211 const std::string &value)
213 printf("EED EExecuterBBSG::Set\n");
216 /// gets the output of the box
217 std::string EExecuterBBSG::Get (const std::string &box,
218 const std::string &output)
223 /// changes the workspace name
224 void EExecuterBBSG::SetWorkspaceName( const std::string& n )
228 ///Adds the authorName to the Box author list
229 void EExecuterBBSG::Author(const std::string &authorName)
233 ///Adds the categories to the Box categoris list
234 void EExecuterBBSG::Category(const std::string &categories)
238 /// The description string which explains what does the ComplexBox
239 void EExecuterBBSG::Description(const std::string &d)
243 /// prints the list of the boxes of the current box
244 void EExecuterBBSG::PrintHelpListBoxes()
248 /// Generate a HTML file with a gif file with the actual pipeline (Graphviz-dot needed). Returns the file path
249 std::string EExecuterBBSG::ShowGraph(const std::string &nameblackbox,
250 const std::string &detailStr,
251 const std::string &levelStr,
252 const std::string &output_file,
253 const std::string &custom_header,
254 const std::string &custom_title,
260 /// Generate a HTML with a gif file with the actual pipeline (Graphviz-dot needed). Returns the file path
261 std::string EExecuterBBSG::ShowGraphInstances(const std::string &nameblackbox, int detail, int level, bool system_display)
266 /// Prints help on a black box
267 void EExecuterBBSG::PrintHelpBlackBox(const std::string &nameblackbox, const std::string &detailStr, const std::string &levelStr)
271 void EExecuterBBSG::Reset()
275 /// Sets the level of message for kind
276 void EExecuterBBSG::SetMessageLevel(const std::string &kind, int level)
280 /// Prints help on the messages
281 void EExecuterBBSG::HelpMessages()
285 /// Prints the string ... MORE : TO EXPLAIN
286 void EExecuterBBSG::Print(const std::string & message)
293 } // EO namespace bbtk