layout#

Layout()

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

GridLayout([cell_padding, cell_shape, ...])

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

HorizontalLayout([cell_padding, cell_shape])

Provide functionalities for laying out actors in a horizontal layout.

VerticalLayout([cell_padding, cell_shape])

Provide functionalities for laying out actors in a vertical stack.

XLayout([direction, cell_padding, cell_shape])

Provide functionalities for laying out actors along x-axis.

YLayout([direction, cell_padding, cell_shape])

Provide functionalities for laying out actors along y-axis.

ZLayout([direction, cell_padding, cell_shape])

Provide functionalities for laying out actors along z-axis.

Layout#

class fury.layout.Layout[source]#

Bases: object

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

__init__()#
apply(actors)[source]#

Position the actors according to a certain layout.

compute_positions(_actors)[source]#

Compute the 3D coordinates of some actors.

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 xy-plane.

__init__(cell_padding=0, cell_shape='rect', aspect_ratio=1.7777777777777777, dim=None, position_offset=(0, 0, 0))[source]#

Initialize the grid layout. :param cell_padding: 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.

Parameters:
  • 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 xy-plane and form a 2D grid.

Parameters:

actors (list of vtkProp3D objects) – Actors to be layout in a grid manner.

Returns:

The computed 3D coordinates of every actors.

Return type:

list of 3-tuple

compute_sizes(actor)[source]#

Compute the bounding box size of the actor/UI element

Parameters:

actor (vtkProp3D or UI element) – Actor/UI element whose size is to be calculated

Returns:

bounding box sizes

Return type:

tuple

get_cells_shape(actors)[source]#

Get the 2D shape (on the xy-plane) of some actors according to self.cell_shape.

Parameters:

actors (list of vtkProp3D objects) – Actors from which to calculate the 2D shape.

Returns:

The 2D shape (on the xy-plane) of every actors.

Return type:

list of 2-tuple

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]#

Initialize the Horizontal layout.

Parameters:
  • cell_padding (2-tuple 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 xy-plane and form a horizontal stack.

Parameters:

actors (list of vtkProp3D objects) – Actors to be layout in a horizontal fashion.

Returns:

The computed 3D coordinates of every actors.

Return type:

list of 3-tuple

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]#

Initialize the Vertical layout.

Parameters:
  • cell_padding (2-tuple 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.

Parameters:

actors (list of vtkProp3D objects) – Actors to be layout in a vertical stack.

Returns:

The computed 3D coordinates of every actors.

Return type:

list of 3-tuple

XLayout#

class fury.layout.XLayout(direction='x+', cell_padding=0, cell_shape='rect')[source]#

Bases: HorizontalLayout

Provide functionalities for laying out actors along x-axis.

__init__(direction='x+', cell_padding=0, cell_shape='rect')[source]#

Initialize the X layout.

Parameters:
  • direction (str, optional) – The direction of layout. ‘x+’ means actors will be placed along positive x-axis. ‘x-’ means actors will be placed along negative x-axis.

  • cell_padding (2-tuple 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.

apply(actors)[source]#

Position the actors according to a certain layout.

compute_positions(actors)[source]#

Compute the 3D coordinates of some actors.

The coordinates will lie on the xy-plane and will be placed along x-axis.

Parameters:

actors (list of vtkProp3D objects) – Actors to be layout along the x-axis.

Returns:

The computed 3D coordinates of every actors.

Return type:

list of 3-tuple

get_cells_shape(actors)[source]#

Get the 2D shape (on the xy-plane) of some actors according to self.cell_shape.

Parameters:

actors (list of vtkProp3D objects) – Actors from which to calculate the 2D shape.

Returns:

The 2D shape (on the xy-plane) of every actors.

Return type:

list of 2-tuple

YLayout#

class fury.layout.YLayout(direction='y+', cell_padding=0, cell_shape='rect')[source]#

Bases: VerticalLayout

Provide functionalities for laying out actors along y-axis.

__init__(direction='y+', cell_padding=0, cell_shape='rect')[source]#

Initialize the Y layout.

Parameters:
  • direction (str, optional) – The direction of layout. ‘y+’ means actors will be placed along positive y-axis. ‘y-’ means actors will be placed along negative y-axis.

  • cell_padding (2-tuple 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.

apply(actors)[source]#

Position the actors according to a certain layout.

compute_positions(actors)[source]#

Compute the 3D coordinates of some actors.

The coordinates will lie on the xy-plane and will be placed along y-axis.

Parameters:

actors (list of vtkProp3D objects) – Actors to be layout along the y-axis.

Returns:

The computed 3D coordinates of every actors.

Return type:

list of 3-tuple

get_cells_shape(actors)[source]#

Get the 2D shape (on the xy-plane) of some actors according to self.cell_shape.

Parameters:

actors (list of vtkProp3D objects) – Actors from which to calculate the 2D shape.

Returns:

The 2D shape (on the xy-plane) of every actors.

Return type:

list of 2-tuple

ZLayout#

class fury.layout.ZLayout(direction='z+', cell_padding=0, cell_shape='rect')[source]#

Bases: GridLayout

Provide functionalities for laying out actors along z-axis.

__init__(direction='z+', cell_padding=0, cell_shape='rect')[source]#

Initialize the Z layout.

Parameters:
  • direction (str, optional) – The direction of layout. ‘z+’ means actors will be placed along positive z-axis. ‘z-’ means actors will be placed along negative z-axis.

  • cell_padding (2-tuple 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.

apply(actors)[source]#

Position the actors according to a certain layout.

compute_positions(actors)[source]#

Compute the 3D coordinates of some actors.

Parameters:

actors (list of vtkProp3D objects) – Actors to be layout along the z-axis.

Returns:

The computed 3D coordinates of every actors.

Return type:

list of 3-tuple

get_cells_shape(actors)[source]#

Get the shape (on the z-plane) of some actors according to self.cell_shape.

Parameters:

actors (list of vtkProp3D objects) – Actors from which to calculate the shape.

Returns:

The shape (on the z-plane) of every actors.

Return type:

list of floats