Volume Viewer Volume Viewer icon

Volume Viewer is a tool for visualizing three-dimensional (3D) numerical data sets. Data can be shown as solid or mesh isosurfaces (contour surfaces) or as partially transparent solids:

ESP Contours Electron Density Map ESP Volumes
electrostatic potential
(surface)
electron density map
(mesh)
electrostatic potential
(solid)

The state of Volume Viewer is included in saved sessions. Volume Viewer is under development. New features are being added, and some limitations will be addressed in future versions.

Related tools include:

STARTUP AND INPUT

There are several ways to start Volume Viewer, a tool in the Volume Data category. Starting Volume Viewer without a data file opens an "empty" interface:

without data (default Features)

Choosing File... Open map from the interface will then bring up a dialog for opening files in any of the registered volume data formats. Alternatively, simply opening a file in any of the registered volume data formats (without starting Volume Viewer first) will automatically start Volume Viewer. Additional file types can be defined.

with data (default Features)

More than one file can be opened, and more than one subregion or subsample from the same or different files can be displayed.

By default, the data will be displayed automatically if it does not exceed a certain size (see Show data when opened... in the Data display options); data exceeding the size limit will not be displayed until Show is clicked. When data is displayed, the Threshold and Color section shows a histogram of the data values with thresholds that control the display.

The data set information and display values shown in Volume Viewer always refer to the currently selected data set (or current set). The current set is indicated next to the word Data in the Data and Step menus section. The current display region may correspond to part (a subregion) or all of the current set.

VOLUME VIEWER ORGANIZATION

Volume Viewer includes many options, and it is not practical to show them all at once. The Features menu lists potential sections in the Volume Viewer dialog, with checkboxes controlling which sections are shown.

The File menu includes operations associated with data files:

The buttons across the bottom are always present:

FEATURES MENU

Features menu (factory defaults)

The Features menu lists potential sections in the Volume Viewer dialog, with checkboxes controlling which sections are shown. Clicking the adjacent checkbox expands the Volume Viewer interface to show the corresponding section. A section can be closed by unchecking its entry in the Features menu, unchecking its feature button, or clicking its close button (), if present.

Menus in Chimera are tear-off, meaning that clicking the dashed line near the top of the menu makes the menu an independent window that remains up until explicitly closed. The figure shows the torn-off Features menu with factory default settings.

Feature buttons

This section contains a row of small, unlabeled buttons representing the other possible sections of the Volume Viewer dialog. Checking a feature button has the same effect as checking a box in the Features menu. Although arranged horizontally, the buttons are in the same order as the menu entries. Placing the cursor over a feature button shows its section name.

DATA SETS

Data and Step menus

The current set is indicated next to the word Data. This is a pulldown menu when more than one data set is open, and a different set can be selected (made the current set) by choosing it from this menu. The Size is the number of data points spanning each dimension of the current display region, and the Step values indicate the density of sampling. For example, 1 1 1 means all the data points are used to generate the display; 2 2 2 means every other data point is taken along each axis, reducing the number of data points used by a factor of eight. Changing step sizes with the pulldown Step menu turns off their automatic adjustment (Adjust step... in the Data display options).

Data set list

A different data set can be selected (made the current set) by clicking its entry in the Data Sets list.

Origin and Scale

The X, Y, and Z Origin coordinates and Voxel size are shown for the current set. The Origin is the data point with indices (0,0,0), and Voxel size refers to the data point spacing (resolution). The values can be edited; changes take effect when the Enter (return) key is pressed. The position of the origin and the voxel dimensions can be restored to their starting values with Original origin and Original size, respectively.

DISPLAY

Display style

The rendering mode (surface, mesh, or solid) to use for the current set is indicated next to the word Show. The surface and mesh modes depict isosurfaces (contour surfaces) consisting of a large collection of triangles. In the surface mode, each triangle is drawn as a plane of color. In the mesh mode, just the triangle edges are displayed. In the solid mode, the data is shown as a semitransparent solid.

The Volume Viewer File menu and buttons and the Model Panel can be used to control volume models. Closing the model with the same name as a data set using the Model Panel will remove the data set and all of its displays. Closing a solid model, however, will only remove that display and not the corresponding data set.

Threshold and Color

