Traits

class ipyniivue.ColorMap(**kwargs: Any)[source]

Bases: HasTraits

Represents a ColorMap.

Properties

Rlist of float

The red channel values.

Glist of float

The green channel values.

Blist of float

The blue channel values.

Alist of float or None, optional

The alpha (transparency) channel values. Default is None.

Ilist of float or None, optional

The intensity indices corresponding to the color values. Default is None.

minfloat or None, optional

The minimum intensity value for the colormap. Default is None.

maxfloat or None, optional

The maximum intensity value for the colormap. Default is None.

labelslist of str or None, optional

Labels associated with each color entry in the colormap. Default is None.

class ipyniivue.LUT(**kwargs: Any)[source]

Bases: HasTraits

Represents a Lookup Table (LUT / Colormap Label).

Properties

lutlist of int

A flat list representing the RGBA values of the lookup table.

minfloat or None, optional

The minimum intensity value corresponding to the first entry in the LUT. Default is None.

maxfloat or None, optional

The maximum intensity value corresponding to the last entry in the LUT. Default is None.

labelslist of str or None, optional

Labels associated with each color entry in the LUT. Default is None.

class ipyniivue.Graph(**kwargs: Any)[source]

Bases: HasTraits

Represents a Graph in NiiVue.

Properties

ltwhlist of float, optional

List of four floats representing left, top, width, height. Default is [0, 0, 640, 480].

opacityfloat, optional

Opacity of the graph, between 0.0 (not visible) and 1.0 (visible). Default is 0.0.

volslist of int, optional

List of volume indices to be plotted. Default is [0].

auto_size_multiplanarbool, optional

Automatically size the graph in multiplanar views. Default is False.

normalize_valuesbool, optional

Normalize the values when plotting. Default is False.

is_range_cal_min_maxbool, optional

Use the cal_min and cal_max of volumes for value range. Default is False.

plot_ltwhlist of float, optional

List of four floats specifying the plot area (left, top, width, height).

back_colorlist of float, optional

RGBA color for the background of the graph.

line_colorlist of float, optional

RGBA color for the lines in the graph.

text_colorlist of float, optional

RGBA color for the text in the graph.

line_thicknessfloat, optional

Thickness of the lines in the graph.

grid_line_thicknessfloat, optional

Thickness of the grid lines.

line_alphafloat, optional

Alpha (transparency) value for the lines.

lineslist of list of float, optional

Data lines to be plotted.

selected_columnint, optional

Index of the selected column.

line_rgblist of list of float, optional

List of RGB colors for the lines, each inner list must have exactly 3 floats.

class ipyniivue.NIFTI1Hdr(**kwargs: Any)[source]

Bases: HasTraits

Represents a read-only NIFTI1 header.

Note: Logic and formatting was ported from NIFTI-Reader-JS.

Properties

littleEndianbool

True if the data is in little endian byte order.

dim_infoint

MRI slice ordering.

dimslist of int

Image dimensions.

intent_p1float

1st intent parameter.

intent_p2float

2nd intent parameter.

intent_p3float

3rd intent parameter.

intent_codeint

NIFTI intent code.

datatypeCodeint

NIFTI data type code.

numBitsPerVoxelint

Number of bits per voxel.

slice_startint

First slice index.

slice_endint

Last slice index.

slice_codeint

Slice timing order.

pixDimslist of float

Voxel dimensions.

vox_offsetfloat

Image data offset in bytes.

scl_slopefloat

Data scaling slope.

scl_interfloat

Data scaling intercept.

xyzt_unitsint

Units of measurement.

cal_maxfloat

Maximum display intensity value.

cal_minfloat

Minimum display intensity value.

slice_durationfloat

Time between individual slices.

toffsetfloat

Time axis shift.

descriptionstr

Description of the data.

aux_filestr

Auxiliary filename.

intent_namestr

Name or meaning of the data.

qform_codeint

Code specifying the use of quaternion transformation.

sform_codeint

Code specifying the use of affine transformation.

quatern_bfloat

Quaternion b parameter.

quatern_cfloat

