bmmltools.utils.geometric.ChangeCoordinateSystem

class bmmltools.utils.geometric.ChangeCoordinateSystem(reference_frame_origin, xyz_to_XYZ_inv_map, xyz_to_XYZ_specs, use_xyz_ordering=True)

Bases: object

This class can be used to change the reference frame in which a volume is visualized.

__init__(reference_frame_origin, xyz_to_XYZ_inv_map, xyz_to_XYZ_specs, use_xyz_ordering=True)

The new reference frame is specified by using the inverse of the map from the old to the new coordinated and from a specification dictionary (called ‘xyz_to_XYZ_specs’) which has to be the following structure:

{‘new_shape’: (tuple) Shape of the volume in the new reference frame.

‘X_bounds’: (tuple/list/numpy array) Min and max value of the X coordinate.

‘Y_bounds’: (tuple/list/numpy array) Min and max value of the Y coordinate.

‘Z_bounds’: (tuple/list/numpy array) Min and max value of the Z coordinate.

‘XYZ_ordering’: (None or tuple/list/numpy array of int) Ordering of the coordinates in the new reference frame. If None the order is the one implicitly specified in the above fields.

}

Parameters:
  • reference_frame_origin – (tuple/list/numpy array) Position of the origin in the new reference frame.

  • xyz_to_XYZ_inv_map – (python function with 3 inputs) Inverse mapping between the reference frame ‘xyz’ and the reference frame ‘XYZ’.

  • xyz_to_XYZ_specs – (dict) Dictionary containing the specifications of the new reference frame.

  • use_xyz_ordering – (bool) if True, the default ordering of the axis in the stack (which is ‘zyx’) is converted to the cartesian ordering (i.e. ‘xyz’).

Methods

__init__(reference_frame_origin, ...[, ...])

The new reference frame is specified by using the inverse of the map from the old to the new coordinated and from a specification dictionary (called 'xyz_to_XYZ_specs') which has to be the following structure:

transform(volume, **kwargs)

Apply the initialized transformation.

transform(volume, **kwargs)

Apply the initialized transformation.

Parameters:

volume – (numpy.ndarray) volume on which the transformation is applied.