Thresholds that control the display are shown on a histogram of the data values. Multiple histograms are shown for data with multiple components. Bar heights are on a logarithmic scale. Threshold appearance and other details depend on the rendering mode:

Data display options

Show outline box using color [color well] (off by default) shows the bounding box of the current display region using the specified color. The color can be changed by clicking the color well.

Update display without pressing Show (on by default) causes automatic display updates upon changes in rendering mode, Threshold and Color settings, or rendering options (Surface and Mesh options, Solid rendering options). Otherwise, it is necessary to press Show to update the display after such changes. This option does not apply to display after:

Show data when opened if smaller than [size] Mvoxels (on by default, with size=256) enables automatic initial display of data sets smaller than a specified size. The default limit of 256 Mvoxels is equivalent to a 512 x 512 x 1024 data set. Size does not have to be an integer; for example, 0.25 could be used. When the option is on, a newly opened data set that exceeds the size limit will not be displayed until Show is clicked. When the option is off, Show must always be clicked to generate an initial display. Turning the option on or off or changing the size will not affect the display of any data that has already been opened.

Adjust step to show at most [size] Mvoxels (on by default, with size=1) provides a convenient way to limit the display to a reasonable amount of data. The default limit of 1 Mvoxel (220 or 1,048,576 voxels) is equivalent to a 128 x 128 x 64 data set. Size does not have to be an integer; for example, 0.25 could be used. When this option is on, Step values are automatically adjusted by powers of 2 to comply with the Mvoxel limit (increased when the extents are increased, if necessary, and decreased when the overall region size is small enough for finer sampling). This option is turned off by:

When the option is turned off, Step values will no longer be adjusted automatically in either direction.

Data cache size (Mb) (32 by default) controls whether volume data is kept in memory when it is not being displayed. A cache can improve performance, since accessing data in the cache is faster than reading it from disk. It is necessary to press Enter (return) after changing the cache size. Undisplayed data is purged from the cache to maintain the size, but if the displayed data alone requires more space, it will not be purged. The least recently displayed data is purged. The data cache only accounts for part of the memory used by Volume Viewer. Because a significant amount of additional memory is occupied by surfaces and color arrays used in rendering, the cache size should be set to about 1/3 or 1/2 of the desired total memory usage by Volume Viewer. Clicking Current use opens a dialog showing how much memory is occupied by volume data (not including the surfaces, etc. mentioned above).

Show selected subregion immediately (off by default) automatically updates the display after subregion selection with the mouse (when the mouse button is released).

Zoom and center camera when region changes (off by default) automatically adjusts the view to fit the region when Show is clicked (and upon automatic display updates when Show selected subregion immediately is also turned on).

Brightness and Transparency

Brightness scales the intensity of the color of the volume display. Values range from 0.01 to 10, where 1 (the default) produces no change relative to the color defined in the Threshold and Color section.

For surface and mesh displays: the Transparency Factor is the fraction of light transmitted from behind the surface or a line of mesh. Values range from 0 to 1, where 0 (the default) corresponds to no transparency. (See also Dim transparent surface/mesh in the Surface and Mesh options.)

For solid displays: the Transparency Depth is the thickness of a slab containing a color of full intensity (as for a threshold at the top of the histogram) that would block half the light from behind. Increasing the depth makes the volume more transparent and brighter, because less light is blocked. Brightness can be decreased to compensate for this effect. (See also Solid brightness correction and Solid linear interpolation in the Solid rendering options.)

SURFACE OR MESH DISPLAY

For surface and mesh displays, each threshold is shown as a vertical bar. The figure shows single-component data (electrostatic potential) contoured in magenta at a negative value and in cyan at a positive value. The first time the data is displayed, one threshold for each data component is set automatically so that 1% of voxels (1% of the volume encompassed by the data region) lie above it. The Range of data values is shown below the histogram.

Any number of thresholds (contour levels) can be added by Ctrl-clicking with the left mouse button on the histogram. Ctrl-clicking on an existing threshold deletes it. Of course, different thresholds can have different settings for Level and Color; the settings shown apply to the threshold most recently moved or clicked, the current threshold. A threshold can be moved by changing the Level and then pressing Enter (return) or by dragging it horizontally with the left mouse button. Holding the Shift key down reduces the speed (mouse sensitivity) of threshold dragging tenfold, allowing finer control. Setting a contour level very low can generate a surface with many triangles that takes a long time to display.

