scallops.io.to_label_crops
- scallops.io.to_label_crops(intensity_image, label_image, df, output_dir, crop_size=(224, 224), output_format='tiff', centroid_cols=None, label_col=None, gaussian_sigma=None)
Export individual label crops as tiff or npy files.
- Parameters:
intensity_image (Array | Array) – Image data
label_image (Array | Array) – Label data. If supplied, image is masked by corresponding segmentation mask
df (DataFrame) – DataFrame containing centroid_cols and label_col. Typically output from find-objects.
crop_size (tuple[int, int]) – Size of label crop
output_dir (str) – Crop output directory
output_format (Literal['tiff', 'npy']) – Crop output format
centroid_cols (Sequence[str] | None) – Columns in df containing y and x centroids.
label_col (str | None) – Column in df containing label id. Set to None if label is found in data frame index.
gaussian_sigma (float | None) – If not None, apply gaussian-smoothed mask to isolate target mask
- Returns:
Input data frame with objects at well edges removed. Adds columns crop_url, the URL to
- Return type:
DataFrame
output label crops, and crop-bbox-0, crop-bbox-2, crop-bbox-1, crop-bbox-3 containing the coordinates of the crop.