ai_ct_scans.GUI.viewer_widget module

class ai_ct_scans.GUI.viewer_widget.SliceDirection(value)

Bases: Enum

Enum assigning identifier to slice orientation.

AXIAL = 0
CORONAL = 1
SAGITTAL = 2
class ai_ct_scans.GUI.viewer_widget.ViewerWidget(number_of_scans=0)

Bases: QWidget

Widget to handle displaying scan data.

ui

UI class containing UI elements for this widget.

Type

ViewerWidget.Ui

data

data for display.

Type

dict

blank_frames

blank frame for each scan of correct size.

Type

dict of np.ndarray

phase_correlation_shift

Phase correlation shift values in each of 3 axes.

Type

tuple of int

orientation

Orientation of scan view slicing.

Type

SliceDirection

local_region

Local region for phase correlation alignment. 2D coordinates.

Type

list of int

cpd_aligned_scan

Aligned 3D scan (using loaded CPD alignment)

Type

np.ndarray

class Ui(widget, number_of_scans=0)

Bases: object

calculate_non_rigid_alignment()

Calculate the non-rigid alignment, store the offset and trigger an update to the display.

change_orientation(index)

Update orientation setting and displays.

Parameters

index (int) – index of orientation to change to

detect_ellipses()

Method for triggering ellipse detection on each scan.

display_results(slice_index)

Method to display results using the results display.

Parameters

slice_index (int) – slice index

display_sectioned_slice(slice_index)

Method to display results of tissue sectioning.

Parameters

slice_index (int) – slice index

display_slice(slice_index)

Display axial slice of full scan.

Parameters

slice_index (int) – slice index

extract_centre_coordinates_from_string(info_string)
Extract slice coordinates as floats from string data in form “[x , y, z]”.

Removes any leading or trailing spaces inserted by PyQtTableWidgets.

Parameters

info_string (string) – list values formatted as single string.

Returns

list of centre coordinates from string.

Return type

(list)

extract_ellipse_overlay_info(scan_label, slice_index)
Extract closest match for ellipse in current axis from ellipsoid

contributing ellipses.

Parameters
  • scan_label (str) – string label for which scan to refer to. e.g. scan_1 or scan_2

  • slice_index (int) – current slice index.

Returns

dictionary describing ellipse to overlay, or None if no matches in current

orientation.

Return type

(dict)

handle_item_selection(table_index)

Detect the selected table item in the scan ellipse table and move the slice view to the relevant slice.

set_data(data, cpd_alignment=None, sectioning_model=None)

Set data for displaying. If CPD alignment is present, calculate the 3D transform for second scan.

Parameters
  • data (dictionary of np.ndarray) – dictionary with two or more full scan arrays

  • cpd_alignment (sklearn.pipeline.Pipeline) – CPD alignment pipeline object

  • sectioning_model (sectioning.TextonSectioner) – A trained tissue sectioning model

setup_orientation(orientation)

Configure class attributes specific to the currently selected orientation.

Parameters

orientation (SliceDirection) – Enum value for slice orientation

show_phase_correlation()

Perform phase correlation based around the local region defined.

staticMetaObject = <PySide2.QtCore.QMetaObject object>
toggle_ellipse_table()

If toggle button pressed, either hide or show detection table.

toggle_ellipse_table_button()

Programatically hide or show detection table toggle button.

toggle_non_rigid_2d_controls()

Hide or show the controls used for non-rigid alignment.

toggle_phase_correlation_controls()

Hide or show the controls used for phase correlation alignment.

toggle_tissue_sectioning()

Display or hide the tissue sectioning controls and display.

toggle_warp_display()

Display or hide the warp display.

update_ellipse_table(scan_1_ellipses=None, scan_2_ellipses=None)

Method for updating the detection table with ellipse data.

Parameters
  • scan_1_ellipses (list) – List of ellipse dictionaries for scan 1

  • scan_2_ellipses (list) – List of ellipse dictionaries for scan 2

update_local_region()

Update the local region that has been defined for phase correlation alignment, as (x, y) coordinates.

update_scan(slice_index)

Update 3D scan view with updated slice index or orientation.

update_scan_toggle()

Update scan display visibility depending on toggle value.