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. Chapter 3 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.

FieldBoundary

First, create a net to show how to extract the boundary of a Field. The FieldBoundary 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 FieldBoundary (SCIRun->FieldsCreate->FieldBoundary) module:

  1. Add a FieldReader module to the canvas, and load the utahtorso-lowres-voltage.tvd.fld file.

  2. Now add a FieldBoundary module from SCIRun->FieldsCreate->FieldBoundary.

  3. Attach the output from a FieldReader into the FieldBoundary input port.

  4. Add a ShowField module and connect the FieldBoundary'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, render the edges as Lines, with a scale of 2.0. Enable Transparency. 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 Viewer module, and connect the output from the ShowField module into the Viewer 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.net, it will be used in Chapter 4 of this tutorial, Putting the nets together..


Figure 3.1, FieldBoundary Net (3A)


Figure 3.2, Field Boundary Of The Utah Torso Voltage Field

DirectMapping

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 refered 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 DirectMapping module implements this algorithm. Follow these steps to create the DirectMapping net:

  • Create a FieldReader module and load the utahtorso-lowres-voltage.tvd.fld file.

  • Create a second FieldReader module and load the utahtorso-lowres-electrodes.pcd.fld file.

  • Create a (SCIRun->FieldsData) DirectMapping module

  • Create a (SCIRun->Visualization) ShowField module

  • Create a (SCIRun->Visualization) GenStandardColorMaps module

  • Create a (SCIRun->Visualization) RescaleColorMap module

  • Finally, create a (SCIRun->Render) Viewer module

  • These modules should be hooked together as shown in Figure 3.3. NOTE: Set the Node Scale in the ShowField UI to be at least 5 (and select Spheres). Also, hit 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 FieldReader on the left should read in the utahtorso-lowres-voltage.tvd.fld input file. The FieldReader on the right should read in the utahtorso-lowres-electrodes.pcd.fld input file. Notice that the pipes from each of the FieldReaders (Figure 3.3) have been labeled with the type of Field data flowing through them. The ability to annotate pipes is a new feature, and 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.


Figure 3.3: DirectMapping net


Figure 3.4: DirectMapping Visualization

Save this net as 3B.net. It will be used in Chapter 4 of this tutorial, Putting the nets together.

StreamLines

Streamline advection is the last visualization technique explored in this chapter. The StreamLines module visualizes vector Fields by integrating curves through a gradient vector flow Field.

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

Then, use the (SCIRun->FieldsCreate) SampleField module to generate a sample distribution of StreamLine seed points. SampleField 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 FieldReader module
  • One (SCIRun->FieldsData) Gradient module
  • One (SCIRun->FieldsCreate) SampleField module
  • Two ShowField modules
  • One (SCIRun->FieldsData) DirectMapping module
  • One GenStandardColorMaps module
  • One RescaleColorMap module
  • One Viewer module
  • One (SCIRun->Visualization) StreamLines module

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


Figure 3.5: StreamLines net

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

  • From the SampleField UI, select the rake option and set the maximum number of samples to 50.

  • With the FieldReader, select the input file utahtorso-lowres-voltage.tvd.fld.

  • In the ShowField UI (the upper right ShowField module), display only Nodes as spheres or points, with NodeScale set to approximately 1--2.

  • For 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.

  • On the StreamLines GUI, choose Cell Walk, set Error Tolerance to 0.8, Step Size to 0.8, and Maximum Steps to 250.

  • On the RescaleColorMap GUI, select Fixed Scale and enter -50 for the Min: and 50 for the max.

The SampleField 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 StreamLines 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.


Figure 3.6: StreamLines UI

Save this net as 3C.net. It will be used in Chapter 4 of this tutorial, Putting the nets together.

Controlling Widgets

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

Practice manipulating the widgets (and thus the SCIRun Viewer'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 StreamLines 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.


Figure 3.7: Module Control Menu

After executing the StreamLines 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.


Figure 3.8: Streamlines Visualization

Summary

Three nets were constructed in chapter 3, 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