diff --git a/src/cvpl_tools/examples/mousebrain_processing.py b/src/cvpl_tools/examples/mousebrain_processing.py index 0f7b81a..bdf5fb7 100644 --- a/src/cvpl_tools/examples/mousebrain_processing.py +++ b/src/cvpl_tools/examples/mousebrain_processing.py @@ -49,7 +49,7 @@ class Subject: } ALL_SUBJECTS = list(THRESHOLD_TABLE.keys()) -def get_subject(SUBJECT_ID): +def get_subject(SUBJECT_ID, SUBJECTS_DIR, NNUNET_CACHE_DIR): subject = Subject() subject.SUBJECT_ID = SUBJECT_ID @@ -78,9 +78,8 @@ def get_subject(SUBJECT_ID): subject.OME_ZARR_PATH = OME_ZARR_PATH subject.BA_CHANNEL = BA_CHANNEL - FOLDER = 'C:/ProgrammingTools/ComputerVision/RobartsResearch/data/lightsheet/tmp/mousebrain_processing' - subject.SUBJECT_FOLDER = f'{FOLDER}/subjects/subject_{SUBJECT_ID}' # **CHANGE THIS** - subject.NNUNET_CACHE_DIR = f'{FOLDER}/nnunet_250epoch_Run20241126' # **CHANGE THIS** + subject.SUBJECT_FOLDER = f'{SUBJECTS_DIR}/subject_{SUBJECT_ID}' + subject.NNUNET_CACHE_DIR = NNUNET_CACHE_DIR subject.FIRST_DOWNSAMPLE_PATH = f'{subject.SUBJECT_FOLDER}/first_downsample.ome.zarr' subject.SECOND_DOWNSAMPLE_PATH = f'{subject.SUBJECT_FOLDER}/second_downsample.ome.zarr' @@ -197,7 +196,10 @@ async def fn(dask_worker): if ID in ('M4A2Te3Blaze', 'o22', 'o23'): continue print(f'Starting prediction on subject {ID}') - subject = get_subject(ID) + FOLDER = 'C:/ProgrammingTools/ComputerVision/RobartsResearch/data/lightsheet/tmp/mousebrain_processing' + SUBJECTS_DIR = f'{FOLDER}/subjects' + NNUNET_CACHE_DIR = f'{FOLDER}/nnunet_250epoch_Run20241126' + subject = get_subject(ID, SUBJECTS_DIR, NNUNET_CACHE_DIR) main(subject=subject, run_nnunet=True, run_coiled_process=True) print(f'Finished predicting on subject {ID}') diff --git a/src/cvpl_tools/nnunet/api.py b/src/cvpl_tools/nnunet/api.py index c54e57d..ec0e6a3 100644 --- a/src/cvpl_tools/nnunet/api.py +++ b/src/cvpl_tools/nnunet/api.py @@ -207,11 +207,8 @@ async def alg(im, context_args): ) midtime = time.time() print(f'forward elapsed: {midtime - stime}') - lc = lc.reduce(force_numpy=True) - ncell_list = await cc.reduce(force_numpy=True) - print(f'ending elapsed: {time.time() - midtime}') - cnt = ncell_list.sum().item() + lc = lc.reduce(force_numpy=True) with cache_dir_fs.open('final_lc.npy', mode='wb') as fd: np.save(fd, lc)