layout
#

Provide functionalities for laying out actors in a 2D grid fashion. 

Provide functionalities for laying out actors in a horizontal layout. 

Provide functionalities for laying out actors in a 3D scene. 

Provide functionalities for laying out actors in a vertical stack. 

Provide functionalities for laying out actors along xaxis. 

Provide functionalities for laying out actors along yaxis. 

Provide functionalities for laying out actors along zaxis. 

Get the bounding box sizes of an actor. 

Construct a XYgrid based on the cells content shape. 

Method to check if the passed actor is UI or vtkProp3D 
GridLayout
#
 class fury.layout.GridLayout(cell_padding=0, cell_shape='rect', aspect_ratio=1.7777777777777777, dim=None, position_offset=(0, 0, 0))[source]#
Bases:
Layout
Provide functionalities for laying out actors in a 2D grid fashion.
The GridLayout class lays the actors in a 2D structured grid aligned with the xyplane.
 __init__(cell_padding=0, cell_shape='rect', aspect_ratio=1.7777777777777777, dim=None, position_offset=(0, 0, 0))[source]#
 Parameters:
cell_padding (2tuple of float or float (optional)) – Each grid cell will be padded according to (pad_x, pad_y) i.e. horizontally and vertically. Padding is evenly distributed on each side of the cell. If a single float is provided then both pad_x and pad_y will have the same value.
cell_shape ({'rect', 'square', 'diagonal'} (optional)) – Specifies the desired shape of every grid cell. ‘rect’ ensures the cells are the tightest. ‘square’ ensures the cells are as wide as high. ‘diagonal’ ensures the content of the cells can be rotated without colliding with content of the neighboring cells.
aspect_ratio (float (optional)) – Aspect ratio of the grid (width/height). Default: 16:9.
dim (tuple of int (optional)) – Dimension (nb_rows, nb_cols) of the grid. If provided, aspect_ratio will be ignored.
position_offset (tuple (optional)) – Offset the grid by some factor
 compute_positions(actors)[source]#
Compute the 3D coordinates of some actors. The coordinates will lie on the xyplane and form a 2D grid. :param actors: Actors to be layout in a grid manner. :type actors: list of vtkProp3D objects
 Returns:
The computed 3D coordinates of every actors.
 Return type:
list of 3tuple
HorizontalLayout
#
 class fury.layout.HorizontalLayout(cell_padding=0, cell_shape='rect')[source]#
Bases:
GridLayout
Provide functionalities for laying out actors in a horizontal layout.
 __init__(cell_padding=0, cell_shape='rect')[source]#
 Parameters:
cell_padding (2tuple of float or float (optional)) – Each grid cell will be padded according to (pad_x, pad_y) i.e. horizontally and vertically. Padding is evenly distributed on each side of the cell. If a single float is provided then both pad_x and pad_y will have the same value.
cell_shape ({'rect', 'square', 'diagonal'} (optional)) – Specifies the desired shape of every grid cell. ‘rect’ ensures the cells are the tightest. ‘square’ ensures the cells are as wide as high. ‘diagonal’ ensures the content of the cells can be rotated without colliding with content of the neighboring cells.
 compute_positions(actors)[source]#
Compute the 3D coordinates of some actors. The coordinates will lie on the xyplane and form a horizontal stack. :param actors: Actors to be layout in a horizontal fashion. :type actors: list of vtkProp3D objects
 Returns:
The computed 3D coordinates of every actors.
 Return type:
list of 3tuple
Layout
#
VerticalLayout
#
 class fury.layout.VerticalLayout(cell_padding=0, cell_shape='rect')[source]#
Bases:
GridLayout
Provide functionalities for laying out actors in a vertical stack.
 __init__(cell_padding=0, cell_shape='rect')[source]#
 Parameters:
cell_padding (2tuple of float or float (optional)) – Each cell will be padded according to (pad_x, pad_y) i.e. horizontally and vertically. Padding is evenly distributed on each side of the cell. If a single float is provided then both pad_x and pad_y will have the same value.
cell_shape ({'rect', 'square', 'diagonal'} (optional)) – Specifies the desired shape of every cell. ‘rect’ ensures the cells are the tightest. ‘square’ ensures the cells are as wide as high. ‘diagonal’ ensures the content of the cells can be rotated without colliding with content of the neighboring cells.
XLayout
#
 class fury.layout.XLayout(direction='x+', cell_padding=0, cell_shape='rect')[source]#
