Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Karl5766 committed Dec 13, 2024
1 parent 867ab06 commit bb4ad7e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
12 changes: 7 additions & 5 deletions src/cvpl_tools/examples/mousebrain_processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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'
Expand Down Expand Up @@ -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}')
Expand Down
5 changes: 1 addition & 4 deletions src/cvpl_tools/nnunet/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit bb4ad7e

Please sign in to comment.