Skip to content

Commit

Permalink
add handling for missing JSON/NIFTI pairs
Browse files Browse the repository at this point in the history
any NIFTIs missing JSON or JSON missing NIFTI will be skipped at the "inject-metadata" step
  • Loading branch information
afamiliar committed May 7, 2024
1 parent 2039988 commit 1a34ece
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ cbtn
*.csv
*.db

terraform.tfvars
terraform.tfvars
debug.py
9 changes: 6 additions & 3 deletions src/image_deid_etl/image_deid_etl/custom_flywheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,12 @@ def inject_sidecar_metadata(fw_client: flywheel.Client, flywheel_group: str, dat
nii_cntr=[]
base = os.path.basename(file) # get JSON file name w/o file ending
nii_fn = os.path.splitext(base)[0] + '.nii.gz'
logger.debug('Adding JSON metadata to '+fw_path_to_acq+'/'+nii_fn)
nii_cntr = acq.get_file(nii_fn)
nii_cntr.update_info(metadata)
logger.info('Adding JSON metadata to '+fw_path_to_acq+'/'+nii_fn)
try:
nii_cntr = acq.get_file(nii_fn)
nii_cntr.update_info(metadata)
except:
continue
# add in 'CT' modality classifications b/c there's an issue with Flywheel not doing it
try:
if metadata['Modality']=='CT':
Expand Down

0 comments on commit 1a34ece

Please sign in to comment.