Each threshold is shown in the same color as its display. The Color can be changed by clicking the color well. Brightness and Transparency can be adjusted.

Surface and Mesh options

Surface smoothing iterations [i] factor [f] (off by default, with i=2 and f=0.3) smooths surface and mesh displays by moving each vertex toward the average position of its neighboring vertices (those connected by triangle edges). A vertex is moved a fraction f (ranging from 0 to 1) of the way toward the average position of its neighbors, and each vertex is moved once per iteration. i iterations are performed, where i is a positive integer. When Subdivide surface... is on, it may be necessary to use more smoothing iterations and/or a higher factor to achieve a smoothness similar to that of the unsubdivided surface.

Subdivide surface [j] times (off by default, with j=1) increases the number of triangles used in surface and mesh displays. Subdivision can help to produce smoother surfaces when combined with the Surface smoothing... option. During a single round of subdivision, each triangle is divided into four smaller triangles by connecting the midpoints of the triangle edges. Thus, the number of triangles is increased by a factor of 4j, where j is a positive integer.

Smooth mesh lines (off by default) turns on anti-aliasing to smooth lines in mesh displays. OpenGL can render smooth lines using anti-aliasing, but the method has a side effect: dense meshes look brighter from some viewpoints and darker from others, depending on the order in which the lines were drawn. Only opaque mesh lines are affected; smoothing is always turned off for transparent lines because it is incompatible with the transparent rendering procedure.

Square mesh (off by default) displays a subset of the lines in the triangular mesh. Lines in the square mesh show the intersection of the XY, YZ, and XZ grid planes with the contour surface.

Mesh line thickness [k] pixels (k=1 by default) is the pixel line width used in mesh displays; it must be a positive integer.

Dim transparent surface/mesh (on by default) decreases the brightness of surface and mesh displays as their Transparency Factor is increased. Specular highlights are also dimmed. Otherwise, increasing the transparency of a color (without changing its brightness) allows more light to shine through, resulting in an increase in the overall brightness. When dimming is on, OpenGL (alpha,1–alpha) blending is used instead of (1,1–alpha) blending.

Mesh lighting (on by default) makes the inside of a contour volume shown in the mesh rendering mode dimmer than the outside. With mesh lighting on, the brightness varies according to the angle between each surface point normal and the line of sight; brightness is maximal when the outward-facing normal is parallel to the line of sight and pointing at the user (see more on the definition of "outward" under Light flip side...). With mesh lighting off, the brightness is uniform regardless of the angle between the normal and the line of sight.

Two-sided surface lighting (on by default) makes both the inside and outside of a contour volume shown in the surface rendering mode bright. Otherwise, only the outside is lit (see more on the definition of "outside" under Light flip side...). The brightness of each lit side varies according to the angle between a surface point normal and the line of sight; brightness is maximal when the normal is parallel to the line of sight.

Light flip side for thresholds < 0 (on by default) affects surface and mesh displays. The surface mode is affected only when lit from a single side (when Two-sided surface lighting is off). The mesh mode is affected only when Mesh lighting is on. When Light flip side... is off, the side toward smaller or more negative data values is always treated as the outside of a contour volume. When Light flip side... is on, the side toward larger or more positive values is treated as the outside for any negative thresholds (contour levels), while the side toward smaller or more negative values is treated as the outside for any positive thresholds. Flip side lighting is appropriate when displaying data for which the sign is meaningful, such as electrostatic potential. In other cases, the data set is better described as a monotonic range of values, and where it lies relative to zero is not meaningful.

SOLID DISPLAY

For solid displays, each threshold is shown as a small square.

The figure shows four-component data (light microscope data at four wavelengths) with the components displayed in cyan, green, red, and blue. When the current set has multiple components, the display of an individual component can be toggled on and off by clicking its Hide checkbox.

The first time the data is displayed, three thresholds (for each data component) are set automatically: a lower threshold is set so that 1% of voxels (1% of the volume encompassed by the data region) lie above it, an upper threshold is set to the maximum value in the data, and a third is placed between them. The Range of data values is shown below each histogram.

