Skip to content

Commit 5f7f3db

Browse files
committed
v2023.1.26 Fix Flywheel folder handling for Web vs CLI downloads
1 parent 357f003 commit 5f7f3db

File tree

5 files changed

+25
-7
lines changed

5 files changed

+25
-7
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# BIDSKIT Changelog
22

3+
## Version 2023.1.26
4+
- Fixed folder name handling for Web vs CLI Flywheel DICOM downloads
5+
6+
## Version 2023.1.12
7+
- Add support for Flywheel DICOM download curation
8+
39
## Version 2022.2.1
410
- Added support for complex-valued, bias corrected and multiecho image types
511
- Added command line control for rec-, echo- and part- keys in BIDS filenames

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# BIDSKIT
22

3-
### Version 2023.1.12
3+
### Version 2023.1.26
44
Python utilities for converting from DICOM to BIDS neuroimaging formats.
55

66
The *bidskit* console command takes a directory tree containing imaging series from one or more subjects (eg T1w MPRAGE, BOLD EPI, Fieldmaps), converts the imaging data to Nifti-1 format with JSON metadata files (sidecars) and populates a directory tree according to the latest BIDS specification.

bidskit/flywheel.py

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def unpack(dataset_dir):
3636
src_dir = op.join(dataset_dir, 'sourcedata')
3737
os.makedirs(src_dir, exist_ok=True)
3838

39-
# Look for one or more flywheel tarballs
39+
# Look for one or more flywheel tarballs in the BIDS dataset root folder
4040
fw_tarball_list = sorted(glob(op.join(dataset_dir, 'flywheel_*.tar')))
4141

4242
if len(fw_tarball_list) < 1:
@@ -50,12 +50,24 @@ def unpack(dataset_dir):
5050
subprocess.run(['tar', 'xf', tb_fname, '-C', src_dir])
5151

5252
# bidskit uses sourcedata/<SUBJECT>/<SESSION> organization
53-
# Flywheel uses sourcedata/flywheel/<GROUP>/<PROJECT>/<SUBJECT>/SESSION>
53+
# Flywheel uses sourcedata/<FWDIRNAME>/<GROUP>/<PROJECT>/<SUBJECT>/SESSION>
5454
# so move <SUBJECT> folder up three levels within sourcedata and
55-
# delete sourcedata/flywheel folder tree
55+
# delete sourcedata/<FWDIRNAME> folder tree
56+
# Currently FWDIRNAME can be either 'flywheel' for web downloads or 'scitran'
57+
# for CLI downloads
58+
59+
# Check for existence of sourcedata/flywheel or sourcedata/scitran folders
60+
# following untarring
61+
fw_web_dir = op.join(src_dir, 'flywheel')
62+
fw_cli_dir = op.join(src_dir, 'scitran')
63+
if op.isdir(fw_web_dir):
64+
fw_dir = fw_web_dir
65+
elif op.isdir(fw_cli_dir):
66+
fw_dir = fw_cli_dir
67+
else:
68+
raise Exception(f'Neither sourcedata/flywheel or sourcedata/scitran exist following tar extraction')
5669

5770
# Assume only one group/project present in sourcedata following tarball unpacking
58-
fw_dir = op.join(src_dir, 'flywheel')
5971
subj_dir_list = sorted(glob(op.join(fw_dir, '*', '*', '*')))
6072
for subj_dir in subj_dir_list:
6173
print(f' Moving {subj_dir} to {src_dir}')

docs/Flywheel.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Flywheel allows export of all DICOM data from a project, subject or session from
44
The data exports to an uncompressed tar archive (*tarball*) with the following example folder organization:
55

66
```
7-
flywheel
7+
flywheel or scitran
88
└── odoherty
99
└── OLEL
1010
└── JOD_OLEL_031

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
# For a discussion on single-sourcing the version across setup.py and the
4646
# project code, see
4747
# https://packaging.python.org/en/latest/single_source_version.html
48-
version='2023.1.12', # Required
48+
version='2023.1.26', # Required
4949

5050
# This is a one-line description or tagline of what your project does. This
5151
# corresponds to the "Summary" metadata field:

0 commit comments

Comments
 (0)