1 % ==========================================
2 \documentclass[11pt,final,a4paper]{article}
12 {\Huge Package Developers' Guide}
15 \bbtk version \bbtkVersion
19 Last modified on : September 16, 2008 \\
23 Laurent Guigues, Jean-Pierre Roux
26 % ==========================================
28 % ==========================================
34 % ==========================================
36 % ==========================================
38 % ==========================================
39 % ==========================================
41 %\section{Creating your own black boxes}
43 % ==========================================
45 % ==========================================
46 \section{Steps in the creation of new black boxes}
47 % ==========================================
48 Any black box must be included in a \bbtk package,
49 that is in a particular shared library which can be loaded
50 dynamically by \bbtk (hence applications which use \bbtkns,
51 such as the interpreter \bbi, launched by the development environment
55 \item \textbf{Create a new package. }
56 Before defining any black box you
57 have to create a package, or more precisely
58 the files which will allow you to generate the package
59 (compile and link the shared library) and may be install it.
60 \texttt{bbStudio} does it for you.
65 \item The black boxes you want to create are based on
66 a processing code (\CPP classes or \C functions) which
67 is in an existing project handled by \cmake
68 and you want the new package to be part of your existing project.
69 You will have to create your new package into the source tree of your
71 \item You do not have an already existing project (you want
72 to create the new boxes from scratch) or you want/are imposed
73 that the existing project remain external to the package project.
74 You will have to create your new package in a new location and
75 may be include/link against existing libraries.
78 \item \textbf{Describe your new box. }
79 You can do it either :
81 \item In \CPP code. You will have to write the class for
82 your box, mostly using \bbtk macros.
84 When configuring your project with \cmake,
85 the utility \bbfy will then generate the corresponding \CPP code.
90 % ==========================================
91 \section{Creating a new black box package}
92 % ==========================================
94 Run \texttt{bbStudio}.
96 You'll get something like in fig. \ref{bb-Studio}
99 \caption{\label{bb-Studio} bbStudio}
101 \includegraphics[width=0.6\textwidth]{bbStudio.png}
105 Use the option \texttt{Create package} of the menu \texttt{Tools}.
107 You will be asked to choose the directory where you want to create the package,
108 then you'll get something like in fig. \ref{bbCreatePackage}.
112 \caption{\label{bbCreatePackage} Create Package}
114 \includegraphics[width=0.6\textwidth]{bbCreatePackage.png}
119 That will creates the directory structure and the \texttt{cmake}
120 files necessary to build the project.
122 You must then decide the name of your new package.
123 This name will be used to load the package in \texttt{bbi}.
124 Fill up the form like in fig. \ref{bbFillUpPackageForm}.
128 \caption{\label{bbFillUpPackageForm} Fill up the form}
130 \includegraphics[width=0.6\textwidth]{bbFillUpPackageForm.png}
134 Edit the file \texttt{MyPackage/CMakeLists.txt} to customize your package
137 the file tree obtained is :
140 >tree myPackageFolder
145 |-- PackageConfig.cmake.in
147 |-- UsePackage.cmake.in
159 | | |-- CMakeLists.txt
160 | | `-- header.html.in
163 | |-- DoxyMainPage.txt.in
164 | `-- Doxyfile.txt.in
168 9 directories, 16 files
171 The directory \texttt{MyPackage} is the directory of your new package,
172 in which you will create the files describing your black boxes.
173 But first, you have to customize your new package, by editing the file
174 \texttt{CMakeLists.txt} in the \texttt{MyPackage} directory.
177 \begin{file}{MyPackage/CMakeLists.txt}
180 #===========================================================================
181 # CMAKE SETTINGS FOR BUILDING A BBTK PACKAGE
182 #===========================================================================
184 #===========================================================================
185 # THE NAME OF THE BBTK PACKAGE
186 SET(BBTK_PACKAGE_NAME MyPackage)
187 #===========================================================================
189 #===========================================================================
190 # IF IT IS A STANDALONE PROJECT UNCOMMENT NEXT LINE TO DECLARE YOUR PROJECT
191 # PROJECT(bb${BBTK_PACKAGE_NAME})
192 #===========================================================================
194 #===========================================================================
196 # !!! NO COMMA ALLOWED !!!
197 SET(${BBTK_PACKAGE_NAME}_AUTHOR "myself")
198 #===========================================================================
200 #===========================================================================
201 # PACKAGE DESCRIPTION
202 SET(${BBTK_PACKAGE_NAME}_DESCRIPTION "The kinkiest stuff you ve ever seen.")
203 #===========================================================================
205 #===========================================================================
206 # PACKAGE VERSION NUMBER
207 SET(${BBTK_PACKAGE_NAME}_MAJOR_VERSION 1)
208 SET(${BBTK_PACKAGE_NAME}_MINOR_VERSION 0)
209 SET(${BBTK_PACKAGE_NAME}_BUILD_VERSION 0)
210 #===========================================================================
212 #===========================================================================
213 # UNCOMMENT EACH LIBRARY NEEDED (WILL BE FOUND AND USED AUTOMATICALLY)
214 # SET(${BBTK_PACKAGE_NAME}_USE_VTK ON)
215 # SET(${BBTK_PACKAGE_NAME}_USE_ITK ON)
216 # SET(${BBTK_PACKAGE_NAME}_USE_GDCM ON)
217 # SET(${BBTK_PACKAGE_NAME}_USE_GSMIS ON)
218 # SET(${BBTK_PACKAGE_NAME}_USE_WXWIDGETS ON)
219 #===========================================================================
221 #===========================================================================
222 # LIST HERE THE OTHER bbtk PACKAGES NEEDED
223 # (WILL BE FOUND AND USED AUTOMATICALLY)
224 SET(${BBTK_PACKAGE_NAME}_USE_PACKAGES
231 #===========================================================================
233 #===========================================================================
234 # THE SOURCES OF THE PACKAGE
235 # EITHER UNCOMMENT NEXT LINE TO COMPILE ALL .cxx OF THE src DIRECTORY :
236 SET(${BBTK_PACKAGE_NAME}_COMPILE_ALL_CXX ON)
237 # ... OR LIST THE FILES TO COMPILE MANUALLY :
238 #SET(${BBTK_PACKAGE_NAME}_SOURCES
239 # LIST HERE THE FILES TO COMPILE TO BUILD THE LIB
240 # E.G. TO COMPILE "toto.cxx" ADD "toto" (NO EXTENSION)
241 # THE PATH MUST BE RELATIVE TO THE src FOLDER
243 #===========================================================================
245 #===========================================================================
246 # THE xml SOURCES OF THE PACKAGE
247 # EITHER UNCOMMENT NEXT LINE TO bbfy ALL .xml OF THE src DIRECTORY :
248 SET(${BBTK_PACKAGE_NAME}_COMPILE_ALL_XML ON)
249 # ... OR LIST THE FILES TO COMPILE MANUALLY :
250 #SET(${BBTK_PACKAGE_NAME}_XML_SOURCES
251 # LIST HERE THE FILES TO bbfy TO BUILD THE LIB
252 # E.G. TO bbfy "toto.xml" ADD "toto" (NO EXTENSION)
253 # THE PATH MUST BE RELATIVE TO THE src FOLDER
255 #===========================================================================
257 #===========================================================================
258 # THE SCRIPT-DEFINED BOXES OF THE PACKAGE (bbs)
259 # EITHER UNCOMMENT NEXT LINE TO INCLUDE ALL .bbs OF THE bbs/boxes DIRECTORY :
260 SET(${BBTK_PACKAGE_NAME}_INCLUDE_ALL_BBS_BOXES ON)
261 # ... OR LIST THE FILES TO INCLUDE MANUALLY :
262 # SET(${BBTK_PACKAGE_NAME}_BBS_BOXES
263 # LIST HERE THE bbs FILES TO INCLUDE
264 # E.G. TO INCLUDE "boxes/bbtoto.bbs" ADD "boxes/bbtoto" (NO EXTENSION)
265 # !! THE PATH MUST BE RELATIVE TO THE bbs FOLDER !!
267 #===========================================================================
269 #===========================================================================
270 # THE SCRIPT-DEFINED APPLICATIONS OF THE PACKAGE (bbs)
271 # EITHER UNCOMMENT NEXT LINE TO INCLUDE ALL .bbs OF THE bbs/appli DIRECTORY :
272 SET(${BBTK_PACKAGE_NAME}_INCLUDE_ALL_BBS_APPLI ON)
273 # ... OR LIST THE FILES TO INCLUDE MANUALLY :
274 # SET(${BBTK_PACKAGE_NAME}_BBS_APPLI
275 # LIST HERE THE bbs FILES TO INCLUDE
276 # E.G. TO INCLUDE "appli/testToto.bbs" ADD "appli/testToto" (NO EXTENSION)
277 # !! THE PATH MUST BE RELATIVE TO THE bbs FOLDER !!
279 #===========================================================================
281 #===========================================================================
282 SET(${BBTK_PACKAGE_NAME}_INCLUDE_DIRS
283 # LIST HERE YOUR ADDITIONAL INCLUDE DIRECTORIES
287 # - automatically handled libraries or packages : wx, vtk... (see above)
288 # - the dirs automatically set by other libraries found by FIND_PACKAGE
290 #===========================================================================
292 #===========================================================================
293 SET(${BBTK_PACKAGE_NAME}_LIBS
294 # LIST HERE THE ADDITIONAL LIBS TO LINK AGAINST
295 # EXCEPT : the same libs than for INCLUDE_DIRS
297 #===========================================================================
299 #===========================================================================
300 # IF NEEDED : UNCOMMENT NEXT LINE
301 # AND LIST ADDITIONNAL DIRECTORIES
302 # IN WHICH TO LOOK FOR LIBRARIES TO LINK AGAINST
304 #===========================================================================
306 #===========================================================================
307 # SET TO TRUE TO HAVE INFORMATION ON LIBRARIES FOUND DURING CMAKE CONFIGURE
308 SET(FIND_PACKAGE_VERBOSE TRUE)
309 #===========================================================================
311 #===========================================================================
312 # END OF USER SECTION
313 #===========================================================================
315 #===========================================================================
316 # Include configuration script
317 INCLUDE(Configure.cmake)
318 #===========================================================================
320 #===========================================================================
322 #===========================================================================
327 The comments in the file should be easily understandable !
328 You have to customize the lines which are enclosed
329 between dashed comment lines.
330 In these sections, you can see some of the informations you supplied in previous step:
332 \item The \textbf{name} of your package. This will be the name used to load it in \bbi. The shared library however will be called \texttt{bb}name hence on
333 \lin the object file will be called \texttt{libbb}name\texttt{.so}
334 and on \win it will be called \texttt{bb}name\texttt{.dll}.
335 \item The \textbf{author(s)} of the package. Preferably provide e-mail adresses.
336 \item A \textbf{description} of the package, which will appear in the help of your package or in its html documentation automatically generated by \bbdoc.
339 In these sections, you can set :
342 \item The \textbf{libraries used} by the package : \vtk, \itk, \gdcm, \gsmis, \wx. The mecanisms to find these libraries, their sources and to link against them are automatically handled by the \cmake files installed by \bbCreatePackage. You just have to uncomment a line to use one of these libraries.
344 \item A \textbf{description} of the package, which will appear in the help of your package or in its html documentation automatically generated by \bbdoc.
345 \item The \textbf{version} of the package.
346 \item The \textbf{\xml sources} of the package : you can list each input \xml file explicitly or tell \cmake to include in the project \emph{all} the \xml files of the directory.
347 \item The \textbf{\CPP sources} of the package : you can list each input \CPP file explicitly or tell \cmake to include in the project all the \CPP files of the directory.
348 \item \textbf{Additional include directories}. Set it if your package needs to include source files which are not in the package directory, typically if it depends on another library which is not one the libraries automatically handled (\vtk, \itk...).
349 \item \textbf{Additional libraries} to link against. Set it if your package needs to link against another library which is not one the libraries automatically handled (\vtk, \itk...).
352 Of course, this is only a framework and you can add any other \cmake commands
355 % ==========================================
356 \section{Creating a new box}
357 % ==========================================
359 % ==========================================
360 \subsection{Principles}
361 % ==========================================
363 \subsubsection{\texttt{C++} or \texttt{XML} ?}
364 There are two ways to create a new black box in an existing package :
366 \item Write an \xml description file which will be automatically
367 translated in \CPP by the \bbfy application (recommanded).
368 \item Write the \CPP code of the box using \bbtk macros.
371 \subsubsection{From which \bbtk class inherit ?}
373 Apart from this choice of the description langage to use,
374 there is an important choice to do concerning the implementation of the box.
375 In \CPP, a black box is nothing but a class which has the standard
376 interface of all black boxes : what's its name ? inputs ? outputs ? and so on.
379 The abstract description of this interface is done in the class
380 \texttt{bbtk::BlackBox} and is implemented in its child classes :
381 \texttt{bbtk::AtomicBlackBox} and \texttt{bbtk::WxBlackBox}
382 \footnote{all the classes of the \bbtk library are in a \emph{namespace}
384 and the \CPP header of a class called \texttt{NameOfAClass} is
385 in the file called \texttt{bbtkNameOfAClass.h}}.
386 To create a new black box, you have to inherit one of these two
387 concrete classes in order to inherit the black box interface and a
388 particular implementation of this interface.
389 If your black box is a \emph{Widget} black box,
390 that is a black box which has (or is)
391 a piece of a graphical interface based on the \wx library,
392 then it must inherit the class \texttt{bbtk::WxBlackBox}.
394 Concretely, a \texttt{bbtk::WxBlackBox} is associated to
395 a \texttt{wxWindow} and must be able to return a pointer to it.
396 If your black box is not a widget black box
397 (that is : doesn't returns a pointer to a \emph{Widget}),
398 it must inherit from \texttt{bbtk::AtomicBlackBox}.
400 \subsubsection{Inherit or encapsulate ?}
402 Now, your black box will do something (hopefully !).
403 When you decide to write a new black box,
404 you should be in one of these three cases :
406 \item You already have a \texttt{C}-like function which
407 does the processing that you wish to 'blackboxify'
408 \item You already have a \CPP class which
409 does the processing that you wish to 'blackboxify'
410 \item You start from scratch without any existing code
413 The idea of \BBTK is to embed processing codes into
414 \CPP objects which have a standard and generic interface -
415 namely black boxes - to be able to chain arbitrary
416 processes afterwards.
418 In \CPP, in order to embed an existing processing \emph{class}
419 into a standard interface you only have two possibilities :
421 \item {\bf Inherit} the existing processing class
422 \emph{and} the interface class (e.g. \texttt{bbtk::AtomicBlackBox}).
423 In this case you have to :
425 \item make the link between the inputs and outputs of the black box
426 and the interface of the inherited class
427 \item call the processing
428 method of the inherited class in the processing method of the black box.
430 \item {\bf Encapsulate} the existing processing class
431 in a class inherited from
432 the interface class (e.g. \texttt{bbtk::AtomicBlackBox}).
433 In this case you have to :
435 \item declare it as a member of the black box,
436 \item instantiate it at the right time
437 (either in the constructor or in the processing method of the black box)
438 \item in the processing method of the black box :
440 \item set the inputs of the member procesing class with the inputs of the black box,
441 \item call the processing method of the encapsulated class
442 \item set the ouputs of the black box with the outputs of the encapsulated
448 If you wish to 'blackboxify' a C-like \emph{function},
449 you do not have the choice, you can only use the second mechanism,
450 namely encapsulation.
452 Obviously, the inheritance mechanism is more powerfull
453 and - when it is possible to use it - it demands less effort
454 because, as we will see, in \bbtk you can directly
455 link the accessors to the input and output data of the box
456 to the accessors of the inherited processing class,
457 as well as the procesing method of the black box
458 to the processing method of the inherited processing class,
459 very much like a callback mechanism.
461 \subsubsection{How to generate a Black Box skeleton}
463 Run \texttt{bbStudio}, choose \texttt{Tools} in the menu bar, option
464 \texttt{Create Black Box}.
465 You will be shown something like in fig. \ref{bbCreateBlackbox} :
468 \caption{\label{bbCreateBlackbox}Create Black Box}
470 \includegraphics[width=0.6\textwidth]{bbCreateBackbox.png}
475 \subsubsection{Informations to provide}
477 Finally, to create a new black box, you will have to give :
479 \item The {\bf name} of the box
480 \item The {\bf package} to which the box belongs (can we do it automatically ? LG : think about it)
481 \item The {\bf author}(s) of the box
482 \item A {\bf description} of the box
484 \item Its {\bf type}, either
486 \item a standard one (\texttt{std-template})
487 \item a VTK Polydata Algorithm based box (\texttt{VTK\_PolydataAlgorithm-template}),
488 \item a VTK Image Algorithm based box (\texttt{VTK\_ImageaAlgorithm-template}),
489 \item if it uses the wxWidget Library (\texttt{widget-template})
492 \item The output format of the file, either a C++ file or an XML file.
494 %\item $[$Optional$]$ The additional {\bf include files} which are necessary for the code to compile (classes or functions declarations ...)
495 %\item $[$Optional$]$ The other {\bf parent(s)} of the box (which must be known hence their header included)
496 %\item $[$Optional$]$ The {\bf namespace} to which the box belongs
497 %\item The box {\bf inputs} and {\bf outputs}, and for each one :
499 %\item Its {\bf name} : the string which will identify the input or output
500 %\item Its {\bf type} : any \CPP type, either a basic type or a user defined type (class ...) but which must be known, hence the necessary files must be included.
501 %\item Its {\bf help} : a string describing the input / output
503 %\item Its {\bf processing} code, which can be a simple callback or an arbitrary complex code
507 Under Linux, for reasons we shall not discuss here, you'll get an error message :
509 \texttt{No such file or directory}
511 Have a look at the console, you'll see a shell command (whose syntax is OK although there is is a lot of
512 quotes),something like :
514 \texttt{ "/usr/local/bin/bbCreateBlackBox" "/home/jpr/Desktop/essai" MyPackage
515 myVtkPolydataBlackBox VTK-PolyDataAlgorithm C++ 'author1, author2' 'myVtkPolydataBlackBox description'}
517 Just copy the command, and run it manually.
519 \subsubsection{Input and output accessors}
521 When you encapsulate a processing class or a C function
522 or when you write down a black box from scratch,
523 you must access the inputs and outputs of the black box,
524 in order to interface it manually with your processing method
525 or simply write your processing code
526 (there are other cases in which you also need to access the
527 inputs and outputs, we will talk about them later).
529 The only thing you must know about the \CPP code generated
530 from your \xml or your \CPP macro-based description
531 is that when you declare an input
532 or an output of a black box then
533 two \emph{accessors} for this input or output are generated :
534 one to \emph{get} the value of the input or output and
535 one to \emph{set} it.
536 These accessors have normalized names :
539 \item The declaration of an {\bf input} called \texttt{NAME} and
540 of type \texttt{TYPE} generates the two accessors
541 \footnote{For the sake of simplicity, the parameters and return value are
542 shown here as if they were all passed by value.
543 However the actual code can use references.
544 The same way, the issue of const or non const methods is eluded here.
545 Different cases occur in practice.}:
547 \item \texttt{void bbSetInput<NAME>(<TYPE>);}
548 \item \texttt{<TYPE> bbGetInput<NAME>();}
550 \item The declaration of an {\bf output} called \texttt{NAME} and
551 of type \texttt{TYPE} generates the two accessors:
553 \item \texttt{void bbSetOutput<NAME>(<TYPE>);}
554 \item \texttt{<TYPE> bbGetOutput<NAME>();}
558 For example, declaring an input called \texttt{Image}
559 would generate the two accessors \texttt{bbSetInputImage} and
560 \texttt{bbGetInputImage}.
564 \item All \bbtk methods are prefixed by \texttt{bb}
565 to avoid conflicts with potential inherited methods.
566 \item An input and an output can have the same name (e.g. 'Image').
567 No conflict between accessors occur (e.g.
568 four distinct accessors are created :
569 \texttt{bbSetInputImage},
570 \texttt{bbGetInputImage},
571 \texttt{bbSetOutputImage} and
572 \texttt{bbGetOutputImage}).
575 % ==========================================
576 \subsection{\texttt{XML} description of a box}
577 % ==========================================
579 % ==========================================
580 \subsubsection{General \texttt{xml} tags}
581 % ==========================================
583 Let us examine the \texttt{xml} file
584 describing the \texttt{Add} box of the \texttt{std} package :
586 \begin{file}{\texttt{packages/std/src/bbAdd.xml}}
589 <?xml version="1.0" encoding="iso-8859-1"?>
591 <blackbox name="Add">
593 <author>laurent.guigues@creatis.insa-lyon.fr </author>
594 <description>Adds its inputs </description>
595 <category>math </category>
597 <input name="In1" type="double" description="First number to add"/>
598 <input name="In2" type="double" description="Second number to add"/>
599 <output name="Out" type="double" description="Result"/>
602 bbSetOutputOut( bbGetInputIn1() + bbGetInputIn2() );
615 The tags and their role are easily understandable.
617 As the box is not a widget, we inherit implicitely from
618 \texttt{bbtk::AtomicBlackBox}.
621 The only part of the file which needs a bit of explaination is
622 the body of the \texttt{process} tag, which describes the
623 actual code to execute in the box.
624 This code must be enclosed in a \texttt{<PRE></PRE>} tag
625 to tell the \xml parser not to interpret it as \xml instructions.
626 This is necessary to be able to use any symbol,
627 like the \texttt{<} and \texttt{>} which have a
628 special meaning in \xml.
629 In the case of the \texttt{Add} box, the process code
630 is very simple : remember that
631 \texttt{bbGetInputIn1()} is the
632 accessor to the input \texttt{In1} declared above and
633 \texttt{bbGetInputIn2()} is the
634 accessor to the input \texttt{In2};
635 the code simply adds the values of the two inputs
636 and sets the output \texttt{Out} with the resulting value.
638 To describe your own black boxes in \xml code,
639 you must modify the xml file generated in previous step :
642 \item Complete the description and author tags if you feel like.
643 \item add the \texttt{\#include} directives to be put in the generated \texttt{.h} file
644 \item Create your inputs and outputs
645 \item Fill in the process tag
646 \item Fill in the constructor tag
647 \item Fill in the copyconstructor tag
648 \item Fill in the destructor tag
653 % ==========================================
654 \subsubsection{Specific \texttt{xml} tags for \texttt{itk::ImageToImageFilter} classes bbfication}
655 % ==========================================
657 % ==========================================
658 \subsubsection{Specific \texttt{xml} tags for \texttt{vtkImageAlgorithm} classes bbfication}
659 % ==========================================
662 <blackbox name="..." type="VTK\_ImageAlgorithm">
664 <vtkparent>the vtk ImageAlgorithm class it inherits from</vtkparent>
665 <input name="..." type="double" special="vtk parameter" description="..."/>
666 <input name="..." type="vtkImageData*" special="vtk output" description="..."/>
668 <output name="..." type="double" special="vtk parameter" description="..."/>
669 <output name="..." type="vtkImageData*" special="vtk output" description="..."/>
671 % ==========================================
672 \subsubsection{Specific \texttt{xml} tags for \texttt{vtkPolyDataAlgorithm} classes bbfication}
673 % ==========================================
675 <blackbox name="..." type="VTK\_PolyDataAlgorithm">
677 <vtkparent>the vtk Polydata class it inherits from</vtkparent>
678 <input name="..." type="double" special="vtk parameter" description="..."/>
679 <input name="..." type="vtkPolyData*" special="vtk output" description="..."/>
681 <output name="..." type="double" special="vtk parameter" description="..."/>
682 <output name="..." type="vtkPolyData*" special="vtk output" description="..."/>
685 % ==========================================
686 \subsubsection{\bbfy \texttt{xml} tags reference}
687 % ==========================================
690 % ==========================================
692 \caption{\label{xml_tags}
693 \bbfy \texttt{xml} tags reference}
695 \begin{tabular}{|lcllm{6cm}|}
697 Tag & Attributes & Condition & Multiplicity & Description
700 \texttt{<blackbox>} & \texttt{name} & - & 1 & The name of the box \\ \hline
701 & \texttt{type} & - & 1 & The type of the box. In:
702 \{\texttt{standard} (default),
703 \texttt{ITK\_ImageToImageFilter},
704 \texttt{VTK\_ImageAlgorithm},
705 \texttt{VTK\_PolyDataAlgorithm}\} \\\hline
706 & \texttt{generic} & a) & 0-1 &
707 Generate the generic filter (see text)\\ \hline
709 \texttt{<description>} & - & - & 0-n & The description of the box. Multiple occurrence are concatenated \\\hline
710 \texttt{<author>} & - & - & 0-n & The author of the box. Multiple occurrence are concatenated \\\hline
711 \texttt{<category>} & - & - & 0-1 & The box category (if more than one, they are separated with commas) see Tab \ref{categories}\\\hline
712 \texttt{<parentblackbox>} & - & - & 1 & The parent black box of the box.
713 In: \{\texttt{bbtk::BlackBox, bbtk::WxBlackBox, bbtk::WxContainerBlackBox}\}\\\hline
714 \texttt{<package>} & - & - & 1 & The package of the box \\\hline
715 \texttt{<namespace>} & - & - & 0-1 & The namespace of the box.
716 Use \texttt{bbPACKAGE}, where \texttt{PACKAGE} is the name of the package\\\hline
717 \texttt{<include>} & - & - & 0-n & Additionnal file to include
718 (generates : \texttt{\#include 'value'})\\\hline
720 \texttt{<template>} & - & - & 0-n & Template parameter of the box. The template parameter list is generated in the order of appearance of the tag. \\\hline
722 \texttt{<itkparent>} & - & a) & 1 & The parent itk class (with namespace) \\\hline
724 \texttt{<vtkparent>} & - & b) & 1 & The parent vtk class \\\hline
726 \texttt{<input>} & \texttt{name} & - & 1 & The name of the input \\\hline
727 & \texttt{type} & - & 1 & The type of the input \\\hline
728 & \texttt{special} & - & 0-1 & In: \{\texttt{``itk input'',
729 ``vtk input'', ``itk parameter'', ``vtk parameter''}\} (see below).\\\hline
730 & \texttt{generic\_type} & c) & 0-1 & The ``generic'' type of the input (see text). \\\hline
731 \texttt{<output>} & \texttt{name} & - & 1 & The name of the output \\\hline
732 & \texttt{type} & - & 1 & The type of the output \\\hline
733 & \texttt{special} & - & 0-1 & In: \{\texttt{``itk output'',
734 ``vtk output''}\} (see below).\\\hline
735 & \texttt{generic\_type} & c) & 0-1 & The ``generic'' type of the output (see text).\\\hline
736 & \texttt{nature} & c) & 0-1 & The ``nature'' of the output (used for automatic GUI generation).\\\hline
738 \texttt{<process>} & - & - & 0-1 & The code of the processing method of the box. Must be put between clear tags : \texttt{<PRE></PRE>} \\\hline
739 \texttt{<constructor>} & - & - & 0-1 & The code of the user Constructor of the box (may contains default initialisations). Must be put between clear tags : \texttt{<PRE></PRE>} \\\hline
740 \texttt{<copyconstructor>} & - & - & 0-1 & The code of the user Copy Constructor of the box . Must be put between clear tags : \texttt{<PRE></PRE>} \\\hline
741 \texttt{<destructor>} & - & - & 0-1 & The code of the user Destructor of the box. Must be put between clear tags : \texttt{<PRE></PRE>} \\\hline
744 % ==========================================
746 \caption{\label{xml_tags}
747 \bbfy \texttt{xml} tags conditions}
749 \begin{tabular}{|ll|}
751 a) & \texttt{<blackbox type == ''ITK\_ImageToImageFilter''>} \\ \hline
752 b) & \texttt{<blackbox type == ''VTK\_ImageAlgorithm'' or ''VTK\_PolyDataAlgorithm''>} \\ \hline
753 c) & \texttt{<blackbox type == ''ITK\_ImageToImageFilter''>} and
754 \texttt{<blackbox generic>} is present. \\ \hline
759 \caption{\label{basic_parent}}
760 \bbfy \texttt{Basic box parent}
762 \begin{tabular}{|ll|}
764 \texttt{bbtk::WxBlackBox}b) & If the blackbox associated to
765 a \texttt{wxWindow} and is be able to return a pointer to it.... \\ \hline
766 \texttt{bbtk::AtomicBlackBox} & Any other blackbox that doesn't return a pointer to a \texttt{wxWindow}
774 % ==========================================
776 \caption{\label{categories}
777 \bbfy \texttt{Black Box} categories}
779 \begin{tabular}{|ll|}
781 \texttt{Categ name} & : Meaning \\ \hline \\ \hline
782 \texttt{adaptor} & : Adaptor box \\ \hline
783 \texttt{application} & : Final application, end user intended \\ \hline
784 \texttt{atomic box} & : System category.
785 Automatically assigned to Atomic Black Boxes (c++ defined) \\ \hline
786 \texttt{complex box} & : System category.
787 Automatically assigned to Complex Black Boxes (script defined) \\ \hline
788 \texttt{command line} & : Script which defines a command line application (no embedded GUI, but command line imput parameters) \\ \hline
789 \texttt{demo} & : Demonstration \\ \hline
790 \texttt{devel} & : Developer tool (bbCreatePackage.bbs, ...) \\ \hline
791 \texttt{dicom} & : DICOM aware box \\ \hline
792 \texttt{example} & : Example script showing a box use-case \\ \hline
793 \texttt{filter} & : Image processing box \\ \hline
794 \texttt{image} & : Image processing related box \\ \hline
795 \texttt{interaction} & : \\ \hline
796 \texttt{math} & : Mathematical operations\\ \hline
797 \texttt{mesh} & : Mesh processing related box \\ \hline
798 \texttt{misc} & : A box that cannot be put in other category ! \\ \hline
799 \texttt{read/write} & : Box that read or write data from or to disk \\ \hline
800 \texttt{viewer} & : Box which displays some data \\ \hline
801 \texttt{widget} & : Piece of graphical interface \\ \hline
803 \texttt{3D object creator} & : Sophisticated 3D widget \\ \hline
804 \texttt{toolsbbtk} & : Component of bbStudio \\ \hline
809 % ==========================================
811 \caption{\label{kinds}
812 \bbfy \texttt{Black Box} kinds}
814 \begin{tabular}{|ll|}
816 \texttt{Kind} & Use as : \\ \hline \\ \hline
817 \texttt{ADAPTOR} & \\ \hline
818 \texttt{DEFAULT\_ADAPTOR} & \\ \hline
819 \texttt{WIDGET\_ADAPTOR} & \\ \hline
820 \texttt{DEFAULT\_WIDGET\_ADAPTOR} & \\ \hline
821 \texttt{GUI} & \\ \hline
822 \texttt{DEFAULT\_GUI} & \\ \hline
823 \texttt{ALL} & If kind='ALL' then sets the level for all kinds\\ \hline
828 % ==========================================
830 \caption{\label{nature}
831 \bbfy \texttt{nature}}
833 \begin{tabular}{|ll|}
835 \texttt{Nature} & : used for \\ \hline \\ \hline
837 \texttt{file name} & Poping up a File Selector\\ \hline
838 \texttt{directory name} & Poping up a Directory Selector\\ \hline
839 \texttt{file extension} & \\ \hline
840 \texttt{colour} & Poping up a Colour Selector\\ \hline
841 \texttt{pixel type} & \\ \hline
842 \texttt{image dimension} & \\ \hline
843 \texttt{image index} & \\ \hline
844 \texttt{image size} & \\ \hline
845 \texttt{voxel size} & \\ \hline
849 % ==========================================
850 \subsection{\CPP description of a box}
851 % ==========================================
853 Almost everything is performed usig macros.
855 For a quick start, the best you have to do is to run \texttt{bbStudio}, then in the menu \texttt{Tools}, choose the item
856 \texttt{Create blackbox}, click on \texttt{C++}, and have a look to the generated files.
858 % ==========================================
859 \subsubsection{\texttt{.h} description of a box}
860 % ==========================================
862 \item \texttt{namespace} : your package name.
863 \item \texttt{class} : the name of your box
864 \item \texttt{public inheritance} :
866 \item{bbtk::WxBlackBox}
867 Your Black Box is intended to return a wxWidget, able to be included into an other one (you choosed
868 \texttt{widget-template} for \texttt{Type of the blackbox} )
869 \item{bbtk::AtomicBlackBox}
870 Your Black box is any processig box (std, ITK or VTK based)
871 \item{any processing class} (ITK, VTK, ...) your box inherits.
873 \item \texttt{BBTK\_BLACK\_BOX\_INTERFACE} : (yourBoxName, the list of the classes it inherits from, VTK Parent -if any-).
874 Yes, we know it's redundant with previous point... That's why we allow you to describe your class in xml format!
875 \item \texttt{bbUserConstructor} declaration of your own callback function, that will be called in the box constructor method
876 \item \texttt{bbUserCopyConstructor} declaration of your own callback function, that will be called in the box copy constructor method
877 \item \texttt{bbUserDestructor} declaration of your own callback function, that will be called in the box destructor method
878 \item \texttt{BBTK\_DECLARE\_INPUT} : input parameter name (as it will appear to the users of your black box),
879 C++ type of the parameter (e.g. double, std::string, vtkImageData*, ...)
880 \item \texttt{BBTK\_DECLARE\_OUTPUT} : output parameter name (as it will appear to the users of your black box),
881 C++ type of the parameter (e.g. double, std::string, vtkImageData*, ...
882 \item \texttt{BBTK\_DECLARE\_VTK\_INPUT} Declares a vtkAlgorithm-inherited AtomicBlackBox input
883 \item \texttt{BBTK\_DECLARE\_VTK\_OUTPUT} Declares a vtkAlgorithm-inherited AtomicBlackBox output
884 \item \texttt{BBTK\_DECLARE\_VTK\_PARAM} Declares an AtomicBlackBox input corresponding to an inherited vtk parameter
885 (you know, the ones that are declared by vtkSetMacro/vtkGetMacro). Its name must be the same than the vtk parameter name
886 \item \texttt{BBTK\_DECLARE\_VTK\_IMAGE\_ALGORITHM\_INPUT} Declares a vtkImageAlgorithm-inherited AtomicBlackBox input
887 \item \texttt{BBTK\_DECLARE\_VTK\_POLY\_DATA\_ALGORITHM\_INPUT} Declares a vtkPolyDataAlgorithm-inherited AtomicBlackBox input
888 \item \texttt{BBTK\_PROCESS} Defines the default bbUserProcess method for vtk inherited black boxes (actually : calls vtkParent::Update)
890 \item \texttt{BBTK\_BEGIN\_DESCRIBE\_BLACK\_BOX} :
891 (yourBoxName, \texttt{bbtk::WxBlackBox} or \texttt{bbtk::AtomicBlackBox} depending on what you
892 black box inherits from).
893 Yes, we know it's redundant with public inheritance ... That's why we allow you to describe your class in xml format!
894 All the following items will be used in the Help interface; describe them carefully (i.e. in a Human understandable way!).
895 \item \texttt{BBTK\_NAME} : the name of your box
896 \item \texttt{BBTK\_AUTHOR} : author name (better you put e-mail adress)
897 \item \texttt{BBTK\_DESCRIPTION} : brief description of what does the box
898 \item \texttt{BBTK\_CATEGORY} :box category (see table \ref{categories})
899 \item \texttt{BBTK\_INPUT} for each one of the input parameters, you have to supply :
901 \item The current Blackbox name.
902 \item The parameter name
903 \item A brief description of what the parameter is used for.
904 \item The C++ type of the parameter (e.g. double, std::string, vtkImageData*, ...)
905 \item The nature of the parameter (see table \ref{nature}) if you wish your box may be used by automatic GUI generator.
906 Supply an empty string ("") if you don't care.
908 \item \texttt{ BBTK\_OUTPUT} for each one of the output parameters, you have to supply :
910 \item The current Blackbox name.
911 \item The parameter name
912 \item A brief description of what the parameter is used for.
913 \item The C++ type of the parameter (e.g. double, std::string, vtkImageData*, ...)
915 \item \texttt{BBTK\_END\_DESCRIBE\_BLACK\_BOX} : means the torture is (almost) over.
917 % ==========================================
918 \subsubsection{\texttt{.cxx} description of a box}
919 % ==========================================
921 \item \texttt{BBTK\_ADD\_BLACK\_BOX\_TO\_PACKAGE} : (Package name, Blackbox name)
922 \item \texttt{BBTK\_BLACK\_BOX\_IMPLEMENTATION} : (Blackbox name, Blackbox basic parent \\ (bbtk::AtomicBlackBox/ bbtk::WxBlackBox)see :\label{basic_parent}
923 \item \texttt{Process} :definition of your own callback function, that will be called in the box method. \\ At least, you'll write here the default initialisation of the outputs
924 \item \texttt{UserConstructor} : definition of your own callback function, that will be called in the box constructor method. \\
925 At least, you'll write here the default initialisation of the inputs (to avoid unpredictable behaviour if user forgets to
926 Set/Connect any Input).
927 \item \texttt{UserCopyConstructor} : definition of your own callback function, that will be called in the box copy constructor method
928 \item \texttt{UserDestructor} : definition of your own callback function, that will be called in the box destructor method
937 %\section{Conclusion}