Any number of thresholds can be added by Ctrl-clicking with the left mouse button on the histogram. Ctrl-clicking on an existing threshold deletes it. Of course, different thresholds can have different settings for Level and Color; the settings shown apply to the threshold most recently moved or clicked, the current threshold. A threshold can be moved by changing the Level and then pressing Enter (return) or by dragging it horizontally and/or vertically with the left mouse button. Holding the Shift key down reduces the speed (mouse sensitivity) of threshold dragging tenfold, allowing finer control. The rightmost threshold does not have to be at the far right of the histogram, and a threshold at a lower data value can be higher (vertically) than a threshold at a higher data value.

Each threshold is shown in the same color as its display. Different thresholds for the same data component can be colored alike (as in the figure) or differently. The Color can be changed by clicking the color well. Brightness and Transparency can be adjusted.

The thresholds and connecting lines on each histogram define a function that maps data values to colors and intensities. For each voxel, the data value is compared to the thresholds on the histogram. The colors and intensities of the closest threshold at a lower data value (to the left) and the closest threshold at a higher data value (to the right) are linearly interpolated. Voxels with data values greater than the rightmost threshold or less than the leftmost threshold are colorless and completely transparent. Color is defined by red, green, blue and opacity components. The intensity at a threshold is further scaled by its vertical position, where 0 is the bottom of the histogram and 1 is the top. Rendering time does not depend on the positions of the thresholds, but increases with greater numbers of thresholds.

Solid rendering options

Maximum intensity projection (off by default) shows, at each pixel, the the most intense color value underlying the pixel along the line of sight. The maximum intensities of the red, green, and blue color components are determined separately, after colors from multiple data components (if present) are blended. Transparency is not used; that is, the Transparency Depth and the vertical positions of the thresholds are ignored when this setting is on. Maximum intensity projection can be useful for enhancing detail. Unphysical effects can result, but are usually not very noticeable; examples include the disappearance of a dim spot when it passes in front of a brighter spot and the simulation of a single spot when the maximal values of different color components under the same pixel actually come from different spots.

Use colormap of size [N] for solids (on by default, with N=256). Using a colormap allows faster updates of solid displays when Threshold and Color and Brightness and Transparency settings are adjusted. With some hardware, however, the updates may be too slow to be useful. Data values for a region are divided into N ranges, with each range mapped to a particular color and transparency. N must be a positive integer. Smaller values of N result in coarser divisions and more abrupt gradations of color. If N is set too high for the graphics hardware, an error message may result, or (depending on the GL implementation) the model may simply fail to appear. The hardware-determined maximum N is typically 256 or 65356.

Colormap initially off for multi-component data (on by default, i.e., colormap off). A colormap allows faster updates of solid displays, but yields distinct colors rather than smoothly graded ranges. Noticeably abrupt color gradations are especially likely with multiple-component data, since the product of the numbers of divisions within the components cannot exceed N (specified with Use colormap...). For example, if N=256 and the data set has two components, there can only be 16 divisions for each component, such that any combination of the two values will map to one of the 256 color/transparency settings. Since the quality of display using a colormap may be low for multiple-component data, it is often best to check the performance without a colormap. If display updates are too slow without a colormap, Use colormap... can be activated.

Solids using 2D textures (on by default) controls whether the 2D or 3D texture mapping projection code is used for solid displays. These give similar but not equivalent visual results. The 3D texture mapping method is not supported by some computer hardware. If 3D texture mapping is chosen but not supported by the computer hardware, an empty red outline box will be shown. If the hardware does support 3D texture mapping but the texture is too large, an empty yellow outline box will be shown. The 2D texture mapping method requires 3 times as much texture memory as the 3D method, but has the advantage of working on all platforms.

The region size that can be displayed may be limited by the amount of texture memory in the graphics card. Our late-1990's SGI systems are limited to 128 x 128 x 128 regions for 3D textures, but can handle larger regions with 2D textures. Regions requiring more memory than the graphics card has will work on some hardware, but with significantly degraded performance. The memory required is usually 4 bytes per volume element for the 3D texture implementation and 12 bytes per volume element for the 2D texture implementation (see more on memory usage). OpenGL restricts texture sizes to be powers of 2. Thus, the texture memory requirements and rendering speed of a 65 x 65 x 65 volume will be like those for a 128 x 128 x 128 volume, since 128 is the smallest power of 2 that will accomodate 65 data values. Performance is optimal for regions with dimensions that are powers of 2. The option to Minimize texture memory use may be helpful.

