CIBC:Documentation:SCIRun:Tutorial:BioPSE:Chapter 3

From SCIRun Documentation Wiki
Jump to navigation Jump to search

Prev Next Contents

Chapter 3: Derived Fields

Chapter Sections

Chapter Overview

Chapters 1 and 2 demonstrated the construction of SCIRun networks to visualize the geometry and data values in a field. This chapter explores additional visualization techniques, and examines filter modules that receive a field as input, then output a newly derived field.

Rather than building one net to introduce these modules, several nets are constructed. Each net describes a single visualization technique. This chapter is divided into three sections, one for each method.


First, create a net to show how to extract the boundary of a field. The GetFieldBoundary module extracts a boundary surface from a volume. For example, given a TetVolMesh (volume), the module extracts the boundary faces, and outputs a TriSurfMesh (surface).

Follow these steps to create a net using the GetFieldBoundary (SCIRun->NewField->GetFieldBoundary) module:

  1. Add a ReadField module to the canvas, and load the utahtorso-lowres-voltage.tvd.fld file.
  2. Now add a GetFieldBoundary module from SCIRun->NewField->GetFieldBoundary.
  3. Attach the output from a ReadField into the GetFieldBoundary input port.
  4. Add a ShowField module and connect the GetFieldBoundary's first output to the ShowField's first input.
  5. Set the ShowField module to display edges only (turn off the nodes and the faces) and set the Field Name to Boundary.
  6. Also in the ShowField UI:
    1. Render the edges as Lines, with a scale of 2.0.
    2. Enable Transparency.
    3. Set the default color to dark gray (give red, green, and blue a value of 0.3 and an alpha of 0.8).
  7. Create a ViewScene module, and connect the output from the ShowField module into the ViewScene module.
  8. Press the Autoview button and rotate the image downward, to look like Figure 3.2.

The net should look similar to Figure 3.1. Save this net as 3A.srn, it will be used in Chapter 4 of this tutorial, Putting the nets together..

3 1.gif
Figure 3.1, GetFieldBoundary Net (3A)

3 2.gif
Figure 3.2, Field Boundary Of The Utah Torso Voltage Field


Next, interpolate data values from one field to another field. This section, demonstrates how to load two datasets. The first contains the utahtorso-lowres-voltage.tvd.fld examined in Chapter 1, which referred to as the volume field. The second contains the electrode positions in utahtorso-lowres-electrodes.pcd.fld, from Chapter 2.

Once the datasets are loaded, create a new field by interpolating the electrode positions and voltage values. Interpolation is the means used to calculate the value at a certain point, by using the known values at surrounding points. For each electrode, the corresponding voltage value must be found from the volume field.

The MapFieldDataFromSourceToDestination module implements this algorithm. Follow these steps to create the MapFieldDataFromSourceToDestination net:

  1. Create a ReadField module and load the utahtorso-lowres-voltage.tvd.fld file.
  2. Create a second ReadField module and load the utahtorso-lowres-electrodes.pcd.fld file.
  3. Create a (SCIRun->ChangeFieldData) MapFieldDataFromSourceToDestination module.
  4. Create a (SCIRun->Visualization) ShowField module, select Spheres in the ShowField UI and set the SphereScale to at least 5.0.
  5. Create a (SCIRun->Visualization) CreateStandardColorMaps module.
  6. Create a (SCIRun->Visualization) RescaleColorMap module.
  7. Finally, create a (SCIRun->Render) ViewScene module.
  8. These modules should be hooked together as shown in Figure 3.3.
  • NOTE: press the Autoview button in the ViewWindow and rotate the image in the ViewWindow downward to match the appearance found in Figure 3.4.
  • NOTE: the ReadField module on the left should read in the utahtorso-lowres-voltage.tvd.fld input file. The ReadField on the right should read in the utahtorso-lowres-electrodes.pcd.fld input file. Notice that the pipes from each of the ReadField modules (Figure 3.3) have been labeled with the type of field data flowing through them. The ability to annotate pipes can be accessed by right clicking on the pipe and selecting Notes. This annotation has no effect on the application, but is useful to the user for making networks more clear.
3 3.gif
Figure 3.3: MapFieldDataFromSourceToDestination net
3 4.gif
Figure 3.4: DirectMapping Visualization

Save this net as 3B.srn. It will be used in Chapter 4 of this tutorial, Putting Nets Together.


