map: Density maps

class Volume(data, session, region=None, rendering_options=None, model_id=None, open_model=True, message_cb=None)

Bases: chimerax.core.models.Model

A Volume is a rendering of a 3-d image Grid_Data object. It includes color, display styles including surface, mesh and grayscale, contouring levels, brightness and transparency for grayscale rendering, region bounds for display a subregion including single plane display, subsampled display of every Nth data value along each axis, outline box display.

initialize_thresholds(first_time_only=True, vfrac=(0.01, 0.9), mfrac=None, replace=False)

Set default initial surface and solid style rendering thresholds. The thresholds are only changed the first time this method is called or if the replace option is True. Returns True if thresholds are changed.

new_region(ijk_min=None, ijk_max=None, ijk_step=None, show=True, adjust_step=True, save_in_region_queue=True)

Set new display region and optionally shows it.


Set volume display parameters. The following keyword parameters are valid.

surface_levels surface_colors (rgb or rgba values) surface_brightness_factor transparency_factor solid_levels solid_colors (rgb or rgba values) transparency_depth solid_brightness_factor

Any rendering option attribute names can also be used.

The volume display is not automatically updated. Use when redisplay is desired.


Set display style to “surface”, “mesh”, or “solid”.


Alpha values in range 0-255. Only changes current style (surface/mesh or solid).

show(representation=None, rendering_options=None, show=True)

Display the volume using the current parameters.

show_outline_box(show, rgb, linewidth)

Show an outline box enclosing the displayed subregion of the volume.

open_map(session, stream, name=None, format=None, **kw)

Open a density map file having any of the known density map formats.

save_map(session, path, format_name, models=None, region=None, step=(1, 1, 1), mask_zone=True, chunk_shapes=None, append=None, compress=None, base_index=1, **kw)

Save a density map file having any of the known density map formats.

class Grid_Data(size, value_type=<class 'numpy.float32'>, origin=(0, 0, 0), step=(1, 1, 1), cell_angles=(90, 90, 90), rotation=((1, 0, 0), (0, 1, 0), (0, 0, 1)), symmetries=None, name='', path='', file_type='', grid_id='', default_color=None, time=None, channel=None)

Bases: object

3-dimensional array of numeric values usually representing a density map from electron microscopy, x-ray crystallography or optical imaging. The grid points are positioned in space with array index (0,0,0) at the xyz origin, and spacing along the xyz axes given by the step parameter. The rectangular grid can be skewed by specifying angles between each pair of axes as is done to describe crystallographic unit cells. The grid can also be rotated. Values are read from a file for rectangular subregions of the data and cached in memory. The numeric values can be signed or unsigned integer of 8, 16, or 32 bits or real 32-bit or 64-bit values.


A matrix i,j,k index corresponds to a point in x,y,z space. This function maps the matrix index to the xyz point. The index can be floating point, non-integral values.

matrix(ijk_origin=(0, 0, 0), ijk_size=None, ijk_step=(1, 1, 1), progress=None, from_cache_only=False)

Return a numpy array for a box shaped subregion of the data with specified index origin and size. Every Nth point can be take along an axis by specifying ijk_step. If step size is greater than 1 then the returned array will be smaller than the requested size. The requested ijk_size refers to the region size of the full-resolution array (counting every grid point). The array can be read from a file or be a cached copy in memory. The array should not be modified.

read_matrix(ijk_origin=(0, 0, 0), ijk_size=None, ijk_step=(1, 1, 1), progress=None)

Must overide this function in derived class to return a 3 dimensional NumPy matrix. The returned matrix has size ijk_size and element ijk is accessed as m[k,j,i]. It is an error if the requested submatrix does not lie completely within the full data matrix. It is also an error for the size to be <= 0 in any dimension. These invalid inputs might throw an exception or might return garbage. It is the callers responsibility to make sure the arguments are valid.


A matrix i,j,k index corresponds to a point in x,y,z space. This function maps the xyz point to the matrix index. The returned matrix index is floating point and need not be integers.