KWScene/Documentation/Overall Design

From KitwarePublic
Jump to navigationJump to search

The purpose of KWScene is to serve as a translator between scene file formats and specific libraries that can manage the concept of a scene graph.

Given that the capabilities of different file formats and different libraries will not have a one-to-one correspondence, necessarily not all of the information contained in a given scene file may end up being converted to the destination library.

The overall design of KWScene involves three large units

  • Input/Output
  • Scene Graph internal representation
  • Generators for other libraries


This is a graph with borders and nodes. Maybe there is an Imagemap used so the nodes may be linking to some Pages.


Input / Output

The IO classes will be responsible for reading scene graph representations from file formats commonly used in the community. In particular we will focus on

  1. MRML
  2. OpenSceneGraph
  3. Blender

In that order of priorities.

The IO classes will read the scene elements from a file and will convert them to the internal representation of the KWScene library.

The IO classes will be implemented in a modular design that will make very easy to add support for additional file formats in the future.

Internal Representation

The internal representation of the scene graph will use a typical tree structure in which nodes will be attached to parent nodes and their relative positions will be described by transforms

Generators

Generator classes will parse the internal representation of the scene graph and convert it to the appropriate classes of a destination library.

We will provide generators for the following libraries / applications

  1. VTK
  2. ParaView
  3. ITK

Generators will follow a modular design to make very easy to add new destination libraries in the future.

Design Features

The library will use the following techniques

  • Smart Pointers
  • Factories
    • Dynamically loadable

Importing KWScene in ParaView

  • Phase 1 - Import a flat list of objects in ParaView

Using the ParaView plugin mechanism, the file menu will have an additional entrie ("Import KWScene"). Selecting this option will allow the user to select a scene file. Once a KWScene is instantiated, the paraview plugin queries the filename of each object in the scene and open the filenames like any standard files in ParaView. A flat list of all the objects in the scene is thereby generated. The transform associated to each object are then applied to the ParaView object representations.

  • Phase 2 - Display the imported objects as a tree

It requires to create a GUI (Qt) panel for the dummy filters that will represent each object in a scene.

  • Phase 1 - TODO list
    • Add an entrie into the "File" menu of ParaView ("Import KWScene").
    • Connect a file dialog box to the "Import KWScene" menu action (to select a scene file: *.mrml, ...)
    • Instantiate a KWScene with the user filename
    • Query KWScene for the number of objects
    • For each object, get its filename and instantiate a ParaView Reader on the filename.
    • Query KWScene for the transforms associated to each object. Set the transform to the ParaView Representation of the object.