Solid brightness correction (off by default) applies to solid displays with 2D texture mapping. Without this correction, the apparent brightness and transparency will depend on the viewing angle relative to the XYZ data axes. For a cube-shaped volume with equal resolution in the X, Y, and Z dimensions, the brightness drops and the transparency increases by a factor of 31/2 (approximately 1.7) as the viewing angle is changed from along any axis to along the cube diagonal. The brightness correction remedies this, but doubles rendering time.

Minimize texture memory use (off by default) causes solid displays with 2D texture mapping to reuse a single 2D texture instead of allocating separate textures for every plane of the data volume. This is useful for viewing large data sets that would otherwise fail to display, but it can degrade performance (increase the lag time) when the display is rotated and during remote display.

Solid linear interpolation (on by default) refers to linear interpolation of the brightness and transparency between voxels in solid displays (in 2 dimensions for 2D texture mapping, all 3 dimensions for 3D texture mapping). Turning interpolation off may yield a pixelated appearance, but may decrease the rendering time, depending on the graphics hardware.

REGIONS AND SUBSAMPLES

The default settings will often suffice for displaying the data without performance problems. If there are problems, however, the first issue to address is the size of the data set: whether the information can be handled and displayed in a reasonable amount of time. Typically, an isosurface for a 64 x 64 x 64 data set can be displayed in a few seconds on a late-1990's machine. The Chimera web site includes a benchmark table listing the volume data sizes that can be handled at 10 frames per second on various computer systems. With solid displays, performance is optimal when region dimensions are powers of 2 (see the discussion of texture mapping). A status line near the bottom of the panel reports on the progress of a calculation. Some experimentation may be required to balance appearance and performance for a given data set. The size of a 3D data set is essentially the total number of values, X x Y x Z. It is related to both the physical dimensions (for example, angstroms along each axis) and the resolution (spacing) between data points.

To decrease size, one can focus on a smaller physical region (subregion) and/or use a sparser grid of points (subsample) from the original data set.

File... Duplicate makes a copy of the current set so that it is not necessary to open the same file multiple times to simultaneously display different subregions or representations of the same data.

Region bounds

Volume Viewer with region info
In the figure, the data has 97 points in each dimension, with grid indices running from 0 to 96. The step values are 2, meaning that only every other grid point in each dimension is used to calculate the display. This does not affect the physical extents of the displayed data. The physical extents can be decreased by increasing the min grid indices and/or decreasing the max grid indices. Because they refer to grid indices, the min, max, and step values must be integers. They can be changed manually by typing in new values and then clicking Show or pressing Enter (return). This updates the current display region based on the new min, max, and step values and turns off automatic step size adjustment (Adjust step... in the Data display options). The original full data set can be restored by changing the min, max, and step values back to their original settings (or by clicking Full in the Subregion selection section).

Subregion selection

Select subregions using [button] allows subregions of the current set to be defined with the mouse. The indicated mouse button (which can be changed using the pulldown menu) is reassigned from its existing function to volume selection in the graphics window. A volume selection can only be a box with axes corresponding to the original X,Y,Z axes of the current set. Depending on the viewing direction, this may be a surprisingly large box. It is often helpful to Orient the volume before defining a subregion.

In the following description of selection boxes, "clicking" and "dragging" refer to operations with whichever mouse button has been assigned to subregion selection. When there is no pre-existing selection box:

After a selection box has been created, it can be erased or further adjusted. Clicking erases the selection box and starts over. Dragging from a point over the box moves the frontmost face; also holding down Shift moves the the rearmost face instead of the frontmost. Dragging from a point not over the box translates the whole box in X and Y; Shift-dragging translates the box in the Z dimension. It is necessary to click Crop to apply the new boundaries (to update the current display region), unless Show selected subregion immediately (in Data display options) has been activated.

