Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Utils

Parameter, Ground Truth Data, GUI, 3D-Out

Parameter Handling

Typical applications often use lots of paramteres to control the algorithms. The class BIAS::Param can unify parameter handling accross classes, libraries and applications. The basic idea is to have one instance of class BIAS::Param per application to store all parameters and let all libraries and algorithmic classes uses this instance. Class BIAS::Param can read and write parameters from and to files and can parse command line parameters. The application and the algorithms can access parameters by their name or can keep pointers to the parameter data. There are the following seven parameter types: Integer, Boolean, String, Double, Vector of Double, Vector of Integer, Enumeration. A parameter can be added with BIAS::Param::AddParam*(), it needs at least the parameter name and accepts additional arguments: A Help-String to describe the parameter, a default-value and depending on the type things like Min-Max values.

The methods BIAS::Param::AddParam*() always return the pointer where the data of the parameter is stored, such that the application can acces it without any latency. An alternative way of getting a parameter value is to ask with BIAS::Param::GetParam*(name). but the name-lookup always takes some time.

If a class "A" deep into a library has some parameters to be handled, the best way is to implement a method A::RegisterParameters(BIAS::Param &p) for this class, so that it does not need an own instance of Param but can use a foreign instance. When writing an application using this class "A", the application should create an instance of Param, call A::RegisterParameters(). Then it should call BIAS::Param::ParseCommandLine().

BIAS::Param::ParseCommandLine() starts by parsing argc and argv, if it reads a commandline argument "--readconfig <file>" it reads the configuration file and parses argv again, to ensure that commandline arguments override arguments from files. The array argv is permutated such that all optinal (with "--" or "-" and associated data) arguments preceed al non-optionsl arguments. The return value of ParseCommandLine() is the index into argv pointing to the first non-optional argument (see "man 3 getopt_log" for details). If an options "--writeconfig <file>" is found, after parsing and reading the curent content of the object is written in the file.

The class BIAS::ParamGUI is derived from BIAS::Param and adds GUI elements to let the user change parameters interactively. To help layout the controls automatically , parameters can be sorted in groups. BIAS::ParamGUI is based on wxWidgets and support mainly three different levels of integration. With BIAS::ParamGUI::GetPanel(), one wxPanel containing the controls of one group is returned to let the programmer integrate the panel on its own. BIAS::ParamGUI::GetNoteBook() returns a wxNoteBook containing pages or panels for each group of parameters. The method BIAS::ParamGUI::GetFrame() opens up a window containing the notebook.

When the user changes a parameter, the application has to be informed immediatly to react properly. This can be realized with callbacks. Each class which expects callback must be derived from BIAS::ParamCallbackInterface and implement a method called: BIAS::ParamCallbackInterface::ParameterChanged(name, void *value). The instance of BIAS::Param or BIAS::ParamGUI then has to be informed to used it for a given parameter with BIAS::Param::RegisterCallbackObject(name, class *MyAlgorithm).

Synthetic Data / Ground Truth

Felix ?

Image Windows

For the ease of use, BIAS has some simple GUI components to display images in software and hardware OpenGL rendering. Two different widget sets have been used for this purpose: GTK and wxWidgets. Due ot its portability and higher abstraction level, wxWidgest was finally chosen. The GTK development is discontinued within BIAS. Assuming that a programmer writes a console application dealing with images and want to display one image for debugging purpose.

Then he can use one of the classes BIAS::GuiGTK or BIAS::GuiWX. They are both derived from BIAS::GuiBase and have the same API. After instantiation, one can call BIAS::GuiBase::ShowImage() and a simple window will appear showing the image. For images not in RGB color mode proper color conversion is performed automatically. Some more methods exist to modify the title bar or close the window.

For programming wxWidget applications, more classes are provided: BIAS::ImageCanvas, BIAS::ScrolledImageCanvas and BIAS::ImageCanvasEnhanced, BIAS::ContextWX. They only provide a canvas which has to be embedded into a frame. These canvases can display images or OpenGL scenes eventually using scrollbars, can generate extra-windows with magnifications (right-click), display some status information in the statusbar and can also display images from storagetype float with changeable scale. BIAS::ImageCanvasRectangularSelection has support to select regions in the image.

3D-out (ThreeDOut)

The class BIAS::ThreeDOut provides unified output interfaces for 3D visualization of geometric objects, such as points, lines, ellipsoids,... and also cameras with different drawing styles and colors. Simply create a ThreeDOut object T in your application and call the relevant Add-function, e.g. T.AddPoint(X) to add the point X to your 3D world. After having added everything, you can call T.VRMLOut(filename) or T.GLOut() (other interfaces may follow) to write to a file or a GL context. It is also possible to update/remove previously added entities. However, we want to keep everything simple here for fast visualization. If you want to do more sophisticated things (e.g. comlex scene rendering)), you should try out OpenSceneGraph or something like that.