From 357f0031225602d22c372dffec7c0245e84550e2 Mon Sep 17 00:00:00 2001 From: Mike Tyszka Date: Thu, 12 Jan 2023 14:55:59 -0800 Subject: [PATCH] v2023.1.12 add support for Flywheel DICOM download tarballs in top-level BIDS directory. Rename README.md to README for validation. Add tarballs to bidsignore --- bidskit/__main__.py | 2 +- bidskit/bidstree.py | 2 +- bidskit/io.py | 4 ++-- bidskit/json.py | 2 +- bidskit/templates/{README.MD => README} | 0 bidskit/templates/bidsignore | 3 ++- docs/Flywheel.md | 4 ++-- 7 files changed, 9 insertions(+), 8 deletions(-) rename bidskit/templates/{README.MD => README} (100%) diff --git a/bidskit/__main__.py b/bidskit/__main__.py index fd7fbac..0e7ed1e 100755 --- a/bidskit/__main__.py +++ b/bidskit/__main__.py @@ -117,7 +117,7 @@ def main(): 'Recon': args.recon } - # Read version from setup.py + # Read installed version number ver = pkg_resources.get_distribution('bidskit').version if args.version: diff --git a/bidskit/bidstree.py b/bidskit/bidstree.py index 1e4ddfd..4e41ec4 100644 --- a/bidskit/bidstree.py +++ b/bidskit/bidstree.py @@ -61,7 +61,7 @@ def __init__(self, dataset_dir, overwrite=False): print('Creating file templates required for BIDS compliance') # Copy BIDS-compliant JSON templates to BIDS directory root - self.copy_template('README.md', 'README.md') + self.copy_template('README', 'README') self.copy_template('CHANGES', 'CHANGES') self.copy_template('dataset_description.json', 'dataset_description.json') self.copy_template('participants.json', 'participants.json') diff --git a/bidskit/io.py b/bidskit/io.py index 79f073c..ebc5892 100644 --- a/bidskit/io.py +++ b/bidskit/io.py @@ -175,11 +175,11 @@ def parse_dcm2niix_fname(fname): # Filename format: ----s--e[_ph]. info['SubjName'] = vals[0] info['SerDesc'] = vals[1] - info['SerNo'] = np.int(vals[2].replace('s', '')) + info['SerNo'] = int(vals[2].replace('s', '')) # Check for phase image suffix after echo number (eg "e2_ph") bits = vals[3].split('_', 1) - info['EchoNo'] = np.int(bits[0].replace('e', '')) + info['EchoNo'] = int(bits[0].replace('e', '')) # Record any suffix after the echo number key (typically "ph" if anything) if len(bits) > 1: diff --git a/bidskit/json.py b/bidskit/json.py index da13aac..be2a438 100644 --- a/bidskit/json.py +++ b/bidskit/json.py @@ -42,7 +42,7 @@ def acqtime_mins(json_file): if 'AcquisitionTime' in info: t1 = dt.datetime.strptime(info['AcquisitionTime'], '%H:%M:%S.%f0') t0 = dt.datetime(1900, 1, 1) - t_mins = np.float((t1 - t0).total_seconds() / 60.0) + t_mins = float((t1 - t0).total_seconds() / 60.0) else: print(f'* WARNING: AcquisitionTime not found in {json_file} (deidentified?)') print(f'* WARNING: Automatic fieldmap binding will not work correctly') diff --git a/bidskit/templates/README.MD b/bidskit/templates/README similarity index 100% rename from bidskit/templates/README.MD rename to bidskit/templates/README diff --git a/bidskit/templates/bidsignore b/bidskit/templates/bidsignore index 8dfdfec..cff3db9 100644 --- a/bidskit/templates/bidsignore +++ b/bidskit/templates/bidsignore @@ -1,4 +1,5 @@ exclude/ derivatives/ work/ -incoming/ \ No newline at end of file +incoming/ +*.tar \ No newline at end of file diff --git a/docs/Flywheel.md b/docs/Flywheel.md index 77f6642..0520841 100644 --- a/docs/Flywheel.md +++ b/docs/Flywheel.md @@ -42,8 +42,8 @@ folder and build the template BIDS files and folders (Phase 1) $ bidskit --flywheel ``` 3. Edit `code/Protocol_Translator.json` manually or use the `--auto` option to autofill the translator file -4. Run bidskit again (Phase 2) to complete the curation +4. Run bidskit again (Phase 2) without the `--flywheel` option to complete the curation ``` -$ bidskit --flywheel +$ bidskit ``` 5. Delete the original Flywheel tarball \ No newline at end of file