napari_track_edit.import_export.menus.export_dialog
Attributes
Classes
Handles exporting tracks to CSV, geff or a SQL database. |
Module Contents
- napari_track_edit.import_export.menus.export_dialog.SQL_EXPORT_TYPE = 'SQL database'
- class napari_track_edit.import_export.menus.export_dialog.ExportTypeDialog(parent=None, label: str = '', has_segmentation: bool = False, offer_sql: bool = True, already_on_disk: pathlib.Path | None = None)
Bases:
qtpy.QtWidgets.QDialog- export_type_combo
- _geff_seg_label
- _sql_label
- keep_in_memory_checkbox
- _rebind_label
- seg_checkbox
- seg_format_label
- seg_format_combo
- relabel_checkbox
- _has_segmentation = False
- _on_export_type_changed(export_type: str) → None
- _on_seg_toggled(checked: bool)
- property export_type: str
- property rebind: bool
Whether to switch the session over to the database being written.
The checkbox asks the opposite question - whether to stay put - so that the default always leaves the user working in a database: in-memory tracks move to the new one (unticked), tracks already in a database stay in the one they are in (ticked).
- property save_segmentation: bool
- property seg_file_format: str
- property seg_label_attr: str | None
- class napari_track_edit.import_export.menus.export_dialog.ExportDialog
Handles exporting tracks to CSV, geff or a SQL database.
- static show_export_dialog(parent, tracks: funtracks.data_model.Tracks, name: str, colormap: napari_track_edit.data_views.colormap.TrackColormap, nodes_to_keep: set[int] | None = None)
Export tracks to CSV, geff or a SQL database, with the option to export a subset of nodes only.
- Parameters:
tracks (Tracks) – to be exported Tracks object.
name (str) – filename for exporting
nodes_to_keep (set[int], optional) – list of nodes to be exported. Ancestor nodes will automatically be included to make sure the graph has no missing parent nodes. Disables the SQL format, which writes the whole graph.
- Returns:
- The tracks to carry on with when the user exported a
database and asked to keep editing in it, otherwise True on a successful export and False if nothing was written. Truthy either way, so callers that only check success keep working.
- Return type:
Tracks | bool
- static _export_to_sql(parent, tracks: funtracks.data_model.Tracks, name: str, rebind: bool)
Write the tracks to a SQLite database, optionally switching to it.
The destination is cleared before writing rather than being handed to tracksdata as an overwrite: exporting a database that is itself SQL-backed takes a fast SQL-level copy that requires an empty destination, and that is exactly the case where the graph may be too big to copy through Python.
- Returns:
- The rebound tracks if the user asked to keep editing in
the database, True on a plain export, False if nothing was written.
- Return type:
Tracks | bool