map: Density maps

class Volume(session, data, region=None, rendering_options=None)

Bases: Model

A Volume is a rendering of a 3-d image GridData 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.

__init__(session, data, region=None, rendering_options=None)

Supported API . Create a volume model from a GridData instance.

surfaces

Supported API . Return a list of VolumeSurface instances for this Volume.

add_surface(level, rgba=(0.7, 0.7, 0.7, 1), display=True)

Supported API . Create and add a new VolumeSurface with specified contour level and color.

remove_surfaces(surfaces=None)

Supported API . Remove a list of VolumeSurface instances from this Volume. If surfaces is None then all current surfaces are removed.

set_parameters(**kw)

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

surface_levels surface_colors (rgb or rgba values) transparency (for surfaces) brightness (scales surface brightness) image_levels image_colors (rgb or rgba values) transparency_depth image_brightness_factor

Any rendering option attribute names can also be used.

set_transparency(alpha)

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

new_region(ijk_min=None, ijk_max=None, ijk_step=None, adjust_step=True, adjust_voxel_limit=True)

Experimental API . Set new display region and optionally shows it.

set_display_style(style)

Experimental API . Set display style to “surface”, “mesh”, or “image”.

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

Experimental API . Deprecated: Use v.display = True. Display the volume using the current parameters.

show_outline_box(show, rgb, linewidth)

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

surface_bounds()

Experimental API . Surface bounds in volume coordinate system.

first_intercept(mxyz1, mxyz2, exclude=None)

Experimental API . Find the first intercept of a line segment with the displayed part of this drawing and its children. The end points are in the parent drawing coordinates and do not take account of this Drawings positions. If the exclude option is given it is a function that takes a drawing and returns true if this drawing and its children should be excluded. Return a Pick object for the intercepted item. The Pick object has a distance attribute giving the fraction (0-1) along the segment where the intersection occurs. For no intersection None is returned. This routine is used for highlighting objects, for identifying objects during mouse-over, and to determine the front-most point in the center of view to be used as the interactive center of rotation.

planes_pick(planes, exclude=None)

Experimental API . Find the displayed drawing instances bounded by the specified planes for this drawing and its children. Each plane is a 4-vector v with points in the pick region v0*x + v1*y + v2*z + v3 >= 0 using coordinate system of the parent drawing. If a drawing has instances then only the center of each instance is considered and the whole instance is picked if the center is within the planes. If a drawing has only one instance (self.positions has length 1) then the pick lists the individual triangles which have at least one vertex within all of the planes. If exclude is not None then it is a function called with a Drawing argument that returns true if this drawing and its children should be excluded from the pick. Return a list of Pick objects for the contained items. This routine is used for highlighting objects in a frustum.

selected

Experimental API . Is this model selected? If fully is true then are all parts of this model selected?

showing_transparent()

Experimental API . Are any transparent objects being displayed. Includes all children.

delete()

Experimental API . Delete this model.

take_snapshot(session, flags)

Experimental API . Return snapshot of current state of instance.

The semantics of the data is unknown to the caller. Returns None if should be skipped. The default implementation is for non-core classes and returns a copy of the instance dictionary (a deep copy of lists/dicts/etc., but shallow copy of named objects). Named objects are later converted to unique names.

static restore_snapshot(session, data)

Experimental API . Create object using snapshot data.

class VolumeImage(volume)

Bases: Image3d

__init__(volume)

Experimental API . Initialize self. See help(type(self)) for accurate signature.

delete()

Experimental API . Delete this model.

single_color

Experimental API . Return average color.

take_snapshot(session, flags)

Experimental API . Return snapshot of current state of instance.

The semantics of the data is unknown to the caller. Returns None if should be skipped. The default implementation is for non-core classes and returns a copy of the instance dictionary (a deep copy of lists/dicts/etc., but shallow copy of named objects). Named objects are later converted to unique names.

static restore_snapshot(session, data)

Experimental API . Create object using snapshot data.

class VolumeSurface(volume, level, rgba=(1, 1, 1, 1), mesh=False)

Bases: Surface