Quaternion c parameter.

quatern_dfloat

Quaternion d parameter.

qoffset_xfloat

Quaternion x translation parameter.

qoffset_yfloat

Quaternion y translation parameter.

qoffset_zfloat

Quaternion z translation parameter.

affinelist of list of float

Affine transformation matrix.

magicstr

Magic code indicating file type.

extensionFlaglist of int

Extensions flag.

to_formatted_string()[source]

Return a formatted string of header fields.

class ipyniivue.Scene(**kwargs: Any)[source]

Bases: HasTraits

Represents the scene configuration for NiiVue.

Properties

render_azimuthfloat

The azimuth angle in degrees around the object.

render_elevationfloat

The elevation angle in degrees.

vol_scale_multiplierfloat

Scale multiplier for volume rendering.

crosshair_poslist of float

The crosshair position as a list of 3 floats.

clip_planeslist of list of float

A list of clipping planes, where each plane is defined by four floats [x, y, z, w] representing the plane equation.

clip_plane_depth_azi_elevslist of list of float

A list of lists of [depth, azimuth, elevation].

pan2d_xyzmmlist of float

The 2D pan in 3D mm as a list of 4 floats.

gammafloat

The gamma value for rendering.

scene_data

Return the scene data as a dict with properties in snake_case.

class ipyniivue.VolumeObject3DData(**kwargs: Any)[source]

Bases: HasTraits

Represents read-only data from Niivue’s NiivueObject3D.

Properties

idint

Unique identifier for the object.

extents_minlist of float

Minimum extents of the object in each dimension.

extents_maxlist of float

Maximum extents of the object in each dimension.

scalelist of float

Scale factors for each dimension.

furthest_vertex_from_originfloat or None

Distance to the furthest vertex from the origin.

field_of_view_de_oblique_mmlist of float or None

Field of view in de-oblique millimeters.

class ipyniivue.UIData(**kwargs: Any)[source]

Bases: HasTraits

Represents a read-only UIData object from Niivue.

Properties

mousedownbool

True if the mouse button is currently pressed.

touchdownbool

True if a touch event is currently active.

mouse_button_left_downbool

True if the left mouse button is pressed.

mouse_button_center_downbool

True if the center mouse button is pressed.

mouse_button_right_downbool

True if the right mouse button is pressed.

mouse_depth_pickerbool

True if the mouse is currently used for depth picking.

clicked_tileint

The index of the tile (slice view) that was clicked.

pan2d_xyzmm_at_mouse_downlist of float

The [x, y, z, mm] pan coordinates at the moment the mouse was pressed.

prev_xfloat

The previous X coordinate of the mouse/touch.

prev_yfloat

The previous Y coordinate of the mouse/touch.

curr_xfloat

The current X coordinate of the mouse/touch.

curr_yfloat

The current Y coordinate of the mouse/touch.

current_touch_timefloat

Timestamp of the current touch event.

last_touch_timefloat

Timestamp of the last touch event.

double_touchbool

True if a double-touch/click gesture is detected.

is_draggingbool

True if a drag operation is currently in progress.

drag_startlist of float

[x, y] coordinates where the drag started.

drag_endlist of float

[x, y] coordinates where the drag ended.

drag_clip_plane_start_depth_azi_elevlist of float

[depth, azimuth, elevation] of the clip plane at drag start.

last_two_touch_distancefloat

Distance between two fingers during the last multi-touch event.

multi_touch_gesturebool

True if a multi-touch gesture is occurring.

dprfloat

Device Pixel Ratio. Default is 1.0.

max_2dfloat or None

Maximum 2D dimension limit.

max_3dfloat or None

Maximum 3D dimension limit.

window_xfloat

X coordinate relative to the window.

window_yfloat

Y coordinate relative to the window.

active_drag_modeDragMode or None

The current drag mode.

active_drag_buttonint or None

The mouse button index active during the drag.

angle_first_linelist of float

Coordinates defining the first line of an angle measurement.

angle_statestr

Current state of angle measurement.

active_clip_plane_indexint

Index of the currently active clipping plane.