-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit a6841e9
Showing
95 changed files
with
676 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
version: 2 # use CircleCI 2.0 | ||
jobs: # A basic unit of work in a run | ||
build: # runs not using Workflows must have a `build` job as entry point | ||
docker: # run the steps with Docker | ||
# CircleCI Python images available at: https://hub.docker.com/r/circleci/python/ | ||
- image: circleci/python:3.6.4 | ||
working_directory: /tmp/src/rename_fmriprep | ||
steps: | ||
- checkout | ||
- run: | ||
name: Install requirements | ||
command: | | ||
pip install pytest==4.5.* | ||
pip install -r requirements.txt | ||
- run: | ||
name: Test command | ||
command: | | ||
pytest -vv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
|
||
# C extensions | ||
*.so | ||
*.c | ||
|
||
# Distribution / packaging | ||
.Python | ||
env/ | ||
# build/ # commented due to some strangeness with Docker/circle setup | ||
develop-eggs/ | ||
dist/ | ||
build/lib* | ||
build/temp* | ||
downloads/ | ||
eggs/ | ||
.eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
|
||
# PyInstaller | ||
# Usually these files are written by a python script from a template | ||
# before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
*.manifest | ||
*.spec | ||
|
||
# Installer logs | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
|
||
# Unit test / coverage reports | ||
htmlcov/ | ||
.tox/ | ||
.coverage | ||
.coverage.* | ||
.cache | ||
nosetests.xml | ||
coverage.xml | ||
*,cover | ||
.hypothesis/ | ||
.pytest_cache | ||
|
||
# Translations | ||
*.mo | ||
*.pot | ||
|
||
# Django stuff: | ||
*.log | ||
|
||
# Sphinx documentation | ||
docs/_build/ | ||
docs/examples/notebooks | ||
docs/api | ||
|
||
# PyBuilder | ||
target/ | ||
|
||
# Ipython Notebook | ||
.ipynb_checkpoints | ||
|
||
auth/ | ||
secrets.py | ||
local_settings.py | ||
|
||
*.swp | ||
|
||
# Text Editors | ||
.vscode |
Large diffs are not rendered by default.
Oops, something went wrong.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,154 @@ | ||
#!/usr/bin/env python3 | ||
""" | ||
rename fmriprep (< v1.2.0) files to be in conformance with the | ||
bids derivatives release candidate | ||
""" | ||
from argparse import ArgumentParser | ||
import json | ||
import os | ||
import re | ||
from shutil import copyfile | ||
|
||
from bids.layout.writing import build_path | ||
|
||
|
||
# templates for matching the old fmriprep files | ||
BIDS_NAME = ( | ||
r'^(.*\/)?' | ||
r'sub-(?P<subject>[a-zA-Z0-9]+)' | ||
r'(_ses-(?P<session>[a-zA-Z0-9]+))?' | ||
r'(_task-(?P<task>[a-zA-Z0-9]+))?' | ||
r'(_acq-(?P<acq>[a-zA-Z0-9]+))?' | ||
r'(_rec-(?P<rec>[a-zA-Z0-9]+))?' | ||
r'(_run-(?P<run>[a-zA-Z0-9]+))?') | ||
|
||
DERIV_NAME = ( | ||
r'_(?P<suffix>[a-zA-Z0-9]+)' | ||
r'(_space-(?P<space>[a-zA-Z0-9]+))?' | ||
r'(_class-(?P<class>[a-zA-Z0-9]+))?' | ||
r'(_target-(?P<target>[a-zA-Z0-9]+))?' | ||
r'(_variant-(?P<variant>[a-zA-Z0-9]+))?' | ||
r'_(?P<desc>[a-zA-Z0-9]+)' | ||
r'\.(?P<ext>(?!svg).*)') | ||
|
||
# regular expression to match old fmriprep | ||
DERIV_REGEX = re.compile(r''.join([BIDS_NAME, DERIV_NAME])) | ||
|
||
# template to build the "correct" derivative file | ||
PATH_PATTERN = ( | ||
'sub-{subject}' | ||
'[_ses-{session}]' | ||
'[_task-{task}]' | ||
'[_acq-{acq}]' | ||
'[_rec-{rec}]' | ||
'[_run-{run}]' | ||
'[_from-{fspace}]' | ||
'[_to-{tspace}]' | ||
'[_mode-{mode}]' | ||
'[_hemi-{hemi}]' | ||
'[_space-{space}]' | ||
'[_label-{label}]' | ||
'[_desc-{desc}]' | ||
'_{suffix}' | ||
'.{ext}') | ||
|
||
|
||
def rename_fmriprep_files(fmriprep_dir, renamed_dir, dset_desc): | ||
# copy the dataset_description file over first | ||
os.makedirs(renamed_dir, exist_ok=True) | ||
copyfile(dset_desc, os.path.join(renamed_dir, os.path.basename(dset_desc))) | ||
|
||
# collect the mapping from old file names to new file names | ||
rename_files = {} | ||
for root, _, files in os.walk(fmriprep_dir): | ||
for file in files: | ||
match = re.search(DERIV_REGEX, file) | ||
if match is not None: | ||
file_dict = match.groupdict() | ||
# change brainmask to desc-brain_mask | ||
if file_dict.get('desc') == 'brainmask': | ||
file_dict['desc'] = 'brain' | ||
file_dict['suffix'] = 'mask' | ||
# variant is now desc | ||
if file_dict.get('variant'): | ||
file_dict['desc'] = file_dict.pop('variant') | ||
# different formats of transformation files | ||
if file_dict.get('space') and file_dict.get('target'): | ||
file_dict['fspace'] = file_dict.pop('space') | ||
file_dict['tspace'] = file_dict.pop('target') | ||
file_dict['mode'] = 'image' | ||
file_dict['suffix'] = 'xfm' | ||
del file_dict['desc'] | ||
if file_dict.get('target'): | ||
file_dict['fspace'] = file_dict.pop('suffix') | ||
file_dict['tspace'] = file_dict.pop('target') | ||
file_dict['mode'] = 'image' | ||
file_dict['suffix'] = 'xfm' | ||
del file_dict['desc'] | ||
# segmentations | ||
if file_dict.get('class'): | ||
file_dict['label'] = file_dict.pop('class') | ||
file_dict['suffix'] = 'probseg' | ||
del file_dict['desc'] | ||
if file_dict.get('desc') == 'dtissue': | ||
file_dict['suffix'] = 'dseg' | ||
del file_dict['desc'] | ||
# freesurfer hemisphere files | ||
if file_dict['ext'].startswith('L') or file_dict['ext'].startswith('R'): | ||
file_dict['hemi'] = file_dict['ext'][0] | ||
file_dict['ext'] = file_dict['ext'][2:] | ||
file_dict['suffix'] = file_dict.pop('desc') | ||
# aroma files | ||
if file_dict.get('desc') == 'MELODICmix': | ||
file_dict['desc'] = 'MELODIC' | ||
file_dict['suffix'] = 'mixing' | ||
if file_dict.get('desc') == 'AROMAnoiseICs': | ||
file_dict['suffix'] = file_dict['desc'] | ||
del file_dict['desc'] | ||
# confounds file change | ||
if file_dict.get('desc') == 'confounds': | ||
file_dict['suffix'] = 'regressors' | ||
|
||
# write the file to the new directory | ||
new_file = build_path(file_dict, PATH_PATTERN) | ||
new_root = root.replace(fmriprep_dir, renamed_dir) | ||
new_path = os.path.join(new_root, new_file) | ||
old_path = os.path.join(root, file) | ||
rename_files[old_path] = new_path | ||
os.makedirs(new_root, exist_ok=True) | ||
copyfile(old_path, new_path) | ||
|
||
# write out log for how files were renamed | ||
data_transfer_log = os.path.join(renamed_dir, "logs", "data_transfer.json") | ||
os.makedirs(os.path.dirname(data_transfer_log), exist_ok=True) | ||
with open(data_transfer_log, 'w') as fp: | ||
json.dump(rename_files, fp) | ||
|
||
return data_transfer_log | ||
|
||
|
||
def main(): | ||
# set up a parser to read arguments | ||
parser = ArgumentParser(description='conform_fmriprep: rename old fmriprep (< v1.2.0) files') | ||
requiredNamed = parser.add_argument_group('required named arguments') | ||
requiredNamed.add_argument('-i', '--input-dir', dest='fmriprep_dir', | ||
action='store', required=True, | ||
help='the root folder of a fmriprep derivatives ' | ||
'dataset (sub-XXXXX folders should be found at the ' | ||
'top level in this folder).') | ||
requiredNamed.add_argument('-o', '--output-dir', dest='renamed_dir', | ||
action='store', required=True, | ||
help='the root folder to place the renamed fmriprep outputs') | ||
requiredNamed.add_argument('-d', '--dataset-description', dest='dset_desc', | ||
action='store', required=True, | ||
help='the required dataset description file to be placed ' | ||
'at the root folder of fmriprep') | ||
|
||
opts = parser.parse_args() | ||
|
||
# rename the files | ||
rename_fmriprep_files(opts.fmriprep_dir, opts.renamed_dir, opts.dset_desc) | ||
|
||
|
||
if __name__ == '__main__': | ||
main() |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"Name": "fmriprep", "BIDSVersion": "1.0.0", "PipelineDescription": {"Name": "fmriprep"}} |
Empty file.
Empty file.
Empty file added
0
rename_old_fmriprep/tests/data/sub-01/anat/sub-01_T1w_class-CSF_probtissue.nii.gz
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file added
0
...old_fmriprep/tests/data/sub-01/anat/sub-01_T1w_space-MNI152NLin2009cAsym_brainmask.nii.gz
Empty file.
Empty file added
0
...p/tests/data/sub-01/anat/sub-01_T1w_space-MNI152NLin2009cAsym_class-CSF_probtissue.nii.gz
Empty file.
Empty file added
0
...ep/tests/data/sub-01/anat/sub-01_T1w_space-MNI152NLin2009cAsym_class-GM_probtissue.nii.gz
Empty file.
Empty file added
0
...ep/tests/data/sub-01/anat/sub-01_T1w_space-MNI152NLin2009cAsym_class-WM_probtissue.nii.gz
Empty file.
Empty file added
0
...e_old_fmriprep/tests/data/sub-01/anat/sub-01_T1w_space-MNI152NLin2009cAsym_dtissue.nii.gz
Empty file.
Empty file added
0
...e_old_fmriprep/tests/data/sub-01/anat/sub-01_T1w_space-MNI152NLin2009cAsym_preproc.nii.gz
Empty file.
Empty file added
0
...d_fmriprep/tests/data/sub-01/anat/sub-01_T1w_space-MNI152NLin2009cAsym_target-T1w_warp.h5
Empty file.
Empty file added
0
rename_old_fmriprep/tests/data/sub-01/anat/sub-01_T1w_target-MNI152NLin2009cAsym_warp.h5
Empty file.
Empty file.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file added
0
...e_old_fmriprep/tests/data/sub-01/figures/sub-01_ses-post_fieldmap_fmap_mask.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file added
0
..._fmriprep/tests/data/sub-01/figures/sub-01_ses-post_task-flanker_bold_coreg.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file added
0
...riprep/tests/data/sub-01/figures/sub-01_ses-post_task-flanker_bold_fmap_reg.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file added
0
...ep/tests/data/sub-01/figures/sub-01_ses-post_task-flanker_bold_fmap_reg_vsm.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file added
0
...iprep/tests/data/sub-01/figures/sub-01_ses-post_task-flanker_bold_ica_aroma.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file added
0
...d_fmriprep/tests/data/sub-01/figures/sub-01_ses-post_task-flanker_bold_rois.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file added
0
...ata/sub-01/figures/sub-01_ses-post_task-flanker_bold_variant-hmcsdc_preproc.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file added
0
...old_fmriprep/tests/data/sub-01/figures/sub-01_ses-post_task-rest_bold_coreg.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file added
0
..._fmriprep/tests/data/sub-01/figures/sub-01_ses-post_task-rest_bold_fmap_reg.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file added
0
...iprep/tests/data/sub-01/figures/sub-01_ses-post_task-rest_bold_fmap_reg_vsm.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file added
0
...fmriprep/tests/data/sub-01/figures/sub-01_ses-post_task-rest_bold_ica_aroma.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file added
0
..._old_fmriprep/tests/data/sub-01/figures/sub-01_ses-post_task-rest_bold_rois.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file added
0
...s/data/sub-01/figures/sub-01_ses-post_task-rest_bold_variant-hmcsdc_preproc.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file added
0
...me_old_fmriprep/tests/data/sub-01/figures/sub-01_ses-pre_fieldmap_fmap_mask.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file added
0
...d_fmriprep/tests/data/sub-01/figures/sub-01_ses-pre_task-flanker_bold_coreg.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file added
0
...mriprep/tests/data/sub-01/figures/sub-01_ses-pre_task-flanker_bold_fmap_reg.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file added
0
...rep/tests/data/sub-01/figures/sub-01_ses-pre_task-flanker_bold_fmap_reg_vsm.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file added
0
...riprep/tests/data/sub-01/figures/sub-01_ses-pre_task-flanker_bold_ica_aroma.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file added
0
...ld_fmriprep/tests/data/sub-01/figures/sub-01_ses-pre_task-flanker_bold_rois.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file added
0
...data/sub-01/figures/sub-01_ses-pre_task-flanker_bold_variant-hmcsdc_preproc.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file added
0
..._old_fmriprep/tests/data/sub-01/figures/sub-01_ses-pre_task-rest_bold_coreg.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file added
0
...d_fmriprep/tests/data/sub-01/figures/sub-01_ses-pre_task-rest_bold_fmap_reg.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file added
0
...riprep/tests/data/sub-01/figures/sub-01_ses-pre_task-rest_bold_fmap_reg_vsm.svg
Oops, something went wrong.
Empty file added
0
..._fmriprep/tests/data/sub-01/figures/sub-01_ses-pre_task-rest_bold_ica_aroma.svg
Oops, something went wrong.
Empty file added
0
...e_old_fmriprep/tests/data/sub-01/figures/sub-01_ses-pre_task-rest_bold_rois.svg
Oops, something went wrong.
Empty file added
0
...ts/data/sub-01/figures/sub-01_ses-pre_task-rest_bold_variant-hmcsdc_preproc.svg
Oops, something went wrong.
Empty file.
Empty file added
0
...prep/tests/data/sub-01/ses-post/anat/sub-01_ses-post_T1w_space-orig_target-T1w_affine.txt
Empty file.
Empty file added
0
...iprep/tests/data/sub-01/ses-post/func/sub-01_ses-post_task-flanker_bold_AROMAnoiseICs.csv
Empty file.
Empty file added
0
...fmriprep/tests/data/sub-01/ses-post/func/sub-01_ses-post_task-flanker_bold_MELODICmix.tsv
Empty file.
Empty file added
0
..._fmriprep/tests/data/sub-01/ses-post/func/sub-01_ses-post_task-flanker_bold_confounds.tsv
Empty file.
Empty file added
0
...es-post/func/sub-01_ses-post_task-flanker_bold_space-MNI152NLin2009cAsym_brainmask.nii.gz
Empty file.
Empty file added
0
.../ses-post/func/sub-01_ses-post_task-flanker_bold_space-MNI152NLin2009cAsym_preproc.nii.gz
Empty file.
Empty file added
0
..._ses-post_task-flanker_bold_space-MNI152NLin2009cAsym_variant-AROMAnonaggr_preproc.nii.gz
Empty file.
Empty file added
0
...ost_task-flanker_bold_space-MNI152NLin2009cAsym_variant-smoothAROMAnonaggr_preproc.nii.gz
Empty file.
Empty file added
0
...fmriprep/tests/data/sub-01/ses-post/func/sub-01_ses-post_task-rest_bold_AROMAnoiseICs.csv
Empty file.
Empty file added
0
...ld_fmriprep/tests/data/sub-01/ses-post/func/sub-01_ses-post_task-rest_bold_MELODICmix.tsv
Empty file.
Empty file added
0
...old_fmriprep/tests/data/sub-01/ses-post/func/sub-01_ses-post_task-rest_bold_confounds.tsv
Empty file.
Empty file added
0
...1/ses-post/func/sub-01_ses-post_task-rest_bold_space-MNI152NLin2009cAsym_brainmask.nii.gz
Empty file.
Empty file added
0
...-01/ses-post/func/sub-01_ses-post_task-rest_bold_space-MNI152NLin2009cAsym_preproc.nii.gz
Empty file.
Empty file added
0
...-01_ses-post_task-rest_bold_space-MNI152NLin2009cAsym_variant-AROMAnonaggr_preproc.nii.gz
Empty file.
Empty file added
0
...s-post_task-rest_bold_space-MNI152NLin2009cAsym_variant-smoothAROMAnonaggr_preproc.nii.gz
Empty file.
Empty file.
Empty file added
0
...riprep/tests/data/sub-01/ses-pre/anat/sub-01_ses-pre_T1w_space-orig_target-T1w_affine.txt
Empty file.
Empty file added
0
...mriprep/tests/data/sub-01/ses-pre/func/sub-01_ses-pre_task-flanker_bold_AROMAnoiseICs.csv
Empty file.
Empty file added
0
...d_fmriprep/tests/data/sub-01/ses-pre/func/sub-01_ses-pre_task-flanker_bold_MELODICmix.tsv
Empty file.
Empty file added
0
...ld_fmriprep/tests/data/sub-01/ses-pre/func/sub-01_ses-pre_task-flanker_bold_confounds.tsv
Empty file.
Empty file added
0
.../ses-pre/func/sub-01_ses-pre_task-flanker_bold_space-MNI152NLin2009cAsym_brainmask.nii.gz
Empty file.
Empty file added
0
...01/ses-pre/func/sub-01_ses-pre_task-flanker_bold_space-MNI152NLin2009cAsym_preproc.nii.gz
Empty file.
Empty file added
0
...1_ses-pre_task-flanker_bold_space-MNI152NLin2009cAsym_variant-AROMAnonaggr_preproc.nii.gz
Empty file.
Empty file added
0
...pre_task-flanker_bold_space-MNI152NLin2009cAsym_variant-smoothAROMAnonaggr_preproc.nii.gz
Empty file.
Empty file added
0
...d_fmriprep/tests/data/sub-01/ses-pre/func/sub-01_ses-pre_task-rest_bold_AROMAnoiseICs.csv
Empty file.
Empty file added
0
..._old_fmriprep/tests/data/sub-01/ses-pre/func/sub-01_ses-pre_task-rest_bold_MELODICmix.tsv
Empty file.
Empty file added
0
...e_old_fmriprep/tests/data/sub-01/ses-pre/func/sub-01_ses-pre_task-rest_bold_confounds.tsv
Empty file.
Empty file added
0
...-01/ses-pre/func/sub-01_ses-pre_task-rest_bold_space-MNI152NLin2009cAsym_brainmask.nii.gz
Empty file.
Empty file added
0
...ub-01/ses-pre/func/sub-01_ses-pre_task-rest_bold_space-MNI152NLin2009cAsym_preproc.nii.gz
Empty file.
Empty file added
0
...b-01_ses-pre_task-rest_bold_space-MNI152NLin2009cAsym_variant-AROMAnonaggr_preproc.nii.gz
Empty file.
Empty file added
0
...es-pre_task-rest_bold_space-MNI152NLin2009cAsym_variant-smoothAROMAnonaggr_preproc.nii.gz
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"./tests/data/sub-01/anat/sub-01_T1w_brainmask.nii.gz": "./tst_out/sub-01/anat/sub-01_desc-brain_mask.nii.gz", "./tests/data/sub-01/anat/sub-01_T1w_class-CSF_probtissue.nii.gz": "./tst_out/sub-01/anat/sub-01_label-CSF_probseg.nii.gz", "./tests/data/sub-01/anat/sub-01_T1w_class-GM_probtissue.nii.gz": "./tst_out/sub-01/anat/sub-01_label-GM_probseg.nii.gz", "./tests/data/sub-01/anat/sub-01_T1w_class-WM_probtissue.nii.gz": "./tst_out/sub-01/anat/sub-01_label-WM_probseg.nii.gz", "./tests/data/sub-01/anat/sub-01_T1w_dtissue.nii.gz": "./tst_out/sub-01/anat/sub-01_dseg.nii.gz", "./tests/data/sub-01/anat/sub-01_T1w_inflated.L.surf.gii": "./tst_out/sub-01/anat/sub-01_hemi-L_inflated.surf.gii", "./tests/data/sub-01/anat/sub-01_T1w_inflated.R.surf.gii": "./tst_out/sub-01/anat/sub-01_hemi-R_inflated.surf.gii", "./tests/data/sub-01/anat/sub-01_T1w_midthickness.L.surf.gii": "./tst_out/sub-01/anat/sub-01_hemi-L_midthickness.surf.gii", "./tests/data/sub-01/anat/sub-01_T1w_midthickness.R.surf.gii": "./tst_out/sub-01/anat/sub-01_hemi-R_midthickness.surf.gii", "./tests/data/sub-01/anat/sub-01_T1w_pial.L.surf.gii": "./tst_out/sub-01/anat/sub-01_hemi-L_pial.surf.gii", "./tests/data/sub-01/anat/sub-01_T1w_pial.R.surf.gii": "./tst_out/sub-01/anat/sub-01_hemi-R_pial.surf.gii", "./tests/data/sub-01/anat/sub-01_T1w_preproc.nii.gz": "./tst_out/sub-01/anat/sub-01_desc-preproc_T1w.nii.gz", "./tests/data/sub-01/anat/sub-01_T1w_smoothwm.L.surf.gii": "./tst_out/sub-01/anat/sub-01_hemi-L_smoothwm.surf.gii", "./tests/data/sub-01/anat/sub-01_T1w_smoothwm.R.surf.gii": "./tst_out/sub-01/anat/sub-01_hemi-R_smoothwm.surf.gii", "./tests/data/sub-01/anat/sub-01_T1w_space-MNI152NLin2009cAsym_brainmask.nii.gz": "./tst_out/sub-01/anat/sub-01_space-MNI152NLin2009cAsym_desc-brain_mask.nii.gz", "./tests/data/sub-01/anat/sub-01_T1w_space-MNI152NLin2009cAsym_class-CSF_probtissue.nii.gz": "./tst_out/sub-01/anat/sub-01_space-MNI152NLin2009cAsym_label-CSF_probseg.nii.gz", "./tests/data/sub-01/anat/sub-01_T1w_space-MNI152NLin2009cAsym_class-GM_probtissue.nii.gz": "./tst_out/sub-01/anat/sub-01_space-MNI152NLin2009cAsym_label-GM_probseg.nii.gz", "./tests/data/sub-01/anat/sub-01_T1w_space-MNI152NLin2009cAsym_class-WM_probtissue.nii.gz": "./tst_out/sub-01/anat/sub-01_space-MNI152NLin2009cAsym_label-WM_probseg.nii.gz", "./tests/data/sub-01/anat/sub-01_T1w_space-MNI152NLin2009cAsym_dtissue.nii.gz": "./tst_out/sub-01/anat/sub-01_space-MNI152NLin2009cAsym_dseg.nii.gz", "./tests/data/sub-01/anat/sub-01_T1w_space-MNI152NLin2009cAsym_preproc.nii.gz": "./tst_out/sub-01/anat/sub-01_space-MNI152NLin2009cAsym_desc-preproc_T1w.nii.gz", "./tests/data/sub-01/anat/sub-01_T1w_space-MNI152NLin2009cAsym_target-T1w_warp.h5": "./tst_out/sub-01/anat/sub-01_from-MNI152NLin2009cAsym_to-T1w_mode-image_xfm.h5", "./tests/data/sub-01/anat/sub-01_T1w_target-fsnative_affine.txt": "./tst_out/sub-01/anat/sub-01_from-T1w_to-fsnative_mode-image_xfm.txt", "./tests/data/sub-01/anat/sub-01_T1w_target-MNI152NLin2009cAsym_warp.h5": "./tst_out/sub-01/anat/sub-01_from-T1w_to-MNI152NLin2009cAsym_mode-image_xfm.h5", "./tests/data/sub-01/ses-post/anat/sub-01_ses-post_T1w_space-orig_target-T1w_affine.txt": "./tst_out/sub-01/ses-post/anat/sub-01_ses-post_from-orig_to-T1w_mode-image_xfm.txt", "./tests/data/sub-01/ses-post/func/sub-01_ses-post_task-flanker_bold_AROMAnoiseICs.csv": "./tst_out/sub-01/ses-post/func/sub-01_ses-post_task-flanker_AROMAnoiseICs.csv", "./tests/data/sub-01/ses-post/func/sub-01_ses-post_task-flanker_bold_confounds.tsv": "./tst_out/sub-01/ses-post/func/sub-01_ses-post_task-flanker_desc-confounds_regressors.tsv", "./tests/data/sub-01/ses-post/func/sub-01_ses-post_task-flanker_bold_MELODICmix.tsv": "./tst_out/sub-01/ses-post/func/sub-01_ses-post_task-flanker_desc-MELODIC_mixing.tsv", "./tests/data/sub-01/ses-post/func/sub-01_ses-post_task-flanker_bold_space-MNI152NLin2009cAsym_brainmask.nii.gz": "./tst_out/sub-01/ses-post/func/sub-01_ses-post_task-flanker_space-MNI152NLin2009cAsym_desc-brain_mask.nii.gz", "./tests/data/sub-01/ses-post/func/sub-01_ses-post_task-flanker_bold_space-MNI152NLin2009cAsym_preproc.nii.gz": "./tst_out/sub-01/ses-post/func/sub-01_ses-post_task-flanker_space-MNI152NLin2009cAsym_desc-preproc_bold.nii.gz", "./tests/data/sub-01/ses-post/func/sub-01_ses-post_task-flanker_bold_space-MNI152NLin2009cAsym_variant-AROMAnonaggr_preproc.nii.gz": "./tst_out/sub-01/ses-post/func/sub-01_ses-post_task-flanker_space-MNI152NLin2009cAsym_desc-AROMAnonaggr_bold.nii.gz", "./tests/data/sub-01/ses-post/func/sub-01_ses-post_task-flanker_bold_space-MNI152NLin2009cAsym_variant-smoothAROMAnonaggr_preproc.nii.gz": "./tst_out/sub-01/ses-post/func/sub-01_ses-post_task-flanker_space-MNI152NLin2009cAsym_desc-smoothAROMAnonaggr_bold.nii.gz", "./tests/data/sub-01/ses-post/func/sub-01_ses-post_task-rest_bold_AROMAnoiseICs.csv": "./tst_out/sub-01/ses-post/func/sub-01_ses-post_task-rest_AROMAnoiseICs.csv", "./tests/data/sub-01/ses-post/func/sub-01_ses-post_task-rest_bold_confounds.tsv": "./tst_out/sub-01/ses-post/func/sub-01_ses-post_task-rest_desc-confounds_regressors.tsv", "./tests/data/sub-01/ses-post/func/sub-01_ses-post_task-rest_bold_MELODICmix.tsv": "./tst_out/sub-01/ses-post/func/sub-01_ses-post_task-rest_desc-MELODIC_mixing.tsv", "./tests/data/sub-01/ses-post/func/sub-01_ses-post_task-rest_bold_space-MNI152NLin2009cAsym_brainmask.nii.gz": "./tst_out/sub-01/ses-post/func/sub-01_ses-post_task-rest_space-MNI152NLin2009cAsym_desc-brain_mask.nii.gz", "./tests/data/sub-01/ses-post/func/sub-01_ses-post_task-rest_bold_space-MNI152NLin2009cAsym_preproc.nii.gz": "./tst_out/sub-01/ses-post/func/sub-01_ses-post_task-rest_space-MNI152NLin2009cAsym_desc-preproc_bold.nii.gz", "./tests/data/sub-01/ses-post/func/sub-01_ses-post_task-rest_bold_space-MNI152NLin2009cAsym_variant-AROMAnonaggr_preproc.nii.gz": "./tst_out/sub-01/ses-post/func/sub-01_ses-post_task-rest_space-MNI152NLin2009cAsym_desc-AROMAnonaggr_bold.nii.gz", "./tests/data/sub-01/ses-post/func/sub-01_ses-post_task-rest_bold_space-MNI152NLin2009cAsym_variant-smoothAROMAnonaggr_preproc.nii.gz": "./tst_out/sub-01/ses-post/func/sub-01_ses-post_task-rest_space-MNI152NLin2009cAsym_desc-smoothAROMAnonaggr_bold.nii.gz", "./tests/data/sub-01/ses-pre/anat/sub-01_ses-pre_T1w_space-orig_target-T1w_affine.txt": "./tst_out/sub-01/ses-pre/anat/sub-01_ses-pre_from-orig_to-T1w_mode-image_xfm.txt", "./tests/data/sub-01/ses-pre/func/sub-01_ses-pre_task-flanker_bold_AROMAnoiseICs.csv": "./tst_out/sub-01/ses-pre/func/sub-01_ses-pre_task-flanker_AROMAnoiseICs.csv", "./tests/data/sub-01/ses-pre/func/sub-01_ses-pre_task-flanker_bold_confounds.tsv": "./tst_out/sub-01/ses-pre/func/sub-01_ses-pre_task-flanker_desc-confounds_regressors.tsv", "./tests/data/sub-01/ses-pre/func/sub-01_ses-pre_task-flanker_bold_MELODICmix.tsv": "./tst_out/sub-01/ses-pre/func/sub-01_ses-pre_task-flanker_desc-MELODIC_mixing.tsv", "./tests/data/sub-01/ses-pre/func/sub-01_ses-pre_task-flanker_bold_space-MNI152NLin2009cAsym_brainmask.nii.gz": "./tst_out/sub-01/ses-pre/func/sub-01_ses-pre_task-flanker_space-MNI152NLin2009cAsym_desc-brain_mask.nii.gz", "./tests/data/sub-01/ses-pre/func/sub-01_ses-pre_task-flanker_bold_space-MNI152NLin2009cAsym_preproc.nii.gz": "./tst_out/sub-01/ses-pre/func/sub-01_ses-pre_task-flanker_space-MNI152NLin2009cAsym_desc-preproc_bold.nii.gz", "./tests/data/sub-01/ses-pre/func/sub-01_ses-pre_task-flanker_bold_space-MNI152NLin2009cAsym_variant-AROMAnonaggr_preproc.nii.gz": "./tst_out/sub-01/ses-pre/func/sub-01_ses-pre_task-flanker_space-MNI152NLin2009cAsym_desc-AROMAnonaggr_bold.nii.gz", "./tests/data/sub-01/ses-pre/func/sub-01_ses-pre_task-flanker_bold_space-MNI152NLin2009cAsym_variant-smoothAROMAnonaggr_preproc.nii.gz": "./tst_out/sub-01/ses-pre/func/sub-01_ses-pre_task-flanker_space-MNI152NLin2009cAsym_desc-smoothAROMAnonaggr_bold.nii.gz", "./tests/data/sub-01/ses-pre/func/sub-01_ses-pre_task-rest_bold_AROMAnoiseICs.csv": "./tst_out/sub-01/ses-pre/func/sub-01_ses-pre_task-rest_AROMAnoiseICs.csv", "./tests/data/sub-01/ses-pre/func/sub-01_ses-pre_task-rest_bold_confounds.tsv": "./tst_out/sub-01/ses-pre/func/sub-01_ses-pre_task-rest_desc-confounds_regressors.tsv", "./tests/data/sub-01/ses-pre/func/sub-01_ses-pre_task-rest_bold_MELODICmix.tsv": "./tst_out/sub-01/ses-pre/func/sub-01_ses-pre_task-rest_desc-MELODIC_mixing.tsv", "./tests/data/sub-01/ses-pre/func/sub-01_ses-pre_task-rest_bold_space-MNI152NLin2009cAsym_brainmask.nii.gz": "./tst_out/sub-01/ses-pre/func/sub-01_ses-pre_task-rest_space-MNI152NLin2009cAsym_desc-brain_mask.nii.gz", "./tests/data/sub-01/ses-pre/func/sub-01_ses-pre_task-rest_bold_space-MNI152NLin2009cAsym_preproc.nii.gz": "./tst_out/sub-01/ses-pre/func/sub-01_ses-pre_task-rest_space-MNI152NLin2009cAsym_desc-preproc_bold.nii.gz", "./tests/data/sub-01/ses-pre/func/sub-01_ses-pre_task-rest_bold_space-MNI152NLin2009cAsym_variant-AROMAnonaggr_preproc.nii.gz": "./tst_out/sub-01/ses-pre/func/sub-01_ses-pre_task-rest_space-MNI152NLin2009cAsym_desc-AROMAnonaggr_bold.nii.gz", "./tests/data/sub-01/ses-pre/func/sub-01_ses-pre_task-rest_bold_space-MNI152NLin2009cAsym_variant-smoothAROMAnonaggr_preproc.nii.gz": "./tst_out/sub-01/ses-pre/func/sub-01_ses-pre_task-rest_space-MNI152NLin2009cAsym_desc-smoothAROMAnonaggr_bold.nii.gz"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import os | ||
import json | ||
from ..conform_fmriprep import rename_fmriprep_files | ||
|
||
|
||
def test_rename_fmriprep_files(tmp_path): | ||
cwd = os.path.dirname(os.path.realpath(__file__)) | ||
fmriprep_dir = os.path.join(cwd, 'data') | ||
renamed_dir = tmp_path | ||
dset_desc = os.path.join(fmriprep_dir, "dataset_description.json") | ||
# reference output | ||
with open(os.path.join(cwd, 'data_transfer.json'), 'r') as js: | ||
ground_truth_tmp = json.load(js) | ||
ground_truth = {os.path.basename(old): os.path.basename(new) | ||
for old, new in ground_truth_tmp.items()} | ||
tst_truth_file = rename_fmriprep_files(fmriprep_dir, str(renamed_dir), dset_desc) | ||
|
||
with open(tst_truth_file, 'r') as js2: | ||
tst_truth_tmp = json.load(js2) | ||
|
||
tst_truth = {os.path.basename(old): os.path.basename(new) | ||
for old, new in tst_truth_tmp.items()} | ||
# get basenames for each key-value | ||
|
||
assert ground_truth == tst_truth |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
pybids>=0.9.* |