io#

load_cubemap_texture(fnames, *[, ...])

Load a cube map texture from a list of 6 images.

load_image(filename, *[, as_vtktype, use_pillow])

Load an image.

load_text(file)

Load a text file.

save_image(arr, filename, *[, ...])

Save a 2d or 3d image.

load_polydata(file_name)

Load a vtk polydata to a supported format file.

save_polydata(polydata, file_name, *[, ...])

Save a vtk polydata to a supported format file.

load_sprite_sheet(sheet_path, nb_rows, ...)

Process and load sprites from a sprite sheet.

load_cubemap_texture#

fury.io.load_cubemap_texture(fnames, *, interpolate_on=True, mipmap_on=True)[source]#

Load a cube map texture from a list of 6 images.

Parameters:
fnameslist of strings

List of 6 filenames with bmp, jpg, jpeg, png, tif or tiff extensions.

interpolate_onbool, optional
mipmap_onbool, optional
Returns:
outputvtkTexture

Cube map texture.

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: ndarray or vtk output

desired image array

load_text#

fury.io.load_text(file)[source]#

Load a text file.

Parameters:
file: str

Path to the text file.

Returns:
text: str

Text contained in the file.

save_image#

fury.io.save_image(arr, filename, *, compression_quality=75, compression_type='deflation', use_pillow=True, dpi=(72, 72))[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:
arrndarray

array to save

filenamestring

should be png, bmp, jpeg or jpg files

compression_qualityint, optional

compression_quality for jpeg data. 0 = Low quality, 100 = High quality

compression_typestr, optional

compression type for tiff file select between: None, lzw, deflation (default)

use_pillowbool, optional

Use imageio python library to save the files.

dpifloat or (float, float)

Dots per inch (dpi) for saved image. Single values are applied as dpi for both dimensions.

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_namestring
Returns:
outputvtkPolyData

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:
polydatavtkPolyData
file_namestring
binarybool
color_array_name: ndarray

load_sprite_sheet#

fury.io.load_sprite_sheet(sheet_path, nb_rows, nb_cols, *, as_vtktype=False)[source]#

Process and load sprites from a sprite sheet.

Parameters:
sheet_path: str

Path to the sprite sheet

nb_rows: int

Number of rows in the sprite sheet

nb_cols: int

Number of columns in the sprite sheet

as_vtktype: bool, optional

If True, the output is a vtkImageData

Returns:
Dict containing the processed sprites.