Half and Double change the physical extents of the current display region by a factor of 2; Half halves the size in each dimension and Double doubles the size in each dimension, keeping the center the same. After a certain amount of zooming out, the min and max values (in Region bounds) may be beyond the bounds of the original data set, but the actual region displayed will be no larger than the original data. After one or more cycles of zooming in and out, the extents may differ from the original due to rounding. Full restores the original extents.

After various subregions of the current set have been used as the current display region during a session, it is possible to go Back and Forward among them. The subregion farthest Back is the earliest created within the session. Up to 32 subregions can be stored and traversed. Changes in min and max values but not step sizes (in Region bounds) are retained in this history.

Named regions

Subregions can be named and then restored by name. Add adds the name entered in the name field to the list of named regions, Delete deletes the region with the name shown in the name field from the list of named regions, and Show allows restoration (from a pulldown menu) of any of the named regions on the list. When Add is clicked, the min and max values (see Region bounds) of the current display region are saved. A named region can be restored by typing its name in the Named region field and pressing Enter (return).

Zone

Clicking Zone limits the display to areas within a specified distance (Radius) of the currently selected atoms, if any. The current display region is actually larger than the zone, but areas outside the zone are masked. The Radius can be adjusted by moving the slider or typing in a new value and pressing return (Enter). When zoning is in effect, recontouring affects only the block of data enclosing the zone (the current display region) rather than the entire current set of data. If the set of selected atoms is changed, Zone must be clicked again to move the zone accordingly. Otherwise, the zone will remain centered on the formerly selected atoms. Clicking Zone will not update the display when no atoms are selected. Multiple isosurfaces of a given data set will be zoned simultaneously. However, the data set can be duplicated to allow differential zoning of different isosurfaces. No Zone turns off zoning and restores the original extents of the data. Zoning should be turned off during the use of Subregion selection buttons. (See also Atom box.)

Atom box

Clicking the Box around selected atoms... button limits the current display region to a box with X,Y,Z dimensions enclosing the currently selected atoms, if any. The padding value increases the box size in every direction from the minimum needed to enclose the atoms. (See also Zone.)

Precomputed subsamples

Precomputed subsamples are especially useful when the data set is large; they facilitate switching between larger regions at low resolution and smaller regions at high resolution. Precomputed subsample files decrease memory usage and time spent reading data. After a data file is opened, its contents are not read into memory until the data is displayed (with Show or automatically, see Show data when opened... in the Data display options). If Step sizes are set greater than 1 before the data is displayed, only a smaller precomputed subsample (if the appropriate one is available) will be read into memory. Subsamples of the original data can be created with the program downsize.py. Besides the more efficient use of memory, another reason to use precomputed subsamplings instead of generating them on the fly is that downsize.py offers a variety of methods for determining the subsample values. The subsample files must be associated with the correct full data file when they are opened. This is done by opening the full data file, making sure it is the current set, and then using the Open... button in the Precomputed subsamples section to open the subsample files. Along with the full data, the subsamples are listed in the pulldown Precomputed subsamplings menu according to the Step sizes inferred to have been used to generate them from the full data file. When Show is pressed, the appropriate subsample (based on Step values) is used.

It is also possible to open and work with precomputed subsample files in the "normal" way (without associating them with the full data file). However, this does not allow for easy switching among different subsamples of the same full data set.

MULTIPLE COMPONENTS

A Priism or NetCDF file can contain more than one 3D array of values (more than one component). Thus, each grid point can have several data values, for example corresponding to the different wavelengths used to image a specimen. Each component has its own threshold(s) and color(s) (see the figure). When multiple components of the same data set are rendered in the solid mode, their colors and transparencies are blended. The appearance of a solid display of multiple-component data may be suboptimal if a colormap is used (see Colormap initially off... in the Solid rendering options).

DATA CONVERSION AND PROCESSING

The following standalone programs for converting, inspecting, and processing volume data files come with Chimera. They are found in the directory chimera/share/VolumeProcessing. The term "grid file" refers to any of the volume data formats read by Volume Viewer. All of the programs that produce a new volume write it in NetCDF format only.

The standalone programs use Python code that is provided with Chimera. A current problem is that the location of these code files must be indicated explicitly before the programs can run. The PYTHONPATH environmental variable must be set (adjust the examples as needed based on where Chimera is installed). For example, on UNIX (in csh):

