IO

class Qiber3D.IO.load(path, **kwargs)

Bases: object

Returns a new Qiber3D.Network from file.

Supports: .qiber, .json, .mv3d, .tif, .nd2, .swc, .ntr

Parameters
  • path (str, Path) – file path to load

  • kwargs – key-word arguments are passed down to the individual IO functions

static binary(path)

Create a Qiber3D.Network from a .qiber file, created by Qiber3D.Network.save()

Parameters

path (str, Path) – file path to load

Returns

Qiber3D.Network

static image(path, channel=None, voxel_size=None)

Create a Qiber3D.Network from a image file.

Parameters
  • path (str, Path) – file path to load

  • channel (int, str) – either index or name of image channel

  • voxel_size (tuple(float)) – physical size of voxel in (x,y,z)

Returns

Qiber3D.Network

static json(path, data=None)

Create a Qiber3D.Network from a .json file.

Parameters
  • path (str, Path) – file path to load

  • data (dict) – load network from a dict representation of the .json file directly

Returns

Qiber3D.Network

static mv3d(path)

Create a Qiber3D.Network from a .mv3d file.

Parameters

path (str, Path) – file path to load

Returns

Qiber3D.Network

static nd2(path, channel=None)

Create a Qiber3D.Network from a .nd2 file.

Parameters
  • path (str, Path) – file path to load

  • channel (int, str) – either index or name of image channel

Returns

Qiber3D.Network

static network(net, scale=1, input_path=None, segment_list=None)

Create a new Qiber3D.Network from a Qiber3D.Network.

Parameters
  • net (Qiber3D.Network) – original network

  • scale (float) – scale all points and radii by this value

  • input_path (str, Path) – set this path as new imput path of the returning network

  • segment_list (tuple) – limit the new network to this list of segments (sid)

Returns

Qiber3D.Network

static ntr(path)

Create a Qiber3D.Network from a .ntr file.

Parameters

path (str, Path) – file path to load

Returns

Qiber3D.Network

static swc(path, allowed_types=None)

Create a Qiber3D.Network from a .swc file.

Parameters
  • path (str, Path) – file path to load

  • allowed_types (tuple) – limit the returned network to these SEGMENT_TYPEs

Returns

Qiber3D.Network

classmethod synthetic_network()

Create the synthetic test network.

Returns

Qiber3D.Network

class Qiber3D.IO.export(net, out_path='.', overwrite=False, mode=None, **kwargs)

Bases: object

Export a Qiber3D.Network to file. Selecting the appropriate format based on the file suffix.

Supports: .qiber, .json, .mv3d, .tif, .nd2, .swc, .csv, .tsv, .xlsx, .x3d

Parameters
  • net (Qiber3D.Network) – network to export

  • out_path (str, Path) – file or folder path where to save the network

  • overwrite (bool) – allow file overwrite

  • mode (str) – select the file format ignoring the file suffix. Choose from [‘binary’, ‘json’, ‘mv3d’, ‘x3d’, ‘swc’, ‘xlsx’, ‘csv’, ‘tsv’, ‘tif’]

  • kwargs – key-word arguments are passed down to the individual IO functions

Returns

path to saved file

Return type

Path

static binary(net, out_path='.', overwrite=False, save_steps=False)

Export Qiber3D.Network as binary file (.qiber).

Parameters
  • net (Qiber3D.Network) – network to export

  • out_path (str, Path) – file or folder path where to save the network

  • overwrite (bool) – allow file overwrite

  • save_steps (bool) – save extraction steps image stacks

Returns

path to saved file

Return type

Path

static csv(net, out_path='.', overwrite=False, separator=';')

Export Qiber3D.Network as .csv file.

Parameters
  • net (Qiber3D.Network) – network to export

  • out_path (str, Path) – file or folder path where to save the network

  • overwrite (bool) – allow file overwrite

  • separator (str) – char to separate values

Returns

path to saved file

Return type

Path

static json(net, out_path='.', overwrite=False)

Export Qiber3D.Network as .json file.

Parameters
  • net (Qiber3D.Network) – network to export

  • out_path (str, Path) – file or folder path where to save the network

  • overwrite (bool) – allow file overwrite

Returns

path to saved file

Return type

Path

static mv3d(net, out_path='.', overwrite=False)

Export Qiber3D.Network as .mv3d file.

Parameters
  • net (Qiber3D.Network) – network to export

  • out_path (str, Path) – file or folder path where to save the network

  • overwrite (bool) – allow file overwrite

Returns

path to saved file

Return type

Path

static swc(net, out_path='.', overwrite=False, multiple_files=False)

Export Qiber3D.Network as .swc file.

Parameters
  • net (Qiber3D.Network) – network to export

  • out_path (str, Path) – file or folder path where to save the network

  • overwrite (bool) – allow file overwrite

  • multiple_files (bool) – save each fiber as separate swc file

Returns

path to saved file

Return type

Path

static tif(net, out_path='.', overwrite=False, voxel_resolution=None, segment_list=None)

Export Qiber3D.Network as .tif image stack.

Parameters
  • net (Qiber3D.Network) – network to export

  • out_path (str, Path) – file or folder path where to save the network, if None show the plot.

  • overwrite (bool) – allow file overwrite

  • voxel_resolution (float) – number of voxels per unit length

  • segment_list (tuple) – limit the visualisation to certain segment (use sid)

Returns

path to saved file

Return type

Path

static x3d(net, out_path='.', overwrite=False, color_mode='flat', color_map='jet', color=None, object_type=None, segment_list=None, azimuth=None, elevation=None, roll=None)

Export Qiber3D.Network as .x3d file.

Parameters
  • net (Qiber3D.Network) – network to export

  • out_path (str, Path) – file or folder path where to save the network

  • overwrite (bool) – allow file overwrite

  • color_mode (str) – sets the way to color the network choose one of [‘flat’, ‘fiber’, ‘fiber_length’, ‘fiber_volume’, ‘segment’, ‘segment_length’, ‘segment_volume’, ‘fiber_segment_ratio’]

  • color_map (str) – name of a matplotlib colormap

  • color (tuple(float)) – color if color_mode is ‘flat’

  • object_type (str) – when set to ‘line’ render center line

  • segment_list (tuple) – limit the visualisation to certain segment (use sid)

  • azimuth (float) – change camera azimuth

  • elevation (float) – change camera elevation

  • roll (float) – roll camera

Returns

path to saved file

Return type

Path

static xlsx(net, out_path='.', overwrite=False)

Export Qiber3D.Network as Excel file (.xlsx).

Parameters
  • net (Qiber3D.Network) – network to export

  • out_path (str, Path) – file or folder path where to save the network

  • overwrite (bool) – allow file overwrite

Returns

path to saved file

Return type

Path