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

Propagate filename to export products

parent 0c8a04ed
No related branches found
No related tags found
No related merge requests found
......@@ -58,12 +58,12 @@ def infer_object_map_from_zstack(
pxmap, _ = pixel_classifier.infer(mip)
ti.click('infer_pixel_probability')
if exports.pixel_probabilities:
write_accessor_data_to_file(
Path(output_folder_path) / 'pixel_probabilities' / (fstem + '.tif'),
pxmap
)
ti.click('export_pixel_probability')
# if exports.pixel_probabilities:
# write_accessor_data_to_file(
# Path(output_folder_path) / 'pixel_probabilities' / (fstem + '.tif'),
# pxmap
# )
# ti.click('export_pixel_probability')
obmask = InMemoryDataAccessor(
pxmap.data > pxmap_threshold
......@@ -90,7 +90,7 @@ def infer_object_map_from_zstack(
)
ti.click('export_object_classes')
rois.run_exports(Path(output_folder_path), patches_channel, exports)
rois.run_exports(Path(output_folder_path), patches_channel, fstem, exports)
return {
'timer_results': ti.events,
......
......@@ -98,40 +98,41 @@ class RoiSet(object):
def get_object_map(self, filters: RoiFilter):
pass
def run_exports(self, where, channel, params: RoiSetExportParams):
def run_exports(self, where, channel, prefix, params: RoiSetExportParams):
if not self.count:
return
raw_ch = self.acc_raw.get_one_channel_data(channel)
for k in params.dict().keys():
subdir = where / k
pr = prefix
kp = params.dict()[k]
if k == 'meta' or kp is None:
continue
if k == '3d_patches':
if k == 'patches_3d':
files = export_patches_from_zstack(
subdir, raw_ch, self.zmask_meta, prefix=k, make_3d=True, **kp
subdir, raw_ch, self.zmask_meta, prefix=pr, make_3d=True, **kp
)
if k == 'patches_2d_for_annotation':
files = export_multichannel_patches_from_zstack(
subdir, self.acc_raw, self.zmask_meta, prefix=k, make_3d=False, ch_white=channel,
subdir, self.acc_raw, self.zmask_meta, prefix=pr, make_3d=False, ch_white=channel,
bounding_box_channel=1, bounding_box_linewidth=2, **kp,
)
if k == 'patches_2d_for_training':
files = export_multichannel_patches_from_zstack(
subdir, self.acc_raw, self.zmask_meta, ch_white=channel, prefix=k, make_3d=False, **kp
subdir, self.acc_raw, self.zmask_meta, ch_white=channel, prefix=pr, make_3d=False, **kp
)
df_patches = pd.DataFrame(files)
self.df = pd.merge(self.df, df_patches, left_index=True, right_on='df_index').drop(columns='df_index')
self.df['patch_id'] = self.df.apply(lambda _: uuid4(), axis=1)
if k == 'patch_masks':
export_patch_masks_from_zstack(
subdir, raw_ch, self.zmask_meta, prefix=k,
subdir, raw_ch, self.zmask_meta, prefix=pr,
)
if k == 'annotated_zstacks':
annotated = InMemoryDataAccessor(
draw_boxes_on_3d_image(raw_ch.data, self.zmask_meta, **kp)
)
write_accessor_data_to_file(subdir / (k + '.tif'), annotated)
write_accessor_data_to_file(subdir / (pr + '.tif'), annotated)
......
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