Streamline advection is the last visualization technique explored in this chapter. The GenerateStreamLines module visualizes vector fields by integrating curves through a gradient vector flow field.

The input vector field is generated by using the CalculateGradients module (SCIRun->ChangeFieldData) to compute the gradient of the utahtorso-lowres-voltage.tvd.fld.

Then, use the (SCIRun->NewField) GeneratePointSamplesFromFieldOrWidget module to generate a sample distribution of streamline seed points. GeneratePointSamplesFromFieldOrWidget generates samples from any type of input field, and outputs the samples as a PointCloud field. The following modules are needed to run the StreamLines net:

  • One ReadField module.
  • One (SCIRun->ChangeFieldData) CalculateGradients module.
  • One (SCIRun->NewField) GeneratePointSamplesFromFieldOrWidget module.
  • Two ShowField modules.
  • One (SCIRun->ChangeFieldData) MapFieldDataFromSourceToDestination module.
  • One CreateStandardColorMaps module.
  • One RescaleColorMap module.
  • One ViewScene module.
  • One (SCIRun->Visualization) GenerateStreamLines module.

These modules should be hooked together as shown in Figure 3.5.

3 5.gif
Figure 3.5: GenerateStreamLines net

Once the modules are connected, set the following GUI parameters:

  • In the GeneratePointSamplesFromFieldOrWidget UI, select the rake option and set the number of samples to 50.
  • Use the ReadField module to load the input file utahtorso-lowres-voltage.tvd.fld.
  • In the first ShowField UI (the upper right ShowField module), display only Nodes as spheres or points, with SphereScale set to approximately 1.0 - 2.0.
  • In the second ShowField module (in the bottom-left corner of Figure 3.5), set the UI to display Edges only as cylinders with a Cylinder Scale of 2.
  • In the GenerateStreamLines UI, choose Cell Walk, set Error Tolerance to 0.8, Step Size to 0.8, and Maximum Steps to 250.
  • In the RescaleColorMap UI, select Fixed Scale and set the Min value to -50 and the Max value to 50.

The GeneratePointSamplesFromFieldOrWidget module can generate samples randomly, or the user can select samples using a 3D widget. For streamline visualization, use a 3D Rake widget for distributing seed points. The user can interactively position the rake of seed points within the volume.

The GenerateStreamLines module works by advecting the seed points through the vector field. The vector field is piecewise constant, so the Cell Walk algorithm is used to trace out the streamlines.

3 6.gif
Figure 3.6: GenerateStreamLines UI

Save this net as 3C.srn. It will be used in Chapter 4 of this tutorial, Putting Nets Together.

Controlling Widgets

The rake is one of many widgets used in SCIRun. Widgets are graphical elements in the ViewWindow that allow the user to interactively control features of the display. SCIRun widgets have similar visual characteristics, but manipulate different aspects of the display, as detailed in the Control Widgets Section of the User Guide.

Practice manipulating the widgets (and thus the ViewScene module's display) in the following manner:

  • Hold down the Shift key, then left-click the mouse on the widget and move the widget around the region of view to change its location and action.
  • While holding down the Shift key, left-click the mouse on a sphere in the widget and change the position of that widget.
  • Hold the Shift key and left-click the mouse on the end knob (green resize cylinders) in the widget and change, for example, the density of streamlines.
  • SCIRun will redraw the image in the ViewWindow when the mouse button is released.

Network Execution and Data Dependence

There are several ways to execute a SCIRun network that has not fired.

In the GenerateStreamLines network:

  • On the Network Editor's File Menu, select Execute All
  • On the module itself, right-click the mouse and select the Execute option from the dropdown menu (Figure 3.7).
  • Each module's UI has its own Execute button.

When a module is instructed to execute, all modules in its net will also execute.

  • NOTE: if a module has already computed a result, and its inputs have not changed, it will use the previously computed result.
3 7.gif
Figure 3.7: Module Control Menu

After executing the GenerateStreamLines network, an image like Figure 3.8 will appear in the ViewWindow. The rake widget will appear as a gray bar with spheres at the ends. The user's image may be slightly different than Figure 3.8, but the user should see the rake and colored streamlines. If the streamlines do not appear, the user may need to check the object list and turn on the Edges.

3 8.gif
Figure 3.8: Streamlines Visualization


Three nets were constructed, each describing a single method of visualizing the utahtorso-lowres-voltage dataset.

In Chapter 4, the nets will be merged into a single, larger network that performs concurrent visualizations.

Return to Top

Prev Next Contents