napari_track_edit.import_export.menus.import_dialog

Classes

ImportDialog

Dialog for importing external tracks from CSV or geff.

Module Contents

class napari_track_edit.import_export.menus.import_dialog.ImportDialog(import_type: str = 'csv')

Bases: qtpy.QtWidgets.QDialog

Dialog for importing external tracks from CSV or geff.

import_type = 'csv'
seg = None
df = None
incl_z = False
source_path: pathlib.Path | None = None
name = 'Tracks from '
button_layout
cancel_button
finish_button
prop_map_widget
scale_widget
content_widget
scroll_area
_update_field_map_and_scale(checked: bool | None = None) → None

Update field map and scale widget based on segmentation selection.

infer_dims_from_segmentation() → None

Infer whether to include z dimension based on the selected segmentation file, if present. If not present, we do allow incl_z (but the user can select ‘None’ if it is 2D + time data without segmentation.).

_update_segmentation_widget() → None

Refresh the geff segmentation widget based on the geff root group.

_resize_dialog() → None

Dynamic widget resizing depending on the visible contents

_update_finish_button() → None

Update the finish button status depending on whether a segmentation is required and whether a valid geff root or pandas dataframe is present. Duplicate region properties are not allowed.

_cancel() → None

Close the dialog without loading tracks.

_generate_axes_metadata(name_map: dict[str, str | None], scale: list[float] | None, segmentation_path: pathlib.Path) → None

Generate axes metadata when missing from geff file.

Uses the user-provided name_map and scale information to construct axes metadata that matches the segmentation dimensionality.

Parameters:
  • name_map – Mapping from standard fields (t, z, y, x) to node property names

  • scale – Scale values from scale widget [t, (z), y, x]

  • segmentation_path – Path to segmentation file to determine ndim

_ensure_area_enabled() → None

Enable the area feature when segmentation is present.

Recomputes only when area is missing from the graph schema (e.g. a GEFF imported without an area attribute); otherwise reuses existing values.

_maybe_convert_legacy_masks(geff_dir: pathlib.Path) → bool

Offer to convert masks stored in an older, memory-heavy dtype.

Geff files written by older versions of tracksdata store segmentation masks as integers (e.g. uint64) rather than bool, using ~8x more memory when read, which can run out of memory on large datasets. If such masks are detected, warn the user and offer a lossless, in-place conversion of the mask buffer (the rest of the geff is untouched).

Returns:

True to continue the import, False if the user cancelled or the conversion failed.

Return type:

bool

_finish() → None

Tries to read the csv/geff file and optional segmentation image and apply the attribute to column mapping to construct a Tracks object