napari_track_edit.example_data
Attributes
Classes
Example tracks shown in the welcome widget, with their raw data. |
Functions
|
The platformdirs "user data dir", where all example data is cached. Created if |
|
Return the path to a dataset's zarr, downloading the dataset first if it |
|
The membrane intensity layer of a zenodo dataset zarr. |
|
The 01 training intensity layer of a CTC dataset zarr. |
|
Loads the Mouse Embryo Membrane raw data and segmentation data from |
|
Loads the Fluo-N2DL-HeLa 01 training raw data and silver truth from |
|
Loads the Fluo-N2DL-HeLa 01 training raw data and silver truth from |
|
Read a zenodo dataset (assumes pre-downloaded) |
|
Read a CTC dataset from a zarr (assumes pre-downloaded and converted) |
|
A fresh scratch directory next to the output, deleted afterwards. Downloads |
|
Download a sample dataset from zenodo doi and unzip it, then delete the zip. Then convert the tiffs to |
|
Download a dataset from the Cell Tracking Challenge |
|
Convert 4D tiff file to zarr array. Deletes the tiff after conversion. |
|
Convert a directory of tiff files to a zarr array. Deletes tiffs after conversion. |
|
Loads only the cropped raw data of Fluo-N2DL-HeLa (see Fluo_N2DL_HeLa_crop), |
|
Loads only the raw data of Mouse_Embryo_Membrane, downloading the dataset |
|
Direct-download URL for a Google Drive file (skips the preview page). |
|
Return the local path to the example tracks geff with the given name, |
|
Whether the raw data belonging to a sample is already on disk, so that |
|
Download a zip holding a store named like the output, and unpack it there. |
Module Contents
- napari_track_edit.example_data.logger
- napari_track_edit.example_data.ZENODO_RAW_URL = 'https://zenodo.org/records/13903500/files/imaging.zip'
- napari_track_edit.example_data.ZENODO_LABELS_URL = 'https://zenodo.org/records/13903500/files/segmentation.zip'
- napari_track_edit.example_data.CTC_URL_TEMPLATE = 'http://data.celltrackingchallenge.net/training-datasets/{ds_name}.zip'
- napari_track_edit.example_data.HELA_CROP
- napari_track_edit.example_data.ZENODO_ARRAYS = ('01_membrane', '01_labels')
- napari_track_edit.example_data.CTC_ARRAYS = ('01', '01_ST')
- napari_track_edit.example_data.ReportHook
- napari_track_edit.example_data.user_data_dir() pathlib.Path
The platformdirs “user data dir”, where all example data is cached. Created if it does not exist yet.
- napari_track_edit.example_data._ensure_dataset(ds_name: str, data_dir: pathlib.Path, download: collections.abc.Callable[[], None], arrays: tuple[str, ...]) pathlib.Path
Return the path to a dataset’s zarr, downloading the dataset first if it is not there yet. A zarr missing any of the expected arrays (left behind by an interrupted download in older versions) is deleted and downloaded again.
- Parameters:
ds_name (str) – Dataset name, the zarr is named after it
data_dir (Path) – The directory the dataset is cached in
download (Callable[[], None]) – Fetches and converts the dataset
arrays (tuple[str, ...]) – Names of the arrays the zarr must contain
- Returns:
Path to the zarr holding the dataset
- Return type:
Path
- napari_track_edit.example_data._zenodo_raw_layer(ds_zarr: pathlib.Path) napari.types.LayerData
The membrane intensity layer of a zenodo dataset zarr.
- napari_track_edit.example_data._ctc_raw_layer(ds_zarr: pathlib.Path, crop_region: bool) napari.types.LayerData
The 01 training intensity layer of a CTC dataset zarr.
- napari_track_edit.example_data.Mouse_Embryo_Membrane() list[napari.types.LayerData]
Loads the Mouse Embryo Membrane raw data and segmentation data from the appdir “user data dir”. Will download it from the Zenodo DOI if not present.
- Returns:
- An image layer of raw data and a segmentation labels
layer
- Return type:
list[LayerData]
- napari_track_edit.example_data.Fluo_N2DL_HeLa() list[napari.types.LayerData]
Loads the Fluo-N2DL-HeLa 01 training raw data and silver truth from the appdir “user data dir”. Will download it from the CTC and convert it to zarr if it is not present already.
- Returns:
- An image layer of 01 training raw data and a labels
layer of 01 training silver truth labels
- Return type:
list[LayerData]
- napari_track_edit.example_data.Fluo_N2DL_HeLa_crop() list[napari.types.LayerData]
Loads the Fluo-N2DL-HeLa 01 training raw data and silver truth from the appdir “user data dir”. Will download it from the CTC and convert it to zarr if it is not present already.
- Returns:
- An image layer of 01 training raw data and a labels
layer of 01 training silver truth labels
- Return type:
list[LayerData]
- napari_track_edit.example_data.read_zenodo_dataset(ds_name: str, raw_name: str, label_name: str, data_dir: pathlib.Path) list[napari.types.LayerData]
Read a zenodo dataset (assumes pre-downloaded) and returns a list of layer data for making napari layers
- Parameters:
ds_name (str) – name to give to the dataset
raw_name (str) – name of the file that points to the intensity data
label_name (str) – name of the file that points to the segmentation data
data_dir (Path) – Path to the directory containing the images
- Returns:
- An image layer of raw data and a segmentation labels
layer
- Return type:
list[LayerData]
- napari_track_edit.example_data.read_ctc_dataset(ds_name: str, data_dir: pathlib.Path, crop_region=False) list[napari.types.LayerData]
Read a CTC dataset from a zarr (assumes pre-downloaded and converted) and returns a list of layer data for making napari layers
- Parameters:
ds_name (str) – Dataset name
data_dir (Path) – Path to the directory containing the zarr
- Returns:
- An image layer of 01 training raw data and a labels
layer of 01 training silver truth labels
- Return type:
list[LayerData]
- napari_track_edit.example_data._download_dir(output: pathlib.Path) collections.abc.Iterator[pathlib.Path]
A fresh scratch directory next to the output, deleted afterwards. Downloads are unpacked and converted there and only moved to the output once complete, so an interrupted download is not mistaken for existing data.
- napari_track_edit.example_data.download_zenodo_dataset(ds_name: str, raw_name: str, label_name: str, data_dir: pathlib.Path, reporthook: ReportHook | None = None) None
Download a sample dataset from zenodo doi and unzip it, then delete the zip. Then convert the tiffs to zarrs for the first training set consisting of 3D membrane intensity images and segmentation.
- Parameters:
ds_name (str) – Name to give to the dataset
raw_name (str) – Name of the file that contains the intensity data
label_name (str) – Name of the file that contains the label data
data_dir (Path) – The directory in which to store the data.
reporthook (ReportHook | None) – Called with the download progress.
- napari_track_edit.example_data.download_ctc_dataset(ds_name: str, data_dir: pathlib.Path, reporthook: ReportHook | None = None) None
Download a dataset from the Cell Tracking Challenge and unzip it, then delete the zip. Then convert the tiffs to zarrs for the first training set images and silver truth.
- Parameters:
ds_name (str) – Dataset name, according to the CTC
data_dir (Path) – The directory in which to store the data.
reporthook (ReportHook | None) – Called with the download progress.
- napari_track_edit.example_data.convert_4d_arr_to_zarr(tiff_file: pathlib.Path, zarr_path: pathlib.Path, zarr_group: str, relabel: bool = False) None
Convert 4D tiff file to zarr array. Deletes the tiff after conversion.
- Parameters:
tiff_file – Path to the 4D tiff file
zarr_path – Path to the zarr store to write to
zarr_group – Name of the array within the zarr store
relabel – If True, relabel segmentations to be unique across time
- napari_track_edit.example_data.convert_to_zarr(tiff_path: pathlib.Path, zarr_path: pathlib.Path, zarr_group: str, relabel: bool = False) None
Convert a directory of tiff files to a zarr array. Deletes tiffs after conversion.
- Parameters:
tiff_path – Path to directory containing tiff files (one per time point)
zarr_path – Path to the zarr store to write to
zarr_group – Name of the array within the zarr store
relabel – If True, relabel segmentations to be unique across time
- napari_track_edit.example_data.Fluo_N2DL_HeLa_crop_raw(reporthook: ReportHook | None = None) napari.types.LayerData
Loads only the cropped raw data of Fluo-N2DL-HeLa (see Fluo_N2DL_HeLa_crop), downloading the dataset first if it is not present.
- Parameters:
reporthook (ReportHook | None) – Called with the download progress.
- Returns:
An image layer of the cropped 01 training raw data
- Return type:
LayerData
- napari_track_edit.example_data.Mouse_Embryo_Membrane_raw(reporthook: ReportHook | None = None) napari.types.LayerData
Loads only the raw data of Mouse_Embryo_Membrane, downloading the dataset first if it is not present.
- Parameters:
reporthook (ReportHook | None) – Called with the download progress.
- Returns:
An image layer of the membrane raw data
- Return type:
LayerData
- class napari_track_edit.example_data.SampleTracks
Bases:
NamedTupleExample tracks shown in the welcome widget, with their raw data.
- url: str
- store_name: str
- raw_name: str
- raw_zarr: str
- raw_size: str
- load_raw: collections.abc.Callable[..., napari.types.LayerData]
- napari_track_edit.example_data._drive_download_url(file_id: str) str
Direct-download URL for a Google Drive file (skips the preview page).
- napari_track_edit.example_data.SAMPLE_TRACKS: dict[str, SampleTracks]
- napari_track_edit.example_data.sample_tracks_path(name: str, reporthook: ReportHook | None = None) pathlib.Path
Return the local path to the example tracks geff with the given name, downloading it from Google Drive into the appdir “user data dir” first if it is not present yet.
- Parameters:
name (str) – A key of SAMPLE_TRACKS
reporthook (ReportHook | None) – Called with the download progress.
- Returns:
Path to the geff store
- Return type:
Path
- napari_track_edit.example_data.raw_data_is_downloaded(name: str) bool
Whether the raw data belonging to a sample is already on disk, so that clicking the sample does not trigger a large download unannounced.
- Parameters:
name (str) – A key of SAMPLE_TRACKS
- Returns:
True if the zarr holding the raw data exists
- Return type:
bool
- napari_track_edit.example_data.download_zipped_store(url: str, output: pathlib.Path, reporthook: ReportHook | None = None) None
Download a zip holding a store named like the output, and unpack it there.
The zip is downloaded and unpacked next to the output, and only moved into place once complete, so an interrupted download is not mistaken for existing data.
- Parameters:
url (str) – Download url of the zip
output (Path) – Path to put the store at. The zip must contain a directory with the same name.
reporthook (ReportHook | None) – Called with the download progress.