goatpy.landmark_alignment

Classes

LandmarkAlignmentWidget

Widget for selecting corresponding landmarks in two images.

Functions

postpone_transformation(sdata, transformation, ...)

align_image_using_landmarks(→ spatialdata.SpatialData)

Align two SpatialData objects using landmarks.

launch_landmark_gui(maldi_sd, he_sd[, ...])

Launch the landmark alignment GUI.

Module Contents

goatpy.landmark_alignment.postpone_transformation(sdata: spatialdata.SpatialData, transformation: spatialdata.transformations.BaseTransformation, source_coordinate_system: str, target_coordinate_system: str)[source]
goatpy.landmark_alignment.align_image_using_landmarks(maldi_sd: spatialdata.SpatialData, he_sd: spatialdata.SpatialData, maldi_landmark_key: str = 'maldi_landmarks', he_landmark_key: str = 'he_landmarks', maldi_image_key: str = 'optical_image', he_image_key: str = 'he_image') spatialdata.SpatialData[source]

Align two SpatialData objects using landmarks.

Landmarks saved by the GUI are always stored at full (scale0) resolution, regardless of which scale level was used for display. The scale correction is applied automatically inside the GUI’s save_landmarks() method.

Parameters:
  • maldi_sd (SpatialData) – The reference SpatialData object.

  • he_sd (SpatialData) – The moving SpatialData object to be aligned to the reference (H&E).

  • maldi_landmark_key (str) – Key in maldi_sd.points for the reference landmarks.

  • he_landmark_key (str) – Key in he_sd.points for the moving landmarks.

  • maldi_image_key (str) – Key for the reference image in maldi_sd.images.

  • he_image_key (str) – Key for the H&E image in he_sd.images.

Returns:

maldi_sd – The reference SpatialData with the H&E image merged in under the ‘aligned’ coordinate system.

Return type:

SpatialData

class goatpy.landmark_alignment.LandmarkAlignmentWidget(maldi_sd: spatialdata.SpatialData, he_sd: spatialdata.SpatialData, maldi_viewer: napari.Viewer = None, he_viewer: napari.Viewer = None, combined_viewer: napari.Viewer = None, maldi_image_key: str = 'optical_image', he_image_key: str = 'he_image', split_view: bool = False, maldi_scale_level: str = 'scale0', he_scale_level: str = 'scale0')[source]

Bases: qtpy.QtWidgets.QWidget

Widget for selecting corresponding landmarks in two images.

maldi_sd[source]
he_sd[source]
maldi_image_key = 'optical_image'[source]
he_image_key = 'he_image'[source]
split_view = False[source]
maldi_scale_level = 'scale0'[source]
he_scale_level = 'scale0'[source]
maldi_scale_factor = 1.0[source]
he_scale_factor = 1.0[source]
maldi_landmarks = [][source]
he_landmarks = [][source]
active_dataset = 'maldi'[source]
init_ui()[source]
setup_layers()[source]
set_active_dataset(dataset: str)[source]
on_click_combined(layer, event)[source]
on_click_split(viewer, layer, event)[source]
update_status()[source]
undo_last()[source]
clear_all()[source]
save_landmarks()[source]
goatpy.landmark_alignment.launch_landmark_gui(maldi_sd: spatialdata.SpatialData, he_sd: spatialdata.SpatialData, maldi_image_key: str = 'optical_image', he_image_key: str = 'he_image', split_view: bool = False, maldi_scale_level: str = None, he_scale_level: str = 'scale0')[source]

Launch the landmark alignment GUI.

Parameters:
  • maldi_sd (SpatialData) – MALDI spatial data object.

  • he_sd (SpatialData) – H&E spatial data object.

  • maldi_image_key (str) – Key for MALDI image in maldi_sd.images.

  • he_image_key (str) – Key for H&E image in he_sd.images.

  • split_view (bool) – If True, open each image in its own napari window.

  • maldi_scale_level (str or None) – Which multiscale level to load for MALDI, e.g. ‘scale0’, ‘scale1’, ‘scale2’. If None, the available levels are printed and you are prompted to choose.

  • he_scale_level (str or None) – Which multiscale level to load for H&E. If None, the available levels are printed and you are prompted to choose.

Return type:

(viewer, widget) or (main_viewer, maldi_viewer, he_viewer, widget)