prompt> setenv PYTHONPATH /usr/local/chimera/lib:/usr/local/chimera/lib/Numeric:/usr/local/chimera/share
On Windows, an analogous command is required:
prompt> PYTHONPATH=c:\Progra~1\Chimera\lib;c:\Progra~1\Chimera\lib\Numeric;c:\Progra~1\Chimera\share

ProgramDescription
apply.py Apply a function to a grid file pointwise.
combine.py Add, subtract or multiply two grid files pointwise.
downsize.py Reduce data size by subsampling.
gaussian.py Convolve with a Gaussian of specified linewidth.
ridges.py Create a derived volume revealing ridges and valleys.
showheader.py Show the header of a grid file.
subregion.py Extract a subregion from a grid file.
tonetcdf.py Convert a grid file to NetCDF format.

All of the programs take command-line arguments like input file names, numeric parameters, and output file names. The types of input files are indicated with standard filename suffixes (for example, see the list of built-in volume data formats). The standard suffixes are listed in the grid_formats.py file. If the input file does not have the expected suffix, the file type can be specified on the command line by appending a colon followed by the file type (for example, mydata:delphi). Invoking any of the programs without arguments generates a short message describing the program and the needed command-line arguments.

Command-line Use

To use the programs on UNIX, add the directory to your search path. For csh (C shell), this looks like:

        % setenv PYTHONPATH /usr/local/chimera/lib:/usr/local/chimera/lib/Numeric:/usr/local/chimera/share
	% set path = (/usr/local/chimera/share/VolumeProcessing $path)
	% showheader.py 1a0m.omap
	Header for 1a0m.omap
	  size:                 92           98           88
	  xyz origin:    -1.734375    -9.365625   -5.5486111
	  xyz step:       0.346875     0.346875   0.32638889
	%

On Windows, use the DOS command prompt:

        > PYTHONPATH=c:\Progra~1\Chimera\lib;c:\Progra~1\Chimera\lib\Numeric;c:\Progra~1\Chimera\share
	> PATH=%PATH%;c:\Program Files\chimera\share\VolumeProcessing
	> showheader.py 1a0m.omap
	Header for 1a0m.omap
	  size:                 92           98           88
	  xyz origin:    -1.734375    -9.365625   -5.5486111
	  xyz step:       0.346875     0.346875   0.32638889
	>
Program apply.py

Apply a function to a grid pointwise. The resulting volume is written in NetCDF format.

Syntax: apply.py sqrt|square|abs|exp|log <infile> <outfile>
Program combine.py

Add, subtract or multiply two grid data files pointwise and write the result as a NetCDF file.

Syntax: combine.py add|subtract|multiply <infile1> <infile2> <outfile>
Program downsize.py

Reduce the size of a grid file by taking the average, maximum, minimum, or signed value of maximum magnitude over cells. The default mode is average. Produce a NetCDF output file. The cell sizes are equivalent to the Step sizes in the Data and Step menus section that would be used to generate the subsample on the fly. The output files can be used as Precomputed subsamples.

Syntax: downsize.py [-t ave|max|min|maxmag]
                    <x-cell-size> <y-cell-size> <z-cell-size>
                    <in-file> <netcdf-out-file>
Program gaussian.py

Convolve a Gaussian with grid file and write the result as a NetCDF file. The linewidth is specified in XYZ space units and spans -1 SD to +1 SD.

Syntax: gaussian.py <infile> <linewidth> <outfile>
Program ridges.py

Count the neighbors of each volume element that have lesser value. The 26 neighbors in the 3 by 3 by 3 cube centered at an element are examined. The count is shifted by -13 so 0 represents an equal number of neighbors of greater and lesser value. The resulting volume is written in NetCDF format.

Syntax: ridges.py <infile> <outfile>
Program showheader.py

Show grid size, XYZ origin and XYZ step. The XYZ origin and step are specified in the appropriate physical units for the data, e.g. angstroms, nanometers, microns. These coordinates are used when the data file is displayed in Chimera so that it aligns properly with model structures.

Syntax: showheader.py <filename> ...
Program subregion.py

Write out a subregion of a grid file in NetCDF format. The file written contains the data within and including the specified index bounds. Volume Viewer provides a similar feature: File... Save map as saves the current display region (which could be a subregion of the current set) as a file in MRC or NetCDF format.

