Skip to content
Snippets Groups Projects
Commit 07c9e0e3 authored by Christopher Randolph Rhodes's avatar Christopher Randolph Rhodes
Browse files

Added pixel scale to CSV and Ecotaxa export

parent 0c4774aa
No related branches found
No related tags found
No related merge requests found
......@@ -24,7 +24,7 @@ def draw_boxes_on_2d_image(yx_img, boxes, **kwargs):
draw.rectangle([(x0, y0), (x1, y1)], outline='white', width=linewidth)
if kwargs.get('add_label') is True:
draw.text((xm, y0), f'Z{zi:04d}-L{la:04d}', fill='white', anchor='mb')
draw.text((xm, y0), f'{la:04d}', fill='white', anchor='mb')
return pilimg
......
......@@ -34,7 +34,8 @@ if __name__ == '__main__':
'export_patch_masks': True,
'zmask_clip': 0.01,
'rgb_overlay_channels': (1, None, None),
'rgb_overlay_weights': (0.2, 1.0, 1.0)
'rgb_overlay_weights': (0.2, 1.0, 1.0),
'draw_label_on_zstack': True,
}
input_files = get_matching_files(where_czi, 'czi', coord_filter={})
......
......@@ -26,6 +26,7 @@ def write_ecotaxa_tsv(patches_csv_path: str, where: str, sample_id: str, scope_i
df_patches.loc[:, ('acq_id', '[t]')] = df_patches.loc[:, ('input_file', '[t]')]
df_patches.loc[:, ('object_id', '[t]')] = df_patches.loc[:, ('patch_id', '[t]')]
df_patches.loc[:, ('process_id', '[t]')] = df_patches.loc[:, ('patch_id', '[t]')]
df_patches.loc[:, ('acq_pixel_scale_in_micrometers', '[f]')] = df_patches.loc[:, ('pixel_scale_in_micrometers', '[f]')]
cols_to_transfer = [
'img_file_name',
......
......@@ -67,6 +67,9 @@ def get_zmask_meta(
)
ti.click('generate_zmasks')
# record pixel scale
df['pixel_scale_in_micrometers'] = float(stack.pixel_scale_in_micrometers.get('X'))
return ti, stack, fstem, obmask, pxmap, zmask, zmask_meta, df, interm
......@@ -92,6 +95,7 @@ def export_patches_from_multichannel_zstack(
draw_mask_on_2d_patch=False,
export_3d_patches=True,
export_annotated_zstack=True,
draw_label_on_zstack=False,
export_patch_masks=True,
rgb_overlay_channels=(None, None, None),
rgb_overlay_weights=(1.0, 1.0, 1.0),
......@@ -165,7 +169,6 @@ def export_patches_from_multichannel_zstack(
make_3d=False,
focus_metric='max_sobel',
)
df_patches = pd.DataFrame(files)
ti.click('export_2d_patches')
if export_patch_masks:
......@@ -180,7 +183,8 @@ def export_patches_from_multichannel_zstack(
annotated = InMemoryDataAccessor(
draw_boxes_on_3d_image(
stack.get_one_channel_data(patches_channel).data,
zmask_meta
zmask_meta,
add_label=draw_label_on_zstack,
)
)
write_accessor_data_to_file(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment