io

load_image(filename[, as_vtktype, use_pillow])

Load an image.

load_polydata(file_name)

Load a vtk polydata to a supported format file.

save_image(arr, filename[, …])

Save a 2d or 3d image.

save_polydata(polydata, file_name[, binary, …])

Save a vtk polydata to a supported format file.

set_input(vtk_object, inp)

Set Generic input function which takes into account VTK 5 or 6.

load_image

fury.io.load_image(filename, as_vtktype=False, use_pillow=True)[source]

Load an image.

Parameters
  • filename (str) – should be png, bmp, jpeg or jpg files

  • as_vtktype (bool, optional) – if True, return vtk output otherwise an ndarray. Default False.

  • use_pillow (bool, optional) – Use pillow python library to load the files. Default True

Returns

image – desired image array

Return type

ndarray or vtk output

load_polydata

fury.io.load_polydata(file_name)[source]

Load a vtk polydata to a supported format file. Supported file formats are VTK, VTP, FIB, PLY, STL XML and OBJ

Parameters

file_name (string) –

Returns

output

Return type

vtkPolyData

save_image

fury.io.save_image(arr, filename, compression_quality=75, compression_type='deflation', use_pillow=True)[source]

Save a 2d or 3d image.

Expect an image with the following shape: (H, W) or (H, W, 1) or (H, W, 3) or (H, W, 4).

Parameters
  • arr (ndarray) – array to save

  • filename (string) – should be png, bmp, jpeg or jpg files

  • compression_quality (int, optional) – compression_quality for jpeg data. 0 = Low quality, 100 = High quality

  • compression_type (str, optional) – compression type for tiff file select between: None, lzw, deflation (default)

  • use_pillow (bool, optional) – Use imageio python library to save the files.

save_polydata

fury.io.save_polydata(polydata, file_name, binary=False, color_array_name=None)[source]

Save a vtk polydata to a supported format file. Save formats can be VTK, FIB, PLY, STL and XML.

Parameters
  • polydata (vtkPolyData) –

  • file_name (string) –

  • binary (bool) –

  • color_array_name (ndarray) –

set_input

fury.io.set_input(vtk_object, inp)[source]

Set Generic input function which takes into account VTK 5 or 6.

Parameters
  • vtk_object (vtk object) –

  • inp (vtkPolyData or vtkImageData or vtkAlgorithmOutput) –

Returns

Return type

vtk_object

Notes

This can be used in the following way::

from fury.utils import set_input poly_mapper = set_input(vtk.vtkPolyDataMapper(), poly_data)