Syntax: subregion.py <infile>
                     <imin> <imax> <jmin> <jmax> <kmin> <kmax>
                     <netcdf-outfile>
Program tonetcdf.py

Write a grid file in NetCDF format. The position and scale of the matrix in XYZ coordinate space can be changed.

Syntax: tonetcdf.py <infile> <outfile>
                    [-origin <xorigin> <yorigin> <zorigin>]
                    [-step <xstep> <ystep> <zstep>]

ADDING A FILE TYPE

A new file format can be added using Python code. The code must read the desired file type into a Numeric Python array and specify how to map data indices into Chimera XYZ positions by giving an XYZ origin (position for index 0,0,0) and XYZ step size (spacing between grid points). In the chimera/share/VolumeData directory, look at griddata.py to see the base class for volume data; this file contains useful comments. The base class defines the interface to the volume data used by Volume Viewer. For an example file reader, look at xplor_format.py and xplor_grid.py in the xplor directory. For multiple-component data (i.e., data with more than one value at each grid point), look at priism_format.py and priism_grid.py in the priism directory. The *_format.py file is the file reader, and *_grid.py wraps the data in a grid object suitable for use by Volume Viewer. The last step is to add an entry to the list of known file types in fileformats.py.

LIMITATIONS

Transfer function limitations. The conversion of data values to intensities (which occurs in the solid mode) only allows linear interpolation.

Slow remote display. Remote display is particularly slow with transparent surface and mesh displays, since the whole surface must be sent to the displaying machine every time the orientation is changed. The solid mode does not require every change in orientation to be transmitted, but remote display is still significantly slower than direct display.

Incorrect solid display of non-orthogonal crystal data. Electron density maps for non-orthogonal unit cells are displayed with the correct skew in the surface and mesh modes, but not in the solid mode. Solid displays are only correct for orthogonal unit cells.

Incorrect solid display of PROFEC data. PROFEC grids are displayed with the correct transformation in the surface and mesh modes, but not in the solid mode.

Compaq Alpha solid display problem. Solid rendering does not work on Alpha Tru64 systems with 4D51T and PS350 graphics cards. These systems exhibit incorrect OpenGL behaviour.

Transparent solid edge voxels. Solid displays are missing a half-voxel on all sides. This is due to problems in OpenGL with linear interpolation near the boundary of a texture.

Superimposing transparent models. A superposition of two models with transparency will not be shown correctly. The models will be rendered separately, and the one rendered second will not take account of the opacity of the first model. A superposition of one transparent model with one or more opaque models will be displayed correctly, however. Also, the problem does not arise when multiple components of the same data set are rendered, because only a single, correctly blended transparent model is created.

TECHNICAL NOTES

Electrostatic potential file types. DelPhi and GRASP *.phi files are both accepted as input; the file reader automatically recognizes the phi file type and reads the data accordingly.

Output MRC files. MRC files written out with File... Save map as are in the MRC 2000 format. Older MRC-reading programs or programs expecting CCP4 format will read such files successfully but may not align the data correctly with other data sets.

Non-orthogonal crystal data. Electron density maps for non-orthogonal unit cells are handled correctly by Volume Viewer (except as noted above), Fit Models in Maps, Values at Atom Positions, Surface Color, and Volume Path Tracer, but incorrectly by Phantom Force Feedback.

Byte order. Different computers store the bytes of a single numeric value in different orders. SGI Rx000 and Sun Sparc processors use one order (called big-endian), while Pentium and Compaq/DEC Alpha processors use the opposite order (called little-endian). If a binary data file is created on one machine and read on another having the opposite byte order, byte-swapping is required to get the correct numeric values. The DSN6 file reader assumes that the file was written in big-endian byte order. DSN6 files can be read on big- or little-endian machines. All of the other file readers detect file byte order and machine byte order, then perform byte-swapping if necessary.

Rendering code. Surface and mesh displays are of class Surface_Model, implemented in the Chimera _surface module; solid displays are of class Volume_Model, implemented in the Chimera _volume module.

Memory usage. The code has not been optimized fully; memory usage varies by file type.


UCSF Computer Graphics Laboratory / August 2006