Render¶
- class Qiber3D.Render(network)¶
Bases:
object
Generate 3D representations
- Parameters
network (
Qiber3D.Network
) –- Variables
storage (
Qiber3D.helper.NumpyMemoryManager
) – storage for rasterized dataraster (np.ndarray) – rasterized representation of the network
raster_resolution (float) – voxel per length unit
raster_offset (tuple(float)) – distance between raster image stack origin and network orgin
- animation(out_path='.', overwrite=False, duration=3, fps=30, height=None, color_mode='fiber', color_map='jet', color=None, background=None, object_type=None, segment_list=None, rgba=False, zoom=None)¶
Animate a network by rotate the camera around it. Saves as h264
.mp4
file by default. Supports also.webm
and.gif
as target.- Parameters
out_path (str, Path) – file or folder path where to save the network, if None show the plot.
overwrite (bool) – allow file overwrite
duration (float) – animation duration in seconds
fps (int) – frames per second
height (int) – height of the animation (16:9 format)
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’
background (tuple(float)) – background color
object_type (str) – when set to ‘line’ render center line
segment_list (tuple) – limit the visualisation to certain segment (use sid)
rgba (bool) – allow transparency in saved file (for
.gif
and.webm
)zoom (float) – zoom by rendering a larger image and cutting it down afterwards (must be > 1.0)
- Returns
path to saved file
- Return type
Path
- compare(color_mode='flat', color_map='jet', color=None, object_type=None, segment_list=None)¶
Visualize extraction steps (original image, z-drop image, binary image, reconstruction) at once. The parameter influence just the reconstructed network.
- Parameters
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)
- export_image_stack(out_path='.', overwrite=False, voxel_resolution=None, segment_list=None)¶
Export a network as TIFF image stack.
- Parameters
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
- export_intensity_projection(image=None, out_path='.', overwrite=False, color_map='bone', mode='max', axis='z', voxel_resolution=None, segment_list=None)¶
Create a intensity projection of the rasterized network.
- Parameters
out_path (str, Path) – file or folder path where to save the network, if None show the plot.
overwrite (bool) – allow file overwrite
mode (str) – projection mode, choose between ‘max’ or ‘average’
axis (str) – project along this axis (x, y, z)
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
- export_x3d(out_path='.', overwrite=False, color_mode='flat', color_map='jet', color=None, object_type=None, segment_list=None, azimuth=None, elevation=None, roll=None)¶
- Parameters
out_path (str, Path) – file or folder path where to save the network, if None show the plot.
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
- overview(out_path='.', overwrite=False, image_resolution=None, color_mode='flat', color_map='jet', color=None, background=None, object_type=None, segment_list=None, azimuth=None, elevation=None, roll=None, rgba=None, axes=0)¶
- Parameters
out_path (str, Path) – file or folder path where to save the network, if None show the plot.
overwrite (bool) – allow file overwrite
image_resolution (int) – image width
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’
background (tuple(float)) – background color
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
rgba (bool) – allow transparency in saved file
axes – vedo axis selection (Documentation)
- Returns
path to saved file
- Return type
Path
- classmethod save_3d_image(image, out_path='.', overwrite=False, image_resolution=None, binary=False, threshold=None, spacing=None, color=None, background=None, azimuth=None, elevation=None, roll=None, rgba=None)¶
Render thresholded image stack to file.
- Parameters
image (np.ndarray) – image stack
out_path (str, Path) – file or folder path where to save the network, if None show the plot.
overwrite (bool) – allow file overwrite
image_resolution (int) – image width
binary (bool) – if the image stack is already binary
threshold (float) – threshold for volume creation in percent
spacing (tuple(float)) – spacing in all three axis
color (tuple(float)) – color for rendering (0.0-1.0)
background (tuple(float)) – background color
azimuth (float) – change camera azimuth
elevation (float) – change camera elevation
roll (float) – roll camera
rgba (bool) – allow transparency in saved file
- Returns
path to saved file
- Return type
Path
- show(color_mode='flat', color_map='jet', color=None, object_type=None, segment_list=None)¶
Visualize a network interactively.
- Parameters
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)
- static show_3d_image(image, name, binary=False, spacing=None)¶
Visualize a image stack interactively. The threshold can be altered in the opened window.
- Parameters
image (np.ndarray) – image stack
name (str) – display name
binary (bool) – if the image stack is already binary
spacing (tuple(float)) – spacing in all three axis