magmap.gui.vis_3d module¶
- class magmap.gui.vis_3d.Vis3D(scene)[source]¶
Bases:
object3D visualization object for handling Mayavi/VTK tasks.
- Variables:
scene – Mayavi scene.
fn_update_coords – Callback to update coordinates; defaults to None.
surfaces – List of Mayavi surfaces for each displayed channel; defaults to None.
blobs3d – List of Mayavi glyphs, where each glyph typically contains many 3D points representing blob positions; defaults to None.
blobs3d_in – Mayavi glyphs of blobs inside the ROI; defaults to None.
matches3d – Mayavi glyphs of blob matches; defaults to None.
- plot_2d_shadows(roi, flipz=False)[source]¶
Plots 2D shadows in each axis around the 3D visualization.
- Parameters:
roi (
numpy.ndarray) – Region of interest.flipz (bool) – True to invert
roialong z-axis to match handedness of Matplotlib with z progressing upward; defaults to False.
- plot_3d_points(roi, channel, flipz=False, offset=None)[source]¶
Plots all pixels as points in 3D space.
Points falling below a given threshold will be removed, allowing the viewer to see through the presumed background to masses within the region of interest.
- Parameters:
roi (
numpy.ndarray) – Region of interest either as a 3Dz,y,xor 4Dz,y,x,carray.channel (int) – Channel to select, which can be None to indicate all channels.
flipz (bool) – True to invert the ROI along the z-axis to match the handedness of Matplotlib with z progressing upward; defaults to False.
offset (Sequence[int]) – Origin coordinates in
z,y,x; defaults to None.
- Returns:
True if points were rendered, False if no points to render.
- Return type:
- plot_3d_surface(roi, channel, segment=False, flipz=False, offset=None)[source]¶
Plots areas with greater intensity as 3D surfaces.
The scene will be cleared before display.
- Parameters:
roi (
numpy.ndarray) – Region of interest either as a 3Dz,y,xor 4Dz,y,x,carray.channel (int) – Channel to select, which can be None to indicate all channels.
segment (bool) – True to denoise and segment
roibefore displaying, which may remove artifacts that might otherwise lead to spurious surfaces. Defaults to False.flipz (default:
False) – True to invertroialong z-axis to match handedness of Matplotlib with z progressing upward; defaults to False.offset (Sequence[int]) – Origin coordinates in
z,y,x; defaults to None.
- Returns:
List of Mayavi surfaces for each displayed channel, which are also stored in
surfaces.- Return type:
- show_blobs(blobs, segs_in_mask, cmap, roi_offset, roi_size, show_shadows=False, flipz=None, clear=False)[source]¶
Show 3D blobs as points.
- Parameters:
blobs (
Blobs) – Detected blobs. Blob matches will also be displayed.segs_in_mask (
ndarray) – Boolean mask for segments within the ROI; all other segments are assumed to be from padding and border regions surrounding the ROI.cmap (
ndarray) – Colormap as a 2D Numpy array in the format[[R, G, B, alpha], ...].roi_offset (
Sequence[int]) – Region of interest offset inz,y,x.roi_size (
Sequence[int]) – Region of interest size inz,y,x. Used to show the ROI outline.show_shadows (
bool, default:False) – True if shadows of blobs should be depicted on planes behind the blobs; defaults to False.flipz (
Optional[bool], default:None) – True to invert blobs along the z-axis to match the handedness of Matplotlib with z progressing upward; defaults to False.clear (
bool, default:False) – Clear existing blobs before showing new ones.
- Returns:
scale: the current size of glyphsmask: the mask size for glyphs, the denominator for the fraction of glyphs displayed
- Return type:
Tuple of