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

Fine-tuning export job

parent 672ec3d3
No related branches found
No related tags found
No related merge requests found
from pathlib import Path from pathlib import Path
import re
from time import localtime, strftime
import pandas as pd import pandas as pd
...@@ -10,9 +12,18 @@ if __name__ == '__main__': ...@@ -10,9 +12,18 @@ if __name__ == '__main__':
where_czi = Path( where_czi = Path(
'z:/rhodes/projects/proj0004-marine-photoactivation/data/exp0038/AutoMic/20230906-163415/Selection' 'z:/rhodes/projects/proj0004-marine-photoactivation/data/exp0038/AutoMic/20230906-163415/Selection'
) )
where_output_root = Path(
'c:/Users/rhodes/projects/proj0011-plankton-seg/exp0009'
)
yyyymmdd = strftime('%Y%m%d', localtime())
idx = 0
while Path(where_output_root / f'batch-output-{yyyymmdd}-{idx:04d}').exists():
idx += 1
where_output = Path( where_output = Path(
'c:/Users/rhodes/projects/proj0011-plankton-seg/exp0009/batch_output' where_output_root / f'batch-output-{yyyymmdd}-{idx:04d}'
) )
csv_args = {'mode': 'w', 'header': True} # when creating file csv_args = {'mode': 'w', 'header': True} # when creating file
px_ilp = Path.home() / 'model-server' / 'ilastik' / 'AF405-bodies_boundaries.ilp' px_ilp = Path.home() / 'model-server' / 'ilastik' / 'AF405-bodies_boundaries.ilp'
px_model = IlastikPixelClassifierModel( px_model = IlastikPixelClassifierModel(
...@@ -20,9 +31,15 @@ if __name__ == '__main__': ...@@ -20,9 +31,15 @@ if __name__ == '__main__':
) )
for ff in where_czi.iterdir(): for ff in where_czi.iterdir():
pattern = 'Selection--W([\d]+)--P([\d]+)-T([\d]+)'
ma = re.match(pattern, ff.stem)
print(ff) print(ff)
if not ff.suffix.upper() == '.CZI': if not ff.suffix.upper() == '.CZI':
continue continue
if int(ma.groups()[1]) > 10: # skip second half of set
continue
result = export_patches_from_multichannel_zstack( result = export_patches_from_multichannel_zstack(
input_zstack_path=where_czi/ff, input_zstack_path=where_czi/ff,
...@@ -33,8 +50,8 @@ if __name__ == '__main__': ...@@ -33,8 +50,8 @@ if __name__ == '__main__':
patches_channel=4, patches_channel=4,
where_output=where_output, where_output=where_output,
mask_type='boxes', mask_type='boxes',
zmask_filters={'area': (1e3, 1e5)}, zmask_filters={'area': (1e3, 1e8)},
zmask_expand_box_by=(128, 3), zmask_expand_box_by=(128, 0),
) )
# parse and record results # parse and record results
...@@ -49,4 +66,4 @@ if __name__ == '__main__': ...@@ -49,4 +66,4 @@ if __name__ == '__main__':
write_accessor_data_to_file( write_accessor_data_to_file(
where_output / k / (ff.stem + '.tif'), where_output / k / (ff.stem + '.tif'),
InMemoryDataAccessor(result['interm'][k]) InMemoryDataAccessor(result['interm'][k])
) )
\ No newline at end of file
...@@ -66,6 +66,7 @@ def export_patches_from_multichannel_zstack( ...@@ -66,6 +66,7 @@ def export_patches_from_multichannel_zstack(
zmask_meta, zmask_meta,
prefix=fstem, prefix=fstem,
draw_bounding_box=True, draw_bounding_box=True,
rescale_clip=0.0,
) )
ti.click('export_patches') 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