__init__(volume, level, rgba=(1, 1, 1, 1), mesh=False)

Experimental API . Initialize self. See help(type(self)) for accurate signature.

delete()

Experimental API . Delete this model.

rgba

Experimental API . Float red,green,blue,alpha values in range 0-1

set_transparency(transparency)

Experimental API . Set surface transparency, 0-1 range.

set_brightness(brightness)

Experimental API . Scale color so maximum of red, green, blue components equals 255*brightness.

take_snapshot(session, flags)

Experimental API . Return snapshot of current state of instance.

The semantics of the data is unknown to the caller. Returns None if should be skipped. The default implementation is for non-core classes and returns a copy of the instance dictionary (a deep copy of lists/dicts/etc., but shallow copy of named objects). Named objects are later converted to unique names.

static restore_snapshot(session, data)

Experimental API . Create object using snapshot data.

class PickedMap(v, distance=None, detail='')

Bases: Pick

__init__(v, distance=None, detail='')

Experimental API . Initialize self. See help(type(self)) for accurate signature.

description()

Experimental API . Text description of the picked object.

specifier()

Experimental API . Command specifier for the picked object.

select(mode='add')

Experimental API . Cause this picked object to be highlighted (‘add’ mode), unhighlighted (‘subtract’ mode) or toggle highlighted (‘toggle’ mode).

volume_from_grid_data(grid_data, session, style='auto', open_model=True, model_id=None, show_dialog=True)

Supported API . Create a new Volume model from a GridData instance and set its initial display style and color and add it to the session open models.

exception CancelOperation

Bases: BaseException

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

Supported API . Open a density map file having any of the known density map formats. File path can be a string or list of paths.

class MapChannelsModel(name, maps, session)

Bases: Model, MapChannels

__init__(name, maps, session)

Experimental API . Initialize self. See help(type(self)) for accurate signature.

take_snapshot(session, flags)

Experimental API . Return snapshot of current state of instance.

The semantics of the data is unknown to the caller. Returns None if should be skipped. The default implementation is for non-core classes and returns a copy of the instance dictionary (a deep copy of lists/dicts/etc., but shallow copy of named objects). Named objects are later converted to unique names.

static restore_snapshot(session, data)

Experimental API . Create object using snapshot data.

class MultiChannelSeries(name, map_series, session)

Bases: Model

__init__(name, map_series, session)

Experimental API . Initialize self. See help(type(self)) for accurate signature.

take_snapshot(session, flags)

Experimental API . Return snapshot of current state of instance.

The semantics of the data is unknown to the caller. Returns None if should be skipped. The default implementation is for non-core classes and returns a copy of the instance dictionary (a deep copy of lists/dicts/etc., but shallow copy of named objects). Named objects are later converted to unique names.

static restore_snapshot(session, data)

Experimental API . Create object using snapshot data.

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)

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

class GridData(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.

__init__(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)

Supported API .

ijk_to_xyz(ijk)

Experimental API . 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)

Experimental API . 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)

Experimental API . 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.

voxel_volume()

Experimental API . Volume of one voxel including skewing.

xyz_to_ijk(xyz)

Experimental API . 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.

class GridSubregion(grid_data, ijk_min, ijk_max, ijk_step=(1, 1, 1))

Bases: GridData

__init__(grid_data, ijk_min, ijk_max, ijk_step=(1, 1, 1))

Supported API .

read_matrix(ijk_origin, ijk_size, ijk_step, progress)

Experimental API . 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.

class ArrayGridData(array, origin=(0, 0, 0), step=(1, 1, 1), cell_angles=(90, 90, 90), rotation=((1, 0, 0), (0, 1, 0), (0, 0, 1)), symmetries=(), name='')

Bases: GridData

__init__(array, origin=(0, 0, 0), step=(1, 1, 1), cell_angles=(90, 90, 90), rotation=((1, 0, 0), (0, 1, 0), (0, 0, 1)), symmetries=(), name='')

Supported API . The array argument is a numpy 3-dimensional array.

read_matrix(ijk_origin, ijk_size, ijk_step, progress)

Experimental API . 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.