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

Prototyping adaptive sobel-based projection within 3d patch export

parent 0ba95284
No related branches found
No related tags found
No related merge requests found
......@@ -47,7 +47,7 @@ if __name__ == '__main__':
'where_output': where_output.__str__(),
'mask_type': 'boxes',
'zmask_filters': {'area': (1e3, 1e8)},
'zmask_expand_box_by': (128, 0),
'zmask_expand_box_by': (128, 3),
}
result = export_patches_from_multichannel_zstack(**export_kwargs)
......@@ -65,4 +65,5 @@ if __name__ == '__main__':
write_accessor_data_to_file(
where_output / k / (ff.stem + '.tif'),
InMemoryDataAccessor(result['interm'][k])
)
\ No newline at end of file
)
break
\ No newline at end of file
......@@ -60,6 +60,15 @@ def export_patches_from_multichannel_zstack(
ti.click('generate_zmasks')
# export patches
import numpy as np
from skimage.filters import gaussian, sobel
def zs_projector(zs):
sigma = 1.5
blur = gaussian(sobel(zs), sigma)
argmax = np.argmax(blur, axis=3, keepdims=True)
return np.take_along_axis(zs, argmax, axis=3)
files = export_patches_from_zstack(
Path(where_output) / '2d_patches',
stack.get_one_channel_data(patches_channel),
......@@ -67,6 +76,7 @@ def export_patches_from_multichannel_zstack(
prefix=fstem,
draw_bounding_box=True,
rescale_clip=0.0,
projector=zs_projector,
)
ti.click('export_patches')
......
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