Project Files
Load and save projects
In OpenWalnut, a user can save and load its current workspace and camera settings. This includes the module tree, the loaded data and the camera settings. The current ROI selection will not be saved currently. This will be available in a future release. To save the current project, click on the little save icon in the toolbar or the "File->Save Project" menu:
OpenWalnut can not only save the whole project, but also only a part of it. So, it is possible to save only the module structure or only the camera. This is useful, since it is often required to have multiple camera presets for one visualization. The saved project files can be loaded with the "File->Load Project" menu or the corresponding tool-button. As the project files in OpenWalnut can be understood as batch-processing files, it is possible to load multiple files directly. This way, you are able to load multiple visualization pipelines at once.
Note: The project files can be loaded at program start from the command line like this:
openwalnut -p file.owp
Format of project files
After saving these file, you can open them using your favorite text-editor. These project files can be written manually or by scripts, for batch-processing a multitude of data files with the same processing pipeline. This ensures a high flexibility for power-users. In this section, we give an overview on the project file syntax.
Lets begin with a simple example:
// Load the data needed
DATA:1:/home/username/path/t1.nii.gz
// The Isosurface-Raytracer
MODULE:2:Isosurface Raytracer
PROPERTY:(2,Iso Value)=1
// The Connections
CONNECTION:(1,out)->(2,in)
Similar to C++, comments begin with // and are ignored completely. Invalid lines are ignored too, but throw a parsing error. In general, these project files describe the module graph, which is represented with our module tree widget. This can be done with four basic commands: "DATA", "MODULE", "PROPERTY" and "CONNECTION". The order of commands does not play a role here. Lets analyze the above example line-by-line.
DATA
DATA:1:/home/username/path/t1.nii.gz
This loads the file "/home/username/path/t1.nii.gz". The syntax is as follows: "DATA:UNIQUE_ID:FILE_NAME". The unique ID is important. It is used to refer to this data module later (for setting properties or for connecting it).
MODULE
MODULE:2:Isosurface Raytracer
This command adds the "Isosurface Raytracer" module. The syntax is similar to DATA "MODULE:UNIQUE_ID:MODULE_NAME". Again, the unique ID is used to refer to this module later. The module name identifies the module to add.
PROPERTY
PROPERTY:(2,Iso Value)=1
For setting a module's property, the command "PROPERTY" needs to know which property of which module. Here, the unique ID used to add the module comes into play. The general syntax is "PROPERTY:(UNIQUE_ID, PROPERTY_NAME)=VALUE". The unique ID is the ID of the module for which the property should be set. In our example, this is the ID of the "Isosurface Raytracer" module. The "PROPERTY_NAME" is the name of the property to set. Specify the full name here. Last but not least, "VALUE" is the specific value to set. Properties can be set for data and modules.
CONNECTION
CONNECTION:(1,out)->(2,in)
Finally, the "CONNECTION" command defines whose outputs should be connected to which input. The syntax is easy: "CONNECTION:(UNIQUE_ID,NAME_OF_OUTPUT_CONNECTOR)->(UNIQUE_ID,NAME_OF_INPUT_CONNECTOR)". Once again, the unique IDs of the modules to connect are used here. As each module can have multiple in-/outputs, the name needs to be specified too.
The camera syntax
As mentioned earlier, the project files are also able to store camera settings. We give you an overview on camera setup in this section. First, lets begin with an example:
CAMERA:3:main
MANIPULATOR:(3,HomeEye)=81.8231;-325.544;85.9151
MANIPULATOR:(3,HomeCenter)=81.8231;102.586;85.9151
MANIPULATOR:(3,HomeUp)=0;0;1
MANIPULATOR:(3,Matrix)=-0.486061;0.130674;-0.0225725;0;0.0135559;0.134274;0.485415;0;0.131914;0.467692;-0.133055;0;192.539;494.375;-29.8592;1
User which know OpenGL's camera configuration system might already know the meaning of each of these lines. Lets go through these lines one by another.
CAMERA
Like "DATA" or "MODULE", this command defines a camera with a unique ID for the view called "main". The syntax: "CAMERA:UNIQUE_ID:VIEWER_NAME". In standard OpenWalnut, the viewer always is "main". If you write or use other modules which open new views, with another name, you can define cameras for these views too, by setting their viewer-name correctly.
MANIPULATOR
The following four lines define the properties of the manipulator of the camera. Basically, the MANIPULATOR command works like the property command, as it sets certain properties of the camera manipulator by using the camera's unique ID. A manipulator has four properties: "HomeEye", "HomeCenter", "HomeUp" and a view-matrix "Matrix". The "Home"-properties are vectors and the matrix is column-major and represents the view transformation on top of the home-camera defined by the "Home"-properties. For understanding the specific meaning of each of these properties, you should have a look at https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/gluLookAt.xml and http://glprogramming.com/red/appendixf.html.