spacr.drop_classification¶
What was dropped on Make Masks, decided before anything is opened.
Make Masks takes a drop of files, folders or both, and what the
user means depends on what they dropped. classify_drop() reads the
paths – names, folder layout and, for a few TIFFs, their pixels – and says
which of these it is, without a single question or widget:
imagesImage files (and possibly folders) to open as one queue, in drop order.
folderOne folder of images, opened as it is (masks in its
masks/).nestedOne folder whose images sit in subfolders: when the subfolders look like channels (
channel_like), “Organize for Measure” with one channel column per subfolder; otherwise the consolidation question.foldersSeveral folders, each holding images: Make Masks opens “Organize for Measure” with one channel column per folder.
images_with_masksImages dropped together with their masks (a masks folder, files whose name says mask, or integer label TIFFs named after a dropped image):
maskspairs them.spacr_outputA folder spaCR wrote (
merged/*.npy, asorted_channelsfolder, or amergedfolder itself):descriptionsays what it is andopen_folderis the images folder to open, if any.nothingNothing Make Masks can use.
Whatever the drop held that is none of these – a .npy, a text file, an
empty folder, a mask no image claims – is in unrecognised or
unpaired_masks, so the screen can list it instead of losing it.
Classes¶
What a drop on Make Masks is, and everything needed to act on it. |
Functions¶
|
Say what a drop on Make Masks is, without asking or opening anything. |
Module Contents¶
- class spacr.drop_classification.DropClassification[source]¶
What a drop on Make Masks is, and everything needed to act on it.
- Variables:
kind – one of
images,folder,nested,folders,images_with_masks,spacr_outputornothing.images – image files, absolute, in drop order (
imagesandimages_with_masks).folders – the folder dropped (
folder,nested), the folders (folders) or the folders dropped with loose images (images).channel_folders – the subfolders of a
nestedfolder that hold images, naturally sorted; forfolders, the dropped folders.channel_like – whether
channel_folderslook like one channel each – names such as DAPI or ch1, or the same fields in every one.masks –
{image path: mask path}forimages_with_masks.unpaired_masks – masks that no dropped image claims.
open_folder – for
spacr_output, the image folder to open, or None when there is none.description – one plain sentence saying what a
spacr_outputdrop is.unrecognised – dropped paths used for nothing, each with the reason.
- spacr.drop_classification.classify_drop(paths: Iterable) DropClassification[source]¶
Say what a drop on Make Masks is, without asking or opening anything.
- Parameters:
paths – the dropped files and folders, in drop order.
- Returns:
spaCR’s own output counts only when it is the whole drop. Files named as masks are masks; beside images, label TIFFs are too, but only when a dropped image claims them by name, since a clean synthetic image can look like labels. Masks dropped alone open the images they belong to, when those are present.