spacr.png_list¶
Resolve crop records stored in the png_list database table.
The public helper joins png_list rows to measurement-table locations so
the corresponding object can be cut from merged/*.npy. This lightweight
module avoids importing segmentation or model dependencies; spacr.io
re-exports the helper for compatibility.
Functions¶
|
Add the locations and labels required to cut |
Module Contents¶
- spacr.png_list.crop_rows_from_png_list(db_path, png_df, object_type='cell', verbose=True)[source]¶
Add the locations and labels required to cut
png_listobjects.png_listrecords where a crop was written and which object it came from (<object>_id), but not which merged array produced it. This joins the object table on plate/row/column/field to recoverpath_name, and turns'o12'into12.Rows whose object id is
'omulti'/'onone'(a crop overlapping several objects or none) cannot be cut from a single label and are dropped, with a count, rather than silently producing the wrong object.- Parameters:
db_path – path to the
measurements.dbthat containspng_df.png_df – rows read from
png_listor a compatible object table.object_type – crop mode used to select the object-id column. The default is
'cell'; supported names are the keys ofPNG_LIST_ID_COLUMNS.verbose – print the number of unusable rows when
True.
- Returns:
a copy of
png_dfwithpath_name,object_label,object_typeandobject_label_typecolumns, minus the rows that cannot be cut.object_typeis what was ASKED for and is what the crop cutter reads to choose a mask plane;object_label_typeis which object’s labels were actually available, and the two differ when a png_list written for one crop mode is read for another.- Raises:
ValueError – if
object_typeis unsupported, or if its ID column is absent while multiple other object-ID columns make fallback ambiguous.