1 % ==========================================
2 \documentclass[11pt,final,a4paper]{article}
5 \bbtkGuide[User's Guide]
6 % ==========================================
9 % ==========================================
12 \section{Introduction}
13 % ==========================================
14 \subsection{What is bbtk ?}
15 % ==========================================
16 \BBTK(\bbtkns) is a set of tools
17 (\CPP libraries and executables)
18 providing a \CPP framework for the definition
19 of elementary processing \emph{units}, called {\bf black boxes},
20 and the definition and execution of processing \emph{chains}
21 made up of these black boxes. \\
23 %It's a part of the \texttt{Creatools suite} composed mainly of :
31 %which depend on the OpenSource libraries:
39 % ==========================================
40 \subsubsection{The black box philosophy}
41 % ==========================================
43 \href{http://www.answers.com/topic/black-box-theater}{The Answers Dictionary} defines a {\bf black box} as
44 \emph{``A device or theoretical construct with known or specified performance characteristics
45 but unknown or unspecified constituents and means of operation''} \\
46 \href{http://en.wikipedia.org/wiki/Black_box_\%28disambiguation\%29}{Wikipedia}
47 defines a {\bf black box} as
48 \emph{``any component in a system in which only the input and output
49 characteristics are of interest, without regard to its internal mechanism
51 We should merge these definitions. :
52 not only the inputs and outputs are of interest but also
53 \emph{what the box does} !
54 Hence, we would say that a black box is any \emph{\bf documented}
55 component of a system, letting the user know
56 \emph{\bf what} the box is supposed to do and
57 \emph{\bf how to use it}
58 but not \emph{\bf how it does it}. \\
60 \BBTK provides a systematic framework
61 to encapsulate (or ``wrap'') any
62 existing \texttt{C} or \CPP processing code into an object
63 (a black box) having a {\bf generic symbolic interface}, where
66 \item{\bf generic} means that the interface is \emph{the same}
67 for all boxes. Hence one does not need to know which particular
68 method allows, say, to set a particular input or
69 get a particular output of the box.
70 One can use a black box in a purely abstract way.
71 \item{\bf symbolic} means that a particular
72 input or output is referenced by a 'name', that is by a symbol
73 which identifies the input or output.
74 It also means that symbolic information (text) is
75 attached to a box: description of the box, author,
76 description of its inputs and outputs, etc.
79 (Actually, genericity is achieved because the interface is symbolic.
80 We let you think about this\dots)
82 Of course, symbolic data attached to a box may be
83 {\bf queried} : what are the inputs/outputs of the box ?
84 what are their type ? their description ? etc.
85 This allows {\bf automatic documentation} of boxes.
87 The abstract definition of black boxes is the most basic
88 aspect of \BBTK architecture.
89 Another key aspect is the groupement of black boxes into
90 so called {\bf packages},
91 which are \emph{dynamic libraries} which can also
92 be queried, in particular about the boxes they provide.
93 The package structure then offers a mechanism which
94 is like a \emph{'plug-in'} mechanism.
95 \BBTK provides the methods to load a package at run-time,
96 and create instances of the boxes it contains.
98 These two mechanisms (black boxes and packages)
99 then gives the way to:
102 \item The definition of an {\bf interpreted script language},
103 which allows to manipulate packages and boxes very easily in symbolic way.
104 \BBTK provides one : \bbs (the Black Box Script language) and its interpreter
105 \bbi (the Black Box Interpreter).
106 \item {\bf Automatic documentation} of existing packages.
107 \texttt{html} documentation of packages is proposed by
111 Finally, these different components allow {\bf efficient} :
114 \item {\bf capitalization and reuse} of existing processing units,
115 including {\bf documentation}
116 \item {\bf testing, prototyping} in a very simple script language
117 \item {\bf inter-operability} between atomic processings which
118 have been written by different persons, using different libraries, etc.
121 % ==========================================
122 \subsubsection{\bbtk components}
123 % ==========================================
126 \item A \CPP {\bf\emph{library}} - called \bbtk - which defines a framework
127 (abstract classes) to develop black boxes and store them into
128 dynamic libraries, called black box \emph{packages}.
129 \item Different {\bf\emph{"core" black box packages}} :
131 \item {\bf\emph{std}} : the 'standard' package including basic useful boxes.
132 \item {\bf\emph{wx}} : basic graphical interface elements (widgets : sliders, buttons, etc. based on the \texttt{wxWidgets} library).
133 \item {\bf\emph{itk}} : the basic image processing package, based on the \itk library.
134 \item {\bf\emph{vtk}} : the basic images and surfaces processing and visualization package, based on the \vtk library.
135 \item {\bf\emph{wxvtk}} : widget boxes based on the \vtk library (2D and 3D vizualization and
137 %\item {\bf\emph{creaImageIO}} : Provides hight level widgets to read images, including DICOM.
138 \item {\bf\emph{toolsbbtk}} : Tools for bbtk administration and package development.
140 \item A {\bf\emph{Developement environment}}, called \bbStudio, which provides
142 \item An online {\bf\emph{script editor and interpretor}}
143 \item A powerful html {\bf\emph{Help environment}}, integrating :
145 \item Online documentation scaning
146 \item Retreiving boxes on various criterions
147 \item Checking Demo and examples
150 \item An standalone {\bf\emph{interpreter}}, called \bbins, which allows to
151 execute \bbs scripts or commands.
152 \item {\bf\emph{Various Development Utilities}} :
154 \item \bbfy generates the \CPP code of a black box from a
155 description file written in \texttt{xml}.
156 %\item \bbdoc generates the html documentation of a black box package
157 %(author, description, description of its black boxes :
158 %author, description, inputs, outputs, and so on).
159 \item \bbCreatePackage allows to create the basic file architecture.
160 to start the development of a new black box package.
161 \item \bbCreateBlackBox allows to create the basic file architecture.
162 to start the development of a new black box, that will be included in an already existing package.
163 \item \bbs2cpp translates a \texttt{.bbs} script into a \CPP file.
164 \item \bbc (sorry : Linux Only, for the moment) that compiles \texttt{.bbs} scripts into executables.
165 \item \bbRegeneratePackageDoc which creates the html documentation of the Package.
166 \item \bbRegenerateBoxesLists which creates the html pages of the various lists of all the currenly installed boxes.
167 \item \bbPlugPackage which automatically incorporates a new package.
169 \item A full {\bf\emph{documentation}} printable (pdf), browsable (html),
170 queryable throught keywords.
173 The general architecture of \BBTK
174 is shown in figure \ref{bb-architecture}.
177 \caption{\label{bb-architecture}\BBTK architecture}
179 \includegraphics[width=0.6\textwidth]{bb-architecture.png}
185 % ==========================================
186 \subsection{Content of this guide}
187 % ==========================================
189 Read this \texttt{Users' Guide} if you want to learn how to use
190 \bbtk development environnement (\bbStudions) and how to write black box scripts.\\
191 If you aim is to write your own Packages and Black Boxes, you have to read the
192 \texttt{Package Developper's Guide}.
194 % ==========================================
197 \section{Getting started with bbStudio}
199 % ==========================================
202 % ==========================================
203 \subsection{The interface}
204 % ==========================================
207 %\vspace{0.5cm}\hrule
208 %\section{The Development environment (bbStudio)}
211 Just run it, typing in a console \bbStudio
212 or clicking on its icon or its menu entry.
213 You'll get something like in figure
214 \ref{bbi-fig-bbStudio-gui-start}
215 (the exact appearance of \bbStudio is Operating System and \bbtk version dependent).
217 At start, \bbStudio opens with a very minimal 'How to use' in the middle.
218 Don't forget to read it : it will vanish at the first mouse click.
222 \caption{\label{bbi-fig-bbStudio-gui-start}The bbStudio Development environment interface at start time}
224 \includegraphics[width=0.7\textwidth]{bbStudioMainPageStart.png}
228 %Let's have a look at the resized window :
230 %\caption{\label{bbi-fig-bbStudio-gui}The bbStudio Development environment interface}
232 %\includegraphics[width=0.7\textwidth]{bbStudioMainPage.png}
236 The interface is divided into four parts : \texttt{Files}, \texttt{Messages},
237 \texttt{Command}, \texttt{Help}.
238 It is written using the Advanced User Interface library of wxWidgets
240 whose 'docking manager' allows windows and toolbars to be floated/docked
242 Feel free to resize/reposition any part you want.
243 Your preferences will be kept next time you run again \bbStudions.
245 %Please don't use this feature at learning time
246 %(the snapshots of this document wouldn't match with your screen ...)
248 \subsubsection{'Files' part}
249 \label{bbi-FilesPart}
251 It's the \bbs script editor.
253 If you load a file holding a script, it will be displayed here, and you'll be
254 able to modify it, to save it, to save-as it, to run it, using the
255 lower toolbar (see figure \ref{lowertoolbar})
258 \caption{\label{lowertoolbar}The 'Files' lower tool bar}
260 \includegraphics[width=0.7\textwidth]{lowertoolbar2.png}
266 % \item {\bf\emph{New file}} : Create a new file to hold a script
267 % \item {\bf\emph{Open file}} : Open an already existing file holding a script
268 % \item {\bf\emph{Close file}} : Close a file holding a script
269 % \item {\bf\emph{Save file}} : Save he current file (if modified)
270 % \item {\bf\emph{Save file as}} : Save he current file under a different name
271 % \item {\bf\emph{Run file}} : Execute the script you just loaded/modified/written
272 % \item {\bf\emph{cursor position}} : column number : line number
276 \subsubsection{'Messages' part}
277 \label{bbi-MessagesPart}
279 Two kinds of messages will be output here:\\
280 System messages : produced by the kernel, in case of a user mistyping, or an execution error\\
281 Script messages : produced by the \bbtk equivalent of \texttt{printf}
282 or \texttt{std::cout} in user programs.
284 \subsubsection{'Command' part}
285 \label{bbi-CommandPart}
287 You can type here \bbs commands which are executed on the fly.
288 The buttons are shortcuts to usual commands.
290 \subsubsection{'Help' part}
291 \label{bbi-HelpContentsPart}
293 The 'Help' part of \bbStudio is used to browse the html help of \BBTKns.
296 % ==========================================
301 % ==========================================
302 % ==========================================
303 % ==========================================
304 % ==========================================
305 % ==========================================
310 % ==========================================
314 % ==============================================
315 \subsection{Running Demos and Examples}
316 % ==============================================
318 In the 'Help' part (See figure \ref{HelpContents}), select \texttt{Examples} link.
321 \caption{\label{HelpContents}\bbStudio 'Help' panel}
323 \includegraphics[width=0.7\textwidth]{HelpContents.png}
329 You will get a list of examples (See figure \ref{example}).
331 Note : due to an unfixed bug in Linux, you have to click on 'reload' to get it. \\
335 \caption{\label{example}Examples list}
337 \includegraphics[width=0.7\textwidth]{example.png}
343 %\caption{\label{BoxCategories}Box Categories}
345 %\includegraphics[width=0.7\textwidth]{BoxCategories.png}
350 Select \texttt{wx::exampleSlider}.
353 \caption{\label{exampleSlider}Html documentation of example 'exampleSlider'}
355 \includegraphics[width=0.7\textwidth]{exampleSlider.png}
359 You can see information on the example and
360 the graphical representation of the workflow defined by the script
361 (the elementary boxes that compose it, and their connections, see figure \ref{exampleSlider}).
363 Click on \texttt{[source]}, it will be loaded
364 in the 'Files' part, within the script editor (See figure \ref{exampleSliderSource});
367 \caption{\label{exampleSliderSource}Source code of 'exampleSlider'}
369 \includegraphics[width=0.7\textwidth]{exampleSliderSource.png}
373 Run it, using the 'Files' toolbar (see figure \ref{lowertoolbar})
375 You'll get something like in figure \ref{execSliderSource}.
378 \caption{\label{execSliderSource}Execution of 'exampleSlider'}
380 \includegraphics[width=0.7\textwidth]{execSliderSource.png}
384 Feel free to move the slider, to check whether it actually works...
388 Just a few words on what you saw :
390 \item{In the source code of the script} : \\
395 These \bbs commands load the packages std and wx
398 set slider.ReactiveOnTrack 1
400 We create a \texttt{Slider} box called \emph{slider}.
402 We tell it to inform anybody that's interested in, that the cursor moved, each time it moved.
403 The default behaviour is to inform only when cursor is released.
407 We create an \texttt{OutputText} box called \emph{text}
408 (in which slider value will be displayed)
411 new LayoutLine layout
413 We create a \texttt{LayoutLine} box called \emph{layout},
414 a widget box designed to embed other widgets (say, a main window)
416 connect slider.Widget layout.Widget1
417 connect text.Widget layout.Widget2
419 We embed \emph{slider} and \emph{text} into \emph{layout}.
421 connect slider.BoxChange text.BoxExecute
422 connect slider.Out text.In
424 We tell \emph{slider} to inform \emph{text} every time it's modified.
426 We tell \emph{slider} to pass its output value (\texttt{Out})
427 to \emph{text} input value (\texttt{In})
431 We tell \emph{layout} to process itself.
432 This also produces the execution of the boxes connected to it (the slider, the text).
434 \item{In the Help part}
436 You can see the graphical representation of the workflow (pipeline) created by the script,
437 as in figure \ref{SmallGraph}.
441 \caption{\label{SmallGraph}Graphical representation of a pipeline}
443 \includegraphics[width=0.7\textwidth]{SmallGraph.png}
447 The representation includes
448 both the graphical interface-related pipeline
449 (\emph{slider} and \emph{text} are embedded into \emph{layout})
450 and the data processing-related pipeline
451 (\emph{slider} warns \emph{text} immediately when it's modified,
452 \emph{slider} passes \emph{text} its output value)\footnote{Yes, we know : all the arrows (graphical interface pipeline arrows and data processing arrows)
453 are blue; using different colors is planned for next release...}.
455 You can get a much more detailled graph,
456 like in figure \ref{LargeGraph},
457 just clicking on the button
458 '\texttt{graph (detailled)}' in the toolbar of the \texttt{Command} part.
462 \caption{\label{LargeGraph}Detailled graphical representation of a pipeline}
464 \includegraphics[width=0.75\textwidth]{LargeGraph.png}
471 % ==============================================
472 \subsection{Online Help}
473 % ==============================================
475 Various levels or help are supplied by \bbStudions.
477 % ==========================================
478 \subsubsection{Command line help}
479 % ==========================================
482 The 'working' area (the left one, as opposed to the 'help' area, on the right side) is composed of :
483 one single line area (\texttt{Command}), at the bottom, in which you can enter your commands and
484 a multiple line zone in which the Command interpreter prints out the result of your commands.
485 %The upper part contains the script editor; we shall not use it right now, you may reduce it.
486 Command line help for the black box scripting language (\bbsns) can be obtained
487 in this zone (see \ref{Scripting}).
489 % ==========================================
490 \subsubsection{Guides}
491 % ==========================================
493 An html version of all the guides is browsable in the \texttt{Help} part of \bbStudions.
495 \item {\bf\emph{User's Guide}} : This guide !
496 \item {\bf\emph{Package Developper's Guide}} : Step to step How-to for programmer who wants to create his own
497 black boxes/packages.
498 % \item {\bf\emph{Developper's Guide}} : For bbtk kernel developpers only. (This one is probably not very much
499 % up-to-date, since we spend more time in developping than writing documentation that's not of user concern).
500 % \item {\bf\emph{Reference Manual}} : Contains a exaustive description of all the features for all the commands.
501 %\item {\bf\emph{Booklet}} : Vade mecum.
502 \item {\bf\emph{Doxygen Documentation}} : Doxygen source browser.\\ Automatically generated from source files. Should only concern the kernel developpers.
508 % ==========================================
509 \subsubsection{Boxes Help}
510 % ==========================================
511 Lists of currently available boxes from installed packages
513 \item {\bf\emph{Alphabetical list}} : %This is the 'zero-level' of retrieving.
514 \item {\bf\emph{List by package}} Boxes indexed by package
515 \item {\bf\emph{List by category}} :
516 Each box is indexed by a list of keywords, called 'categories', such as '\texttt{read/write}',
517 '\texttt{filter}', '\texttt{viewer}', ...
518 A given box may belong to more than one \texttt{category}, however some categories are mutually exclusive.
519 Standard categories are :
521 \item\texttt{atomic box}/\texttt{complex box}\\
522 Whether it's an 'atomic' unit written is C++ and available in binary form in a package or it's an assembly of several black boxes (atomic or complex) which is described in \bbs script language.\\
523 Any box is either atomic ou complex.\\
524 Any pipeline described in a \bbs script is itself viewed as a complex black box hence is tagged as belonging to this category.
525 \item\texttt{example} / \texttt{demo} / \texttt{application}\\
526 These ones are scripts which produce a result when executed (i.e. they
527 execute a pipeline like \texttt{exampleSlider} above), as oposite to the scripts which only define complex boxes but do not instanciate and execute boxes.
529 \item\texttt{example} : It's just a (simple) example, for programmers, on how to use a given feature. The \texttt{Examples} link on the starting page links to the list of the boxes of this category.
530 \item\texttt{demo} : It can be a 'good looking' (a.k.a 'sexy') example on some sophisticated work, done only by using \texttt{bbtk}. The \texttt{Demos} link on the starting page links to the list of the boxes of this category.
531 \item\texttt{application} : It's a final application, end user intended (e.g. Subscale a huge volume without loading it in memory, Crop a DICOM image, etc.)
533 \item\texttt{widget} : A piece of graphical interface (based on \texttt{wxWidgets})
534 \item\texttt{dicom} : Dicom medical image-related box.
535 \item\texttt{viewer} : A box allowing to view something (e.g. an image).
536 \item\texttt{read/write} : An I/O-related box
537 \item\texttt{mesh} : A mesh-related box
538 \item\texttt{filter} : A filter, mainly image filters.
539 \item\texttt{image} : An image-related box
540 \item\texttt{3D object creator} : A box which creates a 3D object to be injected into a 3D view (e.g. a plane, a surface).
541 \item\texttt{math} : Math
542 \item\texttt{misc} : Miscellaneous...
544 Remark that the list of categories is 'auto-extensible' : each time a new box is created which belongs to a new category and the boxes list is regenerated, then the new category appears in the list, holding the new box. The above list only contains the categories used in the packages provided with current \bbtk release.
545 \item {\bf\emph{ List of adaptors}} : The adaptors are a special type of black box which are used internaly to perform type conversions. Thought there are not end user intended, you may see their list. Adaptors belong to the \texttt{adaptor} category.
548 % ==========================================
549 \subsubsection{The Package Browser}
550 \label{Package_Browser}
551 % ==========================================
553 The package browser is a standalone application which
554 dynamically loads and queries the available packages.
555 It is thus a smarter tool than the static html documentation.
556 You can run it with the command \texttt{bbPackageBrowser}
557 or in \bbStudio using either the button of the 'Command' part
558 or the menu entry 'Windows$>$Start Package Browser'.
559 Remark that it may take some time to start because it loads all available
561 Its appearance is reproduced in figure \ref{imPackage_Browser}.
564 \caption{\label{imPackage_Browser}The Package Browser}
566 \includegraphics[width=0.6\textwidth]{Package_Browser.png}
570 It allows you to find boxes using a multi-criteria filtering principle :
571 The boxes listed are the one whose attributes match \emph{all} the
572 words entered in the 'Filter' part.
573 You can get the whole description of a given box clicking on its name.
578 \item It's case sensitive, i.e '\texttt{Button}'
579 will give different results than '\texttt{button}'
580 \item You have to press enter in the filter zone to update the boxes list
581 \item A filtering string only has to match a subpart of the related attribute of a box.
582 For example, entering 'utt' in the 'Name' attribute will match a box called 'Button'.
588 \item Package : The name of the package to which the box belongs (e.g. \texttt{wxvtk}, \texttt{std})
589 \item Name : The name of a box or an application (e.g. \texttt{Reader}, \texttt{example})
590 \item Description : A part of the description of a box (e.g. \texttt{3D}, \texttt{image})
591 \item Category : The categories of the box (e.g. \texttt{demo})
592 \item Input/Output Type : The \CPP type of an input or output (e.g. \texttt{int}, \texttt{vtkImageData*}, \texttt{std::string})
593 \item Input/Output Nature : The \texttt{nature} of an input or output (e.g. \texttt{file name}, \texttt{signal})
596 %If 'Show widgets' is selected then
601 % ==============================================
602 \subsection{The Menu}
603 % ==============================================
605 At last, let's have a look at \bbStudio menu.(See figure \ref{themenu})
608 \caption{\label{themenu}The bbStudio menu}
610 \includegraphics[width=0.7\textwidth]{themenu.png}
617 \item{\texttt{Open the bbtk configuration file}}
620 \item{\texttt{Tools}}
622 \item{\texttt{Create package}} :
623 Provides a graphical interface to help package developpers to create a new empty package.
624 \item{\texttt{Create black box}}
625 Provides a graphical interface to help package developpers to create a new empty black box, and add it to an already existing package.
626 \item{\texttt{Plug Package}}
627 Incorporates a package into the list of known packages. Updates the html documentation.
628 \item{\texttt{Regenerate package doc}} :
629 If a package has changed (e.g. new boxes) this updates the package html documentation.
630 \item{\texttt{Regenerate boxes list}} :
631 Updates the boxes lists (alphabetical, by package, ...)
632 \item{\texttt{Regenerate all}}
633 Regenerates all the packages documentations and the boxes lists (may be long...).
634 \item{\texttt{Show last graph}}
635 Shows the last pipeline graph that was generated
637 \item{\texttt{Options}}
639 \item{\texttt{Reset before running}} Before running a script, all the already created boxes are destroyed,
640 all the already loaded packages are unloaded (this is the recomended option).
642 \item{\texttt{Windows}}
643 User may decide, for any reason of his own, to hide one or more panels:
645 \item{\texttt{Show 'Files' panel}}
646 \item{\texttt{Show 'Help' panel}}
647 \item{\texttt{Show 'Command' panel}}
648 \item{\texttt{Show 'Messages' panel}}
649 \item{\texttt{Start Package browser}} : starts the package browser (see \ref{Package_Browser}).
651 \item{\texttt{About}}
653 \item{\texttt{About}} : Info about \texttt{bbStudio}.
660 % ==========================================
661 % ==========================================
662 % ==========================================
663 % ==========================================
666 \section{Writing black box scripts (\bbsns)}
668 % ==========================================
669 % ==========================================
670 % ==========================================
672 This section introduces how to write down black box scripts (\bbsns)
673 to create and execute pipelines.
675 % ==========================================
676 \subsection{The commands}
677 % ==========================================
678 In \bbStudio, try typing in the \texttt{Command} area (in what follows,
679 the commands entered by the user will be preceded by a prompt \textgreater) :
684 you get the list of the commands of the interpreter :
717 To get help on a particular command type \texttt{help <command-name>},
725 usage : author <string>
726 Adds the string <string> to the author information of the black box being defined
729 The \texttt{help} command has multiple usages.
730 It is used to get help about almost anything in the interpreter!
731 Type \texttt{'help help'} to get help on the \texttt{help} command itself :
736 (2) help <command name>
737 (3) help packages [all]
738 (4) help <package name> [all]
739 (5) help <black box type>
740 (6) help <black box name>
742 (1) Lists all available commands;
743 (2) Prints help on a particular command;
744 (3) Lists the packages loaded and their black boxes.
745 Add 'all' to list adaptors;
746 (4) Prints short help on the black boxes of a package.
747 Add 'all' to include adaptors;
748 (5) Prints full help on a black box type;
749 (6) Prints information on the inputs, outputs and connectionns
750 of a black box instance.
753 %More information about what is a 'box' will be given in the 'Scripting' part of this manual.
756 % ==========================================
757 \subsection{Creating and executing black boxes}
758 % ==========================================
760 At start the interpreter does not know any black box.
761 If you type \texttt{'help packages'}, which is
762 the third form of the \texttt{help} command, you get :
769 which means that the interpretor only knows one package
770 (library of black boxes) called \texttt{user}
771 and which contains a black box called \texttt{workspace}.
772 The \texttt{user} package is an internal package of the interpreter,
773 which stores user-defined black box types.
774 At start, it already contains
775 one box, called \texttt{workspace}.
776 \texttt{workspace} is a special type of black box,
777 called complex black box, whose purpose is
778 to store other black boxes.
779 Any black box you create in \bbStudio is stored
780 in \texttt{workspace}
781 (this will be explained in details in sections
782 \ref{bbi-writing-scripts} and
783 \ref{bbi-more-on-complex-black-boxes}).
785 If you type \texttt{'help workspace'}, you get :
788 Complex Black Box <user::workspace>
791 Category(s) : complex box;
797 In the text displayed,
798 the \texttt{user::} prepended to the name \texttt{workspace}
799 means that the box \texttt{workspace}
800 belongs to the \texttt{user} package.
801 Then comes a description and three lines which
802 tell that \texttt{workspace} does not have any input
803 nor output nor boxes yet.
805 In order to let the interpreter know of some black boxes,
806 you must load another package.
807 The \texttt{std} package is the ``standard'' package,
808 which contains basic useful black boxes.
820 you get something like :
825 ASCII : ascii codes sequence to string - string to ascii...
826 Add : Adds its inputs
827 ConcatStrings : String concatenation
828 Configuration : Gets configuration informations
829 Div : Divides its inputs
830 ExecBbiCommand : Executes bbi commands
831 ExecSystemCommand : Executes system (O.S.) commands
832 GetVectorCharElement : Gets the i-th element from the input vector (std...
834 MagicBox : Takes *any kind* of data and copies it to its ou...
835 MakeFileName : Makes a kosher file name
836 Mul : Multiplies its inputs
837 MultipleInputs : This box has multiple Void inputs and one Void o...
838 StringRelay : Just copies the value of its input to its output...
839 StringSelect : Outputs the string set to the ith input Ini (In0...
844 Now the interpreter knows the package \texttt{std} and the black boxes it provides,
845 such as the \texttt{Add} box, the \texttt{ConcatStrings} box, and so on. Remark that the
846 content of \texttt{std} may vary from one version to another
847 as new black boxes might be added to it.
853 You'll get a text help, in the 'Message' part :
857 By : laurent.guigues@creatis.insa-lyon.fr
858 Categories : atomic box;math;
860 'BoxExecute' <bbtk::Void> [signal] : Any signal received by this input
862 'BoxProcessMode' <String> [] : Sets the processing mode of the box
863 (Pipeline | Always | Reactive)
864 'In1' <Double> [] : First number to add
865 'In2' <Double> [] : Second number to add
867 'BoxChange' <bbtk::VoidS> [signal] : Signals modifications of the box
868 'Out' <Double> [] : Result
871 After loading the package it belongs to, you can create an \emph{instance} of an \texttt{Add} box by
872 the command \texttt{new} :
878 The \texttt{'a'} at the end is the \emph{name} of the instance,
879 which will be used to reference it later.
880 It is important to distinguish a box \emph{type}
881 and an \emph{instance} of a box type.
882 The \texttt{Add} box of the package \texttt{std} is actually
883 a \emph{box type} , like \texttt{int} is a data type
884 in \texttt{C} langage. The \texttt{new} command allows to create
885 an instance of a box type, exactly like \texttt{int i;} in
886 a \texttt{C} code declares a variable of type \texttt{int} whose
888 Of course, like in \texttt{C} Language, you can declare multiple boxes of the
889 same type in \bbi. \\
891 After the creation of the box \texttt{a}, type :
898 Complex Black Box <user::workspace>
901 Category(s) : complex box;
908 which means that \bbi workspace now contains a black box named \texttt{a},
909 of type \texttt{std::Add}.
916 and have a look to the 'Help' Part (see figure : \ref{HelpAdd})
919 \caption{\label{HelpAdd}The html Help}
921 \includegraphics[width=0.7\textwidth]{HelpAdd.png}
926 You can see a description
927 (the one which was provided by the author of the box),
928 the author(s) of the box (usually e-mail adress(es)) and
929 the categories to which the box belongs.
930 Finally comes the lists of inputs and outputs of the box.
931 For each input or output, \bbi provides
933 its \emph{type} (between \texttt{<} and \texttt{>}, e.g. \texttt{<Int>})
935 Remark that the box \texttt{Add} is not a 'complex' black box
936 but an 'atomic' box, hence its help does not
937 include a pipeline graph.
939 You can see that \texttt{Add} boxes have two inputs,
940 with name \texttt{In1} and \texttt{In2},
941 and an output, with name \texttt{Out}.
943 You can set the input \texttt{In1}
944 of the \texttt{Add} box \texttt{a} to the value $1$
950 Similarly, setting the input \texttt{In2} of \texttt{a} to the value $2$
956 And you print the output \texttt{Out} of the box \texttt{a} with :
958 > print "result=$a.Out$"
962 In the string passed to the \texttt{print} command,
963 each substring enclosed between a couple of \$ is considered
964 as the name of an output of a box.
965 To process this special substrings, the interpretor :
967 \item Processes the box if needed (see below)
968 \item Converts the output of the box to a string if possible
970 \item Substitutes the result in the string to print
971 \item Postpones an implicit 'new line' character to the string
976 Box processing is needed if :
979 \item either at least input has changed since last processing
980 \item or the input \texttt{'BoxProcessMode'} of the box is set to
981 \texttt{'Always'}, which forces box reprocessing.
984 Note that all boxes have an input named \texttt{'BoxProcessMode'}.
986 Another way to process the box \texttt{a} is to issue the command :
991 however this command does not display anything (except if the
992 box itself displays something in its processing).
993 It just processes the box if needed.
994 This command is used to execute boxes that do not have any output,
995 such as boxes that write something to a file or, display a
996 graphical interface, and so on. \newline
998 %To exit \bbi, type :
1006 % ==========================================
1012 \item The \texttt{include} command allows to load a package, and the complex black boxes that come with it..
1013 \item \texttt{help} gives help on :
1015 \item Available commands if you just type \texttt{help}.
1016 \item A particular command if you type \texttt{help <command-name>}.
1017 \item All available packages and their boxes (without description) if you type \texttt{help packages}.
1018 \item A particular package and its boxes (with brief description) if you type \texttt{help <package-name>}.
1019 \item A particular black box type (with full description) if you type \texttt{help <box-type-name>}. In particular, \texttt{help workspace} displays information on the content of the \texttt{'workspace'} black box, which stores the boxes created by the user (by \texttt{new}).
1021 %\item \texttt{list} displays the list of black box instances created so far (by \texttt{new}).
1022 \item \texttt{new} : creates an instance of a black box.
1023 \item \texttt{set} : sets the value of an input of a black box.
1024 \item Under any component of \bbStudions, to reference the input called \texttt{i}
1025 of a black box called \texttt{b} you must type \texttt{'b.i'}.
1026 The same syntax holds for outputs.
1027 \item \texttt{print} : prints a string, substituting each substring of the form \$b.o\$ by the value of the output \texttt{o} of the black box \texttt{b}. Note that an
1028 implicit trailing 'new line character' is added at the final string.
1029 \item \texttt{exec} : runs, if needed, the process of a box.
1030 %\item \texttt{quit} : quits \bbi.
1035 %A more 'modern' way to proceed is to run \texttt{bbStudio}, drag and drop the \texttt{Command} bookmark to the lower \texttt{Welcome to bbStudio!} bar.
1036 %Wou'll get something like in figure \ref{bbCommandPlusHelp} :
1038 %\begin{figure}[!ht]
1039 %\caption{\label{bbCommandPlusHelp}
1040 %An other way to run the command interpreter}
1042 %\includegraphics[width=0.5\textwidth]{bbCommandPlusHelp.png}
1046 % ==========================================
1048 % ==========================================
1049 \subsection{Connecting black boxes}
1050 \label{bbi-connecting-black-boxes}
1051 % ==========================================
1053 \BBTK allows to create
1054 and execute processing chains,
1055 also called \emph{pipelines},
1056 by connecting black boxes.
1057 This section explains how to do it with examples.
1058 Read section \ref{bbi-more-on-pipeline-processing} to get
1059 more information on pipeline processing.
1061 First start \bbStudio and load the package \texttt{std}, typing :
1065 in the 'Command' part.
1067 Assume you want to compute $1+2+3$. You can do it by
1068 chaining two \texttt{Add} boxes, as shown in figure
1069 \ref{bbi-fig-connecting-black-boxes-1}.
1072 \caption{\label{bbi-fig-connecting-black-boxes-1} A simple pipeline which adds 3 numbers}
1074 \includegraphics[width=0.5\textwidth]{1plus2plus3.png}
1079 The \bbi instructions to create and execute this pipeline are :
1083 > connect a.Out b.In1
1090 You will see the (very expected) result :
1095 The first three commands build the pipeline,
1096 the next three set \texttt{a} and \texttt{b} black boxes inputs and the last one
1097 prints \texttt{b} black box output (the pipeline is executed before printing, because the interpretor 'knows' the box \texttt{b},
1098 whose output is requested, is not up to date).
1100 The command \texttt{'connect a.Out b.In1'} ``plugs'' the output
1101 \texttt{Out} of the box \texttt{a} into the input \texttt{In1} of the
1103 Once the boxes are connected, the processing of the two boxes are chained :
1104 getting the output of \texttt{b} requires getting its inputs,
1105 hence getting the output of \texttt{a} which is connected to it.
1106 This pipeline mechanism can recurse into arbitrary long
1107 chains of boxes (see \ref{bbi-more-on-pipeline-processing}
1111 Lets' consider an other, more image oriented, example :
1119 > new FileSelector fileDialog
1120 > new ImageReader reader
1122 > new Viewer2D viewer
1124 > connect fileDialog.Out reader.In
1125 > connect reader.Out viewer.In
1126 > connect slider.Out viewer.Slice
1127 > connect slider.BoxChange viewer.BoxExecute
1132 Some explainations : the \texttt{include} instructions load the necessary packages. \\
1134 \texttt{FileSelector} will pop a File Selector, at run time, that will out the user chosen file name. \\
1135 \texttt{Slider} will pop a Slider, at run time, that will out an integer, used later as a slice number.\\
1136 \texttt{ImageReader} will read any itk readable file, whose name is passed as a std::string, and return a pointer on an itk image.\\
1137 \texttt{Viewer2D} displays a plane, whose number is specified by an integer.\\
1139 \texttt{connect fileDialog.Out reader.In} plugs the output of the File Selector (a std::string) to the input of the reader (a std::string, too).\\
1140 \texttt{connect reader.Out viewer.In} plugs the output of the reader (an bbtk::any<bbitk::ImagePointer> which is a type defined by the
1141 itk package which can hold any itk image pointer) to the input of the Viewer (a vtkImageData *)\\
1142 \texttt{connect slider.Out viewer.Slice} plugs the output of the slider (an int) to an other output (named Slide) of the viewer.\\
1143 \texttt{connect slider.BoxChange viewer.BoxExecute} says the viewer that it must re process itself any time the slider is modified.\\
1145 \texttt{exec viewer} processes the viewer.
1148 This would correspond to the graph in figure \ref{bbi-simplegraph}
1152 \caption{\label{bbi-simplegraph}(Very) simple Graph of a (very) simple pipeline}
1154 \includegraphics[width=0.8\textwidth]{bbi-simplegraph.png}
1158 Of course, to be able to connect two boxes,
1159 the output and the input must be compatibles.
1160 You can always connect an output to an input of the \emph{same} type,
1161 but you can do more, thanks to particular (hidden) black boxes called {\bf adaptors}.
1163 An adaptor is a black box which has at least one input, called \texttt{In},
1164 and at least one ouput called \texttt{Out} and whose role is to convert
1165 a data of the type of \texttt{In}
1166 into a data of the type of \texttt{Out} (other inputs or outputs may serve
1167 to parameter the adaptor or retreive other useful information).
1169 Under \bbStudions, if you type :
1176 Package std v1.0.0 - laurent.guigues@creatis.insa-lyon.fr
1177 Basic useful black boxes
1180 BoolToString [DA] : Converts a Bool (bool) into a string
1181 CastBoolToChar [DA] : Static cast from Bool (bool) to Char (signed c...
1182 CastBoolToDouble [DA] : Static cast from Bool (bool) to Double (double...
1184 CastBoolToUChar [DA] : Static cast from Bool (bool) to UChar (unsigne...
1185 CastBoolToUInt [DA] : Static cast from Bool (bool) to UInt (unsigned...
1187 CastUIntToBool [DA] : Static cast from UInt (unsigned int) to Bool (...
1188 CastUIntToChar [DA] : Static cast from UInt (unsigned int) to Char (...
1189 CastUIntToDouble [DA] : Static cast from UInt (unsigned int) to Double...
1194 \texttt{[DA]} stands for \emph{default adaptor}.
1196 Once you have loaded the package \texttt{std}, you can
1197 plug an output of type \texttt{char} into an input of type \texttt{double}.
1198 When the interpreter encounters the \texttt{connect} command,
1199 it looks for an adequate \emph{adaptor} in the loaded packages.
1200 In our case, as the package \texttt{std} provides the
1201 \texttt{CastUCharToDouble} adaptor, the interpreter automatically creates an
1202 instance of this adaptor and place it \emph{between}
1203 the output and the input you want to connect
1204 (however this adaptor is hidden to you,
1205 it is embedded into the created connection and does not appear
1206 as an existing black box).
1207 When the pipeline is processed the
1208 adaptor converts the output data into the required input type,
1209 in a totally transparent way.
1210 In our example, the \texttt{CastUCharToDouble} adaptor
1211 would simply cast the value of the \texttt{char} into a \texttt{double},
1212 however arbitrarily complex type conversion may be done.\\
1213 \texttt{WARNING} : these adaptors are \texttt{C++ static cast}, i.e., there is, right now,
1214 no 'intelligent' conversion (only truncation) e.g. think to \texttt{CastDoubleToUChar}!
1217 %Question (for info-dev):
1218 %if two adaptors with the same input and output types exist
1219 %in two different packages, currenly loaded,
1220 %which one is chosen by the interpreter at connection time?
1221 %A feature is missing to specify explicitely which one user wants to choose
1222 %(use a namespace notation ?)
1224 %-> Role of default adaptors
1227 Note that the \texttt{set} and \texttt{print} commands of interpreter
1228 work with adaptors from \texttt{string} to the type of the input to set
1229 or from the type of the output to print to \texttt{string}.
1230 Hence in order to \texttt{set} or \texttt{print} values the adequate
1231 adaptors must be available in the packages currently loaded. \\
1234 % ==========================================
1239 \item The \texttt{connect} command allows to connect two black boxes
1240 \item You can connect two black boxes if (and only if) :
1242 \item The output and the input are of the same type, or
1243 \item There is an adaptor black box in the packages loaded which
1244 converts data of the output type into data of the input type
1246 \item \texttt{help <package name>} does not display the adaptors of the package. To see them use : \texttt{help <package name> all}.
1250 % ==========================================
1252 % ==========================================
1253 \subsection{Creating complex black boxes}
1254 \label{bbi-complex-black-boxes}
1255 % ==========================================
1257 Remember the pipeline of figure
1258 \ref{bbi-fig-connecting-black-boxes-1}, which
1259 computed the sum of three doubles.
1260 You can consider it as a whole and define
1261 a new black box type, which will be a \emph{complex black box},
1262 having three inputs and one output,
1263 as shown in figure \ref{bbi-fig-complex-black-box-1}.
1266 \caption{\label{bbi-fig-complex-black-box-1} Creating the complex black box \texttt{Add3}}
1268 \includegraphics[width=0.5\textwidth]{Add3.png}
1272 The \bbi commands to define this complex black box are
1282 > connect a.Out b.In1
1285 > description "adds 3 doubles"
1286 > input x a.In1 "first double to add"
1287 > input y a.In2 "second double to add"
1288 > input z b.In2 "third double to add"
1289 > output result b.Out "output"
1296 As we will use \texttt{Add} boxes, we need to load the package \texttt{std}, which is done in first line.
1298 The command \texttt{define} then starts the definition
1299 of the complex box type, which will be called \texttt{Add3}.
1301 The next three lines define the pipeline,
1302 exactly in the same way than outside a complex box definition.
1304 The commands \texttt{author}, \texttt{description}, \texttt{input}
1305 and \texttt{output} are commands specific to complex boxes definition :
1307 \texttt{author} and \texttt{description} are used for the documentation
1308 of the new box. You can provide multiple \texttt{author} or
1309 \texttt{description} commands, the arguments of the commands will
1310 be concatenated to produce the final author and description strings.
1312 \texttt{input} and \texttt{output} are used to define the inputs and outputs
1313 of the new complex box.
1314 Their syntax is the same : for each new input/output you need to say
1315 to which internal input/output it corresponds and to provide
1316 a help string documenting the input/output.
1317 In our example, we define that the box \texttt{Add3} has
1318 three inputs : \texttt{x}, \texttt{y} and \texttt{z}.
1319 The input \texttt{x} corresponds to the input \texttt{In1} of the
1320 internal box \texttt{a}.
1321 In the same way, the external input \texttt{y}
1322 corresponds to the internal input \texttt{a.In2}, and
1323 the external input \texttt{In3} to \texttt{b.In2}.
1324 The only output of the new box is called \texttt{result}
1325 and corresponds to \texttt{b.Out}.
1326 The figure \ref{bbi-fig-complex-black-box-1}
1327 illustrates the external to internal
1328 input/output correspondence.
1330 Finally, the \texttt{endefine} command ends the definition of the
1333 After this definition, if you ask for help
1334 on packages, you get :
1345 The \texttt{user} package now contains a new black box type, called
1346 \texttt{Add3}. If you ask for help on this type of box, you get :
1349 Complex Black Box <user::Add3>
1353 'x' <double> : first double to add
1354 'y' <double> : second double to add
1355 'z' <double> : third double to add
1357 'result' <double> : output
1363 and you can use it like any other box, for example type :
1375 As a side note, we can say that, for consistency reasons, it would have been better to name
1376 \texttt{In1}, \texttt{In2} and \texttt{In3} the inputs of the black box \texttt{Add3},
1377 since all the 'natural entry' of a box is named \texttt{In}, or \texttt{In}\emph{x} if there are more than one 'natural
1381 % ==========================================
1386 \item The \texttt{define/endefine} commands allows to define complex black box types, i.e. types of black boxes made up of other black boxes.
1387 Inside a \texttt{define/endefine} block :
1389 \item The \texttt{author} and \texttt{description} commands allow to document the new type of box
1390 \item The \texttt{input} and \texttt{output} commands allow to define the inputs and outputs of the new type of box, that is to which inputs and outputs
1391 of internal boxes they correspond.
1395 % ==========================================
1397 % ==========================================
1398 \subsection{Writing scripts files}
1399 \label{bbi-writing-scripts}
1400 % ==========================================
1402 Once you have defined a new type of complex box, you
1403 may like to reuse it. To do this, you can simply
1404 write the \bbs commands defining the new box
1405 into a text file and afterwards include that file in \bbins.
1406 Doing this, you start writing \bbs scripts.
1407 The conventional (and mandatory) extension for such scripts is \texttt{bbs}
1409 For consistency reasons, you are requested to prepend \texttt{bb} to the name.
1411 For example, the \texttt{Add3} complex box we previously worked on
1412 can be defined in the \texttt{bbAdd3.bbs} file :
1414 \begin{file}{bbAdd3.bbs}
1416 # Defines the Add3 black box which adds 3 doubles
1422 description "adds 3 doubles"
1428 input x a.In1 "first double to add
1429 input y a.In2 "second double to add
1430 input z b.In2 "third double to add"
1432 output result b.Out "output"
1437 Lines starting with a \texttt{\#} character or a \texttt{\//\//} character are ignored, they
1438 are considered as comments by the interpreter.
1439 To use this file in \bbStudions, click on the \texttt{include} button, and browse your filestore to find the file.
1442 > include bbAdd3.bbs
1444 Complex Black Box <user::Add3>
1448 'x' <double> : first double to add
1449 'y' <double> : second double to add
1450 'z' <double> : third double to add
1452 'result' <double> : output
1460 If the file has the \texttt{bbs} extension, you can ommit it and just type :
1465 \subsection{Creating complex black boxes that use complex black boxes}
1466 \label{bbi-complex-complex-black-boxes}
1469 Of course, you can include script files in other script files,
1470 like in the following example :
1472 \begin{file}{bbAdd4.bbs}
1474 # Defines the Add4 black box which adds 4 doubles
1479 description "adds 4 doubles"
1483 input In1 a.In1 "first double to add
1484 input In2 a.In2 "second double to add
1485 input In3 a.In3 "third double to add"
1486 input In4 b.In2 "fourth double to add"
1487 output Out b.Out "output"
1493 The inner boxes have they own entries (In1, In2, In3 for box a, In1, In2 for box b )\\
1494 Only the inputs In1, In2, In3 of box a and the input In2 of box b is of interest for the end user, but he dosn't want to have to
1495 care neither about the inner boxes name, nor about the names of their Inputs.\\
1496 The writer of the complex box has the ability to give these inputs a meaningfull name !
1498 input In3 a.In3 "third double to add"
1499 input In4 b.In2 "fourth double to add"
1503 \subsection{Naming Conventions}
1504 \label{bbi-Naming Conventions}
1507 % ==========================================
1509 %\paragraph{Naming Conventions}
1513 % ==========================================
1517 For consistency reasons, you are requested to prepend \texttt{bb}, and postpone an extention \texttt{.bbs},
1518 to the names of the files that hold a \texttt{complex black box} definition.
1520 For example, the \texttt{Add3} complex box we previously worked on
1521 can be defined in the \texttt{bbAdd3.bbs} file.
1524 For consistency reasons, the names of dynamic libraries holding the packages start by \texttt{bb}.
1525 For instance, the package \texttt{wx} will be in the library \texttt{bbwx.dll} (Windows) or \texttt{libbbwx.so}
1530 % ==========================================
1536 \item The \texttt{include} command tells the interpreter to include a script file.
1537 \item Lines starting with a \texttt{\#} or with a \texttt{\//\//} are considered as comments by the interpreter.
1538 \item Lines between a line starting with a \texttt{\//*} an a line ending with a \texttt{*\//} are considered as comments by the interpreter.
1542 % ==========================================
1544 % ==========================================
1545 \subsection{Creating command line applications}
1546 \label{bbi-command-line-app}
1547 % ==========================================
1549 Now that you know how to create complex black boxes
1550 (with \texttt{define/endefine}), think
1551 back to the \texttt{workspace} object.
1552 Remember that it is also
1553 a \texttt{complex black box}.
1554 Actually, when you type interpreter commands
1555 outside a \texttt{define/endefine} block,
1556 you progressively define the \texttt{workspace}
1558 You can think of it like if at start the interpreter
1559 was issuing a command \texttt{'define workspace'}
1560 and then letting you define the interior of the box
1563 Remember that the command \texttt{inputs}
1564 allows to define an input of a complex box.
1565 Now, if you use the command \texttt{input}
1566 outside a \texttt{define/endefine} block then
1567 it defines an input of the \texttt{workspace} box,
1568 that is an input of the \emph{main program}.
1569 This input will then be connected to the
1570 parameters that the user passes to the command line.
1572 For example, consider the script :
1574 \begin{file}{add.bbs}
1578 input x a.In1 "first number to add"
1579 input y a.In2 "second number to add"
1584 The third and fourth lines define two inputs \texttt{x}
1585 and \texttt{y}. When you execute this script,
1586 you can pass these two arguments on the command line,
1594 You can also invoke \bbi the option \texttt{-h},
1595 which gives help on the \texttt{workspace} box :
1602 'x' <double> : first number to add
1603 'y' <double> : second number to add
1606 To get a better help, use the \texttt{description}
1607 and \texttt{author} commands :
1609 \begin{file}{add.bbs}
1611 description "Adds two numbers"
1612 author "foo@bar.com"
1615 input x a.In1 "first number to add"
1616 input y a.In2 "second number to add"
1621 Now if you ask for help on the \texttt{add} script, you get :
1628 'x' <double> : first number to add
1629 'y' <double> : second number to add
1632 Rather than getting the inputs of a script
1633 from the command line, you can ask \bbi to
1634 prompt the user for the values, using the \texttt{-t}
1639 x=[the program waits for user answer]2
1640 y=[the program waits for user answer]5
1644 You can also use the \texttt{-g} commutator.
1645 \bbi then prompts the user in graphical mode,
1646 displaying a dialog box for each input,
1647 like in fig. \ref{bb-input-dialog-box}.
1650 \caption{\label{bb-input-dialog-box}Input dialog box}
1652 \includegraphics[width=0.6\textwidth]{enter-the-value-of-x.png}
1656 Note that for both \texttt{-t} and \texttt{-g} options,
1657 the input from the user is a \texttt{string} and
1658 \bbi converts it to the right input type using
1659 an \texttt{adaptor}, hence the right adaptors must be loaded.
1661 % ==========================================
1666 \item The \texttt{input}, \texttt{description} and \texttt{author} commands,
1667 when they are used outside a \texttt{define/endefine} block allow
1668 to define the inputs, description and author of the main program.
1669 \item Inputs of the main program can be passed on the command line
1670 using the syntax \texttt{<input-name>=<value>}.
1671 No white space is allowed, if the value or the input name
1672 contains white spaces, enclose them
1673 between double quotes, e.g. \texttt{"parameter with white spaces = gnu's not unix"}.
1674 \item The \texttt{-h} option of \bbi prints help on the main program.
1675 \item The \texttt{-t} option of \bbi orders the program to prompt for its inputs in text mode.
1676 \item The \texttt{-g} option of \bbi orders the program to prompt for its inputs in graphical mode.
1679 % ==========================================
1681 % ==========================================
1682 \subsection{Using graphical interface boxes (widget boxes)}
1684 % ==========================================
1686 % ==========================================
1687 %\subsubsection{Overview}
1688 %\label{bbi-overview}
1689 % ==========================================
1691 Basic graphical interface components are provided in the package \texttt{wx},
1692 such as buttons, sliders, file open/save dialogs, etc.
1694 As first example, type the following commands in \bbi :
1701 When you type \texttt{enter} after the last line,
1702 a window pops up in which you can entrer a text.
1703 When you close the window, the text you entered is printed by
1704 the \texttt{print} command.
1706 Type \texttt{help wx}, you get something like :
1708 Package wx v1.0.0- info-dev@creatis.insa-lyon.fr
1709 Basic graphical interface elements (sliders, buttons ...) based on wxWidgets
1711 ColourSelector : Colour Selector dialog (bbfication of wxColourSele...
1712 ColourSelectorButton : A button which displays a colour picker dialog whe...
1713 CommandButton : Button which executes bbi commands
1714 DirectorySelector : Pops up a directory selection dialog (wxDirDialog)
1715 FileSelector : Pops up a file selection dialog for reading or sav...
1716 InputText : A zone in which the user can enter a text (wxTextC...
1717 LayoutLine : LayoutLine widget (wxBoxSizer)
1718 LayoutSplit : Widget which splits a window in two fixed size par...
1719 LayoutTab : LayoutTab widget (wxNotebook)
1720 OutputText : Text zone to be inserted into a window (wxStaticTe...
1721 RadioButton : RadioButton group widget 0-9 entries
1722 Slider : Slider widget (wxSlider)
1725 You can reproduce the same experiment as above using a
1726 \texttt{Slider} or a \texttt{FileDialog} rather than a \texttt{InputText}..
1729 %There are two kinds of widgets : ``terminal'' widgets and ``container'' widgets.
1730 %The \texttt{InputText}, \texttt{FileDialog} or \texttt{Slider} widgets
1731 %are ``terminal'' widgets.
1732 %``container'' widgets are of another kind : they are
1733 % ==========================================
1734 %\subsubsection{Layout widgets}
1735 %\label{bbi-layout-widgets}
1736 % ==========================================
1738 There is a special kind of widget, called '\texttt{Layout}', designed to
1739 contain other widgets in order to build larger dialog boxes.
1741 For example, the \texttt{LayoutSplit} widget is a container which
1742 ``splits'' a window into two parts, either horizontally or vertically,
1743 each part including another widget.
1744 The initial size of the two parts can be fixed by the input 'Proportion'
1745 and be adjusted by the user thanks to a ``handle''.
1747 The example \texttt{exampleLayoutSplit} demonstrates its use.
1748 Run it : it displays a window with two sliders.
1749 Move the sliders and close the window.
1750 Now look at the source file to see how this is done :
1752 \begin{file}{scripts/test/testSplit.bbs}
1760 connect s1.Widget s.Widget1
1761 connect s2.Widget s.Widget2
1767 First, the two sliders \texttt{s1} and \texttt{s2} are created.
1768 A \texttt{LayoutSplit} box \texttt{s} is also created.
1769 The \texttt{connect} commands then ``includes'' the sliders in the
1771 The input \texttt{Widget} is common to all widget boxes :
1772 every widget can be inserted into another widget.
1773 The outputs \texttt{Widget1},\texttt{Widget2} are specific of \emph{layout}
1775 (in \bbi type \texttt{help Slider} :
1776 you will see the output \texttt{Widget};
1777 type \texttt{help LayoutSplit} :
1778 you will see the inputs \texttt{Widget1} and \texttt{Widget2}
1779 and the output \texttt{Widget}).
1780 When you connect the \texttt{Widget} output of a box
1781 to the \texttt{Widget}i input of a layout widget,
1782 you order to include the widget in the layout.
1783 Of course, the order of connection is important.
1784 In our case, the slider \texttt{s1} is included first,
1785 then the slider \texttt{s2} : \texttt{s1} will be placed
1786 on top of \texttt{s2} (the \texttt{LayoutSplit} box is
1787 implemented that way, but this is arbitrary choice).
1789 Right now, there are only \emph{three} layout widgets in the \texttt{wx} package :
1791 \item {the \texttt{LayoutSplit} widget} we just described
1793 \item {the \texttt{LayoutLine} widget} can have multiple children
1794 (\texttt{Widget1}, \texttt{Widget2},\dots \texttt{Widget9} inputs) and
1795 divides its window into as much parts as children,
1796 each part of equal size.
1797 The orientation of the \texttt{LayoutSplit} or of the \texttt{LayoutLine} can be changed by the input \texttt{Orientation}.
1798 With only those two layout widgets you can already create
1799 complex dialog boxes
1800 (of course layouts can be nested, which leads to tree-like
1801 structures of widgets). \\
1802 See the script \texttt{exampleComplexLayoutSplit\_In\_LayoutSplit} for an example.
1804 \item {The \texttt{LayoutTab} widget} arranges its children
1805 in different pages or 'tabs' (\texttt{wxNotebook}-based).
1806 The label of each page is the name of the widget it contains.
1814 %One word about a special widget in the package \texttt{wx} :
1815 %the \texttt{Button}... to be continued.
1817 % ==========================================
1818 \subsection{Deeper in the boxes}
1819 \label{bbi-deep-box}
1820 % ==========================================
1822 \subsubsection{Default and mandatory inputs and outputs}
1824 \item Any \texttt{atomic} black box has two default Inputs, which are created by the system :
1826 \item {\bf\emph{BoxExecute}} : Any signal received by this input executes the box
1827 \item {\bf\emph{BoxProcessMode}} : Sets the processing mode of the box :
1829 \item {\bf\emph{Pipeline}} :% bbBackwardUpdate() calls Process() only if Status == MODIFIED \\
1830 The box executes itself only when an input was changed (normal pipeline processing).
1831 \item {\bf\emph{Reactive}} : %bbSetModifiedStatus() calls bbUpdate() \\
1832 Re-processes immediately when \emph{any input} changes.\\
1833 To be more selective, better use
1834 '\texttt{connect A.BoxChange B.BoxExecute}'.
1835 \item {\bf\emph{Always}} :% bbUpdate() always calls Process. \\
1836 Usefull for 'sources', that must be processed, even when no input changed (e.g. : FileSelector, ColorSelector)\\
1837 This one is not end user intended (for Package developer only)
1840 \item And one default output :
1842 \item {\bf\emph{BoxChange}} : Signals any modification of the box. This output may be connected if necessary to the \emph{BoxExecute}
1843 input of an other box : each time the boxes changes (e.g. a Slider is moved) the box it is connected to will be forced to update.
1846 If you create complex boxes, it is a good idea to define those inputs and outputs to be able
1847 to force the execution of your complex box or be aware of its changes...
1849 \item Any {\bf widget} box has five Inputs, that will be dealt with only if the box is not connected to the \emph{Widget}i of any \emph{Layout} box :
1851 \item {\bf\emph{WinHeight}} : Height of the window
1852 \item {\bf\emph{WinWidth}} : Width of the window
1853 \item {\bf\emph{WinTitle}} : Title of the window
1854 \item {\bf\emph{WinClose}} : Any received signal closes the window
1855 \item {\bf\emph{WinHide}} : Any received signal hides the window
1856 \item {\bf\emph{WinDialog}} : When set to 'true', creates a \emph{dialog window}, that blocks the pipeline until it is closed (\emph{modal})
1859 If you define a complex widget box, it is a good idea to define these inputs to be able
1860 to customize your window settings.
1862 \item Any {\bf widget} box has one mandatory Output :
1865 \item {\bf\emph{Widget}} : that is the \texttt{wxWindow} itself. If it's not connected to the \texttt{Widget}\emph{i} of any \emph{Layout box}, then the box will create its own window (frame or dialog) on execution. If it's connected to the \texttt{Widget}\texttt{\emph{i}} of a \texttt{Layout box},
1866 it will be embedded in its parent window.
1869 If you define a complex widget box, it is a good idea to use this standard name for your window output
1871 \item Any {\bf Layout} box (i.e. \emph{LayoutLine}, \emph{LayoutSplit} or \emph{LayoutTab}) has one or more mandatory Inputs :
1873 \item {\bf\emph{Widget}}\texttt{i} : e.g. a \emph{LayoutSplit} box (Widget which splits a window in two resizeable parts)
1874 has two Input parameters \emph{Widget1} and \emph{Widget2}, used to embed the child windows.\\
1875 e.g. a \emph{LayoutLine} divides the window in up to 9 (depending on the number of inputs \emph{Widget}i) fixed size parts.
1878 If you define a complex layout box, it is a good idea to use these standard names for your
1884 % ==========================================
1885 %\subsection{More on ...}
1886 %\label{bbi-more-on}
1887 % ==========================================
1889 % ==========================================
1890 %\subsubsection{Black box packages}
1891 %\label{bbi-more-on-packages}
1892 % ==========================================
1893 %There are various others user-intended packages :
1896 %---> Were moved in a 'Reference Manual' ?\\
1897 %---> Any suggestion welcome!
1905 % ==========================================
1906 %\subsubsection{Pipeline processing}
1907 %\label{bbi-more-on-pipeline-processing}
1908 % ==========================================
1910 %\item the ``control'' mechanism in bbi.
1912 %When a box is requested to update itself, it asks (recursively) each one of its inputs if it was modified.\\
1913 %In normal pipe-line mode, it will be re-processed if at least one of its imputs was actually modified, as the output of a previous box.
1915 %(switch exec commands, e.g. Button)
1916 %\item the role of ProcessMode to update widgets.
1919 %\subsubsection{Advanced issues}
1920 %\paragraph{Reducing the number of inputs of a box}
1922 % ==========================================
1923 %\subsubsection{Errors}
1924 %\label{bbi-more-on-errors}
1926 % ==========================================
1929 % ==========================================
1933 \section{Using third party Package}
1934 \label{Third_Party_Package}
1935 % ==========================================
1936 % ==========================================
1937 \subsection{Installing a Package}
1938 \label{Installing_a_Package}
1940 % ==========================================
1941 \subsubsection{Linux users}
1942 \label{Installing_a_Package_for_Linux_users}
1944 After compiling a Package, at install time, think of using :
1961 otherwise package documentation will not be generated. \\
1963 Think of updating your environment variable LD\_LIBRARY\_PATH (in .bashrc in
1964 you're using bash), to add the path to the shared library
1965 libbb\emph{YourNewPackageName}.so
1968 % ==========================================
1969 \subsubsection{Windows users}
1970 \label{Installing_a_Package_for_Windows_users}
1971 % ==========================================
1972 Think of updating your environment variable LD\_LIBRARY\_PATH to add the path to the dynamic library
1973 bb\emph{YourNewPackageName}.dll
1975 % ==========================================
1976 \subsection{Plugging in a Package}
1977 \label{Plugging_in_a_Package}
1978 % ==========================================
1980 \bbStudio makes it easy for you : in the menu \texttt{Tools} just click on the
1981 option \texttt{Plug Package}. You will be asked to '\texttt{Select
1982 package directory}'. Browse untill you find the install or the build directory,
1983 depending whether you installed the package or not.
1985 \bbStudio will update the configuration file, generate the 'Package
1986 documentation', and update the 'Boxes Lists'.
1988 You will be able to use the new package just as you did for any other \bbtk
1991 % ==========================================
1992 \subsection{Hard incorporating of a Package}
1993 \label{Hard_incorporating_of_a_Package}
1994 % ==========================================
1996 If the Package you want to use is supplied in a non standard way (e.g. : you
1997 where given one ore more dynamic libraries (\texttt{.dll} or \texttt{.so}), and/or
1998 one or more directories containing \bbtk scripts (\texttt{.bbs})
1999 you can edit your \bbtk configuration and add the appropriate
2000 paths, see \ref{The_configuration_file}.
2003 % ==========================================
2004 \subsection{Updating the documentation}
2005 \label{Updating_the_documentation}
2006 % ==========================================
2007 You may add your own boxes (simple boxes, if you are aware enough in \CPP
2008 language, or complex boxes if you are aware enough in bbtk scripting).
2010 To update the html help of this package,
2011 use the option \texttt{Regenerate package doc}
2012 in the menu \texttt{Tools} of \texttt{bbStudio}.
2013 You'll be prompted for the Package name.
2014 Avoid using the \texttt{-a} option (Regenerate all), since it's time consumming.
2016 To update html boxes lists with the new boxes,
2017 use the option \texttt{Regenerate Boxes Lists}
2018 in the menu \texttt{Tools} of \texttt{bbStudio}.
2020 % ==========================================
2021 \subsection{Using the package}
2022 \label{Using_the_package}
2023 % ==========================================
2025 The only thing you have to do is to \texttt{include} or \texttt{load} the package,
2026 within a script, or from the \texttt{Command} part,
2027 and enjoy the black boxes it contains.
2029 % ==========================================%\subsection{Packages you'll probably want to use }
2030 %\label{Packages_you_ll_want_to_use}
2031 % ==========================================
2033 %\item{\texttt{creaLib}} \\
2034 %a.k.a \texttt{crea}. It's a set of 'low level' utilities, needed by other
2035 %packages (an, sure, useful as well for people that doesn't use bbtkns.
2036 %\item{\texttt{creaContours}} \\
2037 %Provides sophisticated widgets for managing 3D R.O.I. (Regions of interest)
2038 %\item{\texttt{creaImageIO}} \\
2039 %Allows browsing, selectionning, ordering directories containing images of almost any type
2044 % ==========================================
2048 \section{Using black boxes in \CPP programs}
2050 % ==========================================
2052 A very useful feature is that you may use any widget
2053 black box within a \CPP program
2054 without worrying about writing a \wx main application.\\
2056 Let's look a the following bbs script :
2063 # Create the Objects
2066 new LayoutLine layout
2068 # Graphical pipeline
2069 connect slider.Widget layout.Widget1
2070 connect text.Widget layout.Widget2
2072 # Execution pipeline
2073 connect slider.BoxChange text.BoxExecute
2074 connect slider.Out text.In
2080 User wants to create a slider and an output text, within a LayoutLine,
2081 and display the slider value in the output text.
2082 Think about the (little!) nightmare to code the same, in 'raw C++', using wxWidgets.
2084 The following \CPP code does the same :
2087 #include <bbtkFactory.h>
2088 #include <bbwxSlider.h>
2089 #include <bbwxOutputText.h>
2090 #include <bbwxLayoutLine.h>
2092 int main(int argv, char* argc[])
2096 // we need to intanciate a bbtk::Factory to be aware of the adaptors
2097 bbtk::Factory::Pointer factory = bbtk::Factory::New();
2099 // Load the packages
2101 factory->LoadPackage("std");
2102 factory->LoadPackage("wx");
2104 // Create the Objects
2105 // ------------------
2106 bbwx::Slider::Pointer slider = bbwx::Slider::New("slider");
2107 bbwx::OutputText::Pointer text = bbwx::OutputText::New("text");
2108 bbwx::LayoutLine::Pointer layout = bbwx::LayoutLine::New("layout");
2110 // Graphical pipeline
2111 bbtk::Connection::Pointer c1 = bbtk::Connection::New(slider,"Widget",
2114 bbtk::Connection::Pointer c2 = bbtk::Connection::New(text,"Widget",
2117 // Execution pipeline
2118 // ------------------
2120 // We have to pass the 'factory', in order to call automatically an adaptor,
2122 bbtk::Connection::Pointer s2t = bbtk::Connection::New(slider,"Out",
2125 bbtk::Connection::Pointer c3 = bbtk::Connection::New(slider,"BoxChange",
2127 layout->bbSetInputWinDialog(true);
2131 layout->bbExecute();
2134 catch (bbtk::Exception e)
2136 bbtk::MessageManager::SetMessageLevel("Error",1);
2141 In this code, we use the headers of the \texttt{bbwx} \CPP library,
2142 which define the black boxes of the \texttt{wx} package.
2148 % ==========================================
2151 \section{\bbs language reference}
2152 \label{bbi-reference}
2153 % ==========================================
2155 % ==========================================
2156 \subsection{Pipeline creation and execution related commands}
2157 \label{bbi-reference-creation-execution}
2158 % ==========================================
2159 % See table \ref{bbi-reference-box}
2161 % ==========================================
2163 \caption{\label{bbi-reference-box} \bbs pipeline creation and execution related commands.}
2165 \begin{tabular}{|lcm{6cm}|}
2167 Command & Parameters & Effect \\ \hline
2169 \texttt{new} & \texttt{<box-type>} \texttt{<box-name>}&
2170 Creates a box of type \texttt{box-type} and name
2171 \texttt{box-name}.\\ \hline
2173 \texttt{newgui} & \texttt{<box-name>} \texttt{<gui-box-name>} &
2174 Automatically creates a graphical user interface with name \texttt{gui-box-name}
2175 for the black box \texttt{box-name} and connects it to the box inputs\\ \hline
2177 \texttt{delete} & \texttt{<box-name>} &
2178 Destroys the box named \texttt{box-name}\\ \hline
2180 \texttt{connect} & \texttt{<box1.output>} \texttt{<box2.input>} &
2182 \texttt{output} of the box named \texttt{box1}
2183 to the input \texttt{input} of the box named \texttt{box2} \\ \hline
2185 \texttt{set} & \texttt{<box.input>} \texttt{<value>} &
2186 Sets the input \texttt{input} of
2187 the box named \texttt{box} to the value \texttt{value}.
2188 An \texttt{adaptor} must exist
2189 in the packages loaded which converts a \texttt{std::string}
2190 to the type of the input \texttt{input}. \\ \hline
2192 \texttt{exec} & \texttt{<box-name>} &
2193 Executes the box named \texttt{box-name}.
2195 connected to its inputs
2196 are also processed recursively (pipeline processing).\\ \hline
2198 Allows to block execution commands while keeping definition commands active (this one is not for end user)\\ \hline
2199 & \texttt{unfreeze} &
2200 Turns back to 'normal' mode (this one is not for end user).\\ \hline
2203 % ==========================================
2207 % ==========================================
2208 \subsection{Package related commands}
2209 \label{bbi-reference-package}
2212 \caption{\label{tabbbi-reference-interpreter_1}\bbs package related commands. }% (part 1).}
2214 \begin{tabular}{|lcm{6cm}|}
2216 Command & Parameters & Effect \\ \hline
2219 \texttt{include} & \texttt{<package-name>} &
2220 Loads the package \texttt{package-name} and includes all its complex box definition scripts. \\ \hline
2222 \texttt{load} & \texttt{<package-name>} &
2223 Loads the atomic black boxes of package \texttt{package-name}.
2224 Loads the dynamic library but not the complex boxes defined in the scripts shipped with the package.
2225 Use it only if you know that you won't work with its complex black boxes \\ \hline
2227 \texttt{unload} & \texttt{<package-name>}&
2228 Unloads the package \texttt{package-name}.
2229 The package must have been previously loaded.
2230 No box of a type defined in this package must still exist.\\ \hline
2232 \texttt{reset} & - & Deletes all boxes and unloads all packages so
2233 that the interpreter gets back to its initial state \\ \hline
2236 \texttt{package} & \texttt{<package-name>} &
2237 All complex black boxes definitions until the next \texttt{endpackage}
2238 will be stored into the package \texttt{package-name} \\ \hline
2240 \texttt{endpackage} & - &
2241 Closes a \texttt{package} command \\ \hline
2248 % ==========================================
2249 \subsection{Interpreter related commands}
2250 \label{bbi-reference-interpreter}
2251 % ==========================================
2252 %See table \ref{tabbbi-reference-interpreter_1} and \ref{tabbbi-reference-interpreter_2}
2253 % ==========================================
2255 \caption{\label{tabbbi-reference-interpreter_1}\bbs intepreter related commands. }% (part 1).}
2257 \begin{tabular}{|lcm{6cm}|}
2259 Command & Parameters & Effect \\ \hline
2263 Prints help on available commands \\ \hline
2265 & \texttt{<command-name>} &
2266 Prints help on the command \texttt{command-name} \\ \hline
2268 & \texttt{packages} &
2269 Prints help on available packages and their box types
2270 (without description)\\ \hline
2272 & \texttt{<package-name>} &
2273 Prints help on the package \texttt{package-name} and its boxes
2274 (with brief description).
2275 The package must have been previously loaded \\ \hline
2277 & \texttt{<box-type>} &
2278 Prints help (with full description) on the type of box
2280 The box type must belong to a package which has been previously loaded \\ \hline
2284 Prints information on available kinds of messages and their current level\\ \hline
2286 & \texttt{<kind>} \texttt{<level>} &
2287 Sets the level of verbosity of the interpreter for the kind of messages
2288 \texttt{kind} to \texttt{level}.\\ \hline
2291 \texttt{include} & \texttt{<file-name>} &
2292 Includes and executes the content of the file named \texttt{file-name}
2293 exactly like if you were typing its content at the place were the
2294 \texttt{include} command is. \\ \hline
2296 \texttt{print} & \texttt{<string>} &
2297 Prints the string after substituting each token of the form \texttt{\$box.output\$} by the adaptation to string of the value of the
2298 output \texttt{output} of the box named \texttt{box}.
2299 An \texttt{adaptor} must exist
2300 in the packages loaded which converts
2301 the type of the output \texttt{output}
2302 to a \texttt{std::string}.
2305 \texttt{graph} & ... &
2306 Generates the html doc including the pipeline graph for a given complex box \\ \hline
2308 \texttt{index} & ... &
2309 Generates the html index of currently loaded boxes types \\ \hline
2311 \texttt{config} & - & Displays the configuration parameters\\ \hline
2314 \texttt{debug} & \texttt{<debug-directive>} &
2316 Prints debug info on living bbtk objects containing the string \texttt{expr} (default expr='').
2317 \texttt{-C} checks the factory integrity.
2318 \texttt{-D} turns on objects debug info after main ends\\ \hline
2320 \texttt{quit} & - & Exits the interpreter\\ \hline
2324 % ==========================================
2328 % ==========================================
2329 \subsection{Complex black box definition related commands}
2330 \label{bbi-reference-black-box-definition}
2331 % ==========================================
2333 %See table \ref{bbi-reference-complex-box}
2334 % ==========================================
2336 \caption{\label{bbi-reference-complex-box} \bbs complex black box definition related commands.}
2338 \begin{tabular}{|lcm{6cm}|}
2340 Command & Parameters & Effect \\ \hline
2343 \texttt{define} & \texttt{<box-type>} [\texttt{<package-name>}] &
2344 Starts the definition of a complex black box of type
2345 \texttt{box-type}. If \texttt{<package-name>} is provided then includes the
2346 box in the given package (otherwise it is defined in the current package,
2347 i.e. \texttt{user} if outside a \texttt{package/endpackage} block). \\ \hline
2349 \texttt{endefine} & - &
2350 Ends the definition of a complex black box type\\ \hline
2352 \texttt{author} & \texttt{<string>} &
2353 Concatenate the string to the author string
2354 of the current complex black box.\\ \hline
2356 \texttt{description} & \texttt{<string>} &
2357 Concatenate the string to the description of the current complex black box.
2360 \texttt{category} & \texttt{<string>} &
2361 Specifies the \texttt{categories} of the current complex black box.
2362 The categories must be separated by semicolons, e.g. "\texttt{widget;image}"\\ \hline
2364 \texttt{kind} & \texttt{<box kind>} &
2365 Specifies the \texttt{kind} of the current complex black box
2366 ( ADAPTOR, DEFAULT\_ADAPTOR, WIDGET\_ADAPTOR, DEFAULT\_WIDGET\_ADAPTOR )\\ \hline
2368 \texttt{input} & \texttt{<name>} \texttt{<box.input>} \texttt{<help>} &
2369 Defines a new input for the current complex black box,
2370 named \texttt{name}.
2371 It is defined as corresponding to
2372 the input \texttt{input} of the box \texttt{box}.
2374 \texttt{<help>} is the help string for the new input.
2375 The box \texttt{box} must already have been created in the complex box
2376 and of course have an input named \texttt{input}.\\ \hline
2378 \texttt{output} & \texttt{<name>} \texttt{<box.output>} \texttt{<help>} &
2379 Defines a new output for the current complex black box,
2380 named \texttt{name}.
2381 It is defined as corresponding to
2382 the output \texttt{output} of the box \texttt{box}.
2383 \texttt{<help>} is the help string for the new output.
2384 The box \texttt{box} must already have been created in the complex box and of course have an output named \texttt{output}. \\ \hline
2390 Note : if outside a \texttt{define/endefine} block then the current complex black box
2391 is '\texttt{user::workspace}', that is the main program equivalent
2392 (this is how applications are documented).
2393 This remark holds for all complex black box related commands.
2402 % ==========================================
2403 % ==========================================
2404 % ==========================================
2405 % ==========================================
2406 % ==========================================
2407 % ==========================================
2408 % ==========================================
2409 % ==========================================
2410 % ==========================================
2411 % ==========================================
2414 \section{Install and run time issues}
2415 % ==========================================
2420 %%==============================================================================================
2421 %%==============================================================================================
2422 \subsection{\bbtk configuration file}
2423 \label{The_configuration_file}
2424 %%==============================================================================================
2425 %%==============================================================================================
2427 At start, \bbtk applications (\bbStudio, \bbi) try
2428 to open an \texttt{xml}
2429 configuration file named \texttt{bbtk\_config.xml}.
2432 \item The current directory
2433 \item The subdir \texttt{.bbtk} of the user's home directory.
2435 \item On \texttt{Unix}, the home directory is the
2436 one stored by the environnement variable \texttt{HOME},
2437 typically \texttt{/home/username}.
2438 \item On \texttt{Windows}, the home directory is
2439 the user's profile directory stored by the environnement
2440 variable \texttt{USERPROFILE},
2441 typically \texttt{C:$\backslash$ Documents and Settings$\backslash$ username}.
2443 \item If none of these two paths contains the file then it creates
2444 a new one in the \texttt{.bbtk} directory.
2448 Information on \bbtk configuration is
2449 obtained in \bbStudio by clicking on the
2450 \texttt{Config} button of the \texttt{Command} part toolbar.
2452 If you did not installed other packages than the ones
2453 provided by \bbtk, you get something like :
2459 bbtk_config.xml : [/home/guigues/.bbtk/bbtk_config.xml]
2460 Documentation Path : [/usr/local/bin/../share/bbtk/doc]
2461 Data Path : [/usr/local/bin/../share/bbtk/data]
2463 File Separator : [/]
2466 --- [/usr/local/bin/../share/bbtk/bbs]
2469 --- [/usr/local/bin/../lib]
2472 The first line let you know which configuration file is currently used.
2474 You can open this file using \bbStudio menu \texttt{Files$>$Open bbtk Config file}.
2476 You will get something like :
2479 <?xml version=\"1.0\" encoding=\"iso-8859-1\"?>
2481 <bbs_path> </bbs_path>
2482 <package_path> </package_path>
2483 <default_temp_dir> $ </default_temp_dir>
2487 The \texttt{xml} tags \texttt{bbs\_path} and \texttt{package\_path}
2488 allow to set additionnal directories in which to search
2489 for \bbs files and packages dynamic libraries.
2491 For example, if you add the line :
2493 <bbs_path> /home/guigues/bbs </bbs_path>
2496 Then the interpreter will search for \bbs in the folder \texttt{/home/guigues/bbs},
2497 which allows a command like \texttt{'include bbMyBox.bbs'} to work if
2498 the folder \texttt{/home/guigues/bbs} contains the file \texttt{bbMyBox.bbs}.
2500 The same, the \texttt{xml} tag \texttt{<package\_path>} let you
2501 set additional path in which to find a package dynamic library,
2502 hence allowing to load additionnal packages with the \texttt{'load'} command.
2504 All \bbs and package paths are summmarized in the
2505 information output when pressing 'Config' in \bbStudio.
2506 You can see that two \bbs paths are always set :
2508 \item The current directory (\texttt{.})
2509 \item The \bbs folder of \bbtk
2511 Also, two package paths are always set :
2513 \item The current directory (\texttt{.})
2514 \item The libraries folder of \bbtk
2517 Additional paths set in your \texttt{bbtk\_config.xml} are added after those standard paths.
2518 Note that the order displayed is the one in which the folders are searched when
2519 \texttt{include} or \texttt{load} commands are issued.
2522 %%==============================================================================================
2527 %For some strange reasons (?!?), at \texttt{cmake} time,
2528 %you may be warned that an error occured while documentation generation.\\
2529 %Take it easy, \texttt{make} again!\\
2531 \item{\bbStudio} is written using the Advanced User Interface library of wxWidgets.
2532 If, after some hazardous floating/docking operations onto the frame, you feel
2533 very unhappy with the result, just remove from the hidden directory
2534 \texttt{.bbtk} the file named \texttt{bbStudio.aui}. \\