Bases:
HorizontalLayout
Provide functionalities for laying out actors along xaxis.
 __init__(direction='x+', cell_padding=0, cell_shape='rect')[source]#
 Parameters:
direction (str, optional) – The direction of layout. ‘x+’ means actors will be placed along positive xaxis. ‘x’ means actors will be placed along negative xaxis.
cell_padding (2tuple of float or float (optional)) – Each cell will be padded according to (pad_x, pad_y) i.e. horizontally and vertically. Padding is evenly distributed on each side of the cell. If a single float is provided then both pad_x and pad_y will have the same value.
cell_shape ({'rect', 'square', 'diagonal'} (optional)) – Specifies the desired shape of every cell. ‘rect’ ensures the cells are the tightest. ‘square’ ensures the cells are as wide as high. ‘diagonal’ ensures the content of the cells can be rotated without colliding with content of the neighboring cells.
 compute_positions(actors)[source]#
Compute the 3D coordinates of some actors.
The coordinates will lie on the xyplane and will be placed along xaxis.
 Parameters:
actors (list of vtkProp3D objects) – Actors to be layout along the xaxis.
 Returns:
The computed 3D coordinates of every actors.
 Return type:
list of 3tuple
YLayout
#
 class fury.layout.YLayout(direction='y+', cell_padding=0, cell_shape='rect')[source]#
Bases:
VerticalLayout
Provide functionalities for laying out actors along yaxis.
 __init__(direction='y+', cell_padding=0, cell_shape='rect')[source]#
 Parameters:
direction (str, optional) – The direction of layout. ‘y+’ means actors will be placed along positive yaxis. ‘y’ means actors will be placed along negative yaxis.
cell_padding (2tuple of float or float (optional)) – Each cell will be padded according to (pad_x, pad_y) i.e. horizontally and vertically. Padding is evenly distributed on each side of the cell. If a single float is provided then both pad_x and pad_y will have the same value.
cell_shape ({'rect', 'square', 'diagonal'} (optional)) – Specifies the desired shape of every cell. ‘rect’ ensures the cells are the tightest. ‘square’ ensures the cells are as wide as high. ‘diagonal’ ensures the content of the cells can be rotated without colliding with content of the neighboring cells.
 compute_positions(actors)[source]#
Compute the 3D coordinates of some actors.
The coordinates will lie on the xyplane and will be placed along yaxis.
 Parameters:
actors (list of vtkProp3D objects) – Actors to be layout along the yaxis.
 Returns:
The computed 3D coordinates of every actors.
 Return type:
list of 3tuple
ZLayout
#
 class fury.layout.ZLayout(direction='z+', cell_padding=0, cell_shape='rect')[source]#
Bases:
GridLayout
Provide functionalities for laying out actors along zaxis.
 __init__(direction='z+', cell_padding=0, cell_shape='rect')[source]#
 Parameters:
direction (str, optional) – The direction of layout. ‘z+’ means actors will be placed along positive zaxis. ‘z’ means actors will be placed along negative zaxis.
cell_padding (2tuple of float or float (optional)) – Each cell will be padded according to (pad_x, pad_y) i.e. horizontally and vertically. Padding is evenly distributed on each side of the cell. If a single float is provided then both pad_x and pad_y will have the same value.
cell_shape ({'rect', 'square', 'diagonal'} (optional)) – Specifies the desired shape of every cell. ‘rect’ ensures the cells are the tightest. ‘square’ ensures the cells are as wide as high. ‘diagonal’ ensures the content of the cells can be rotated without colliding with content of the neighboring cells.
get_bounding_box_sizes#
get_grid_cells_position#
 fury.layout.get_grid_cells_position(shapes, aspect_ratio=1.7777777777777777, dim=None)[source]#
Construct a XYgrid based on the cells content shape.
This function generates the coordinates of every grid cell. The width and height of every cell correspond to the largest width and the largest height respectively. The grid dimensions will automatically be adjusted to respect the given aspect ratio unless they are explicitly specified.
The grid follows a rowmajor order with the top left corner being at coordinates (0,0,0) and the bottom right corner being at coordinates (nb_cols*cell_width, nb_rows*cell_height, 0). Note that the X increases while the Y decreases.
 Parameters:
 Returns:
3D coordinates of every grid cell.
 Return type:
ndarray