Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP][ENH] BIDSify filenames and tables #43

Draft
wants to merge 32 commits into
base: master
Choose a base branch
from

Conversation

Remi-Gau
Copy link

@Remi-Gau Remi-Gau commented May 19, 2022

closes #37

Aim

Make the filenames BIDS friendly and make sure the tables and metadata are more BIDS compliant.

  • renames files
  • adds a test script using bids-matlab to ensure compliance with BIDS filename pattern
  • change csv to tsv
  • update JSON

TODO

  • fix name HarvardOxford-thr25_*_variant-lateral-ventricles_*i
  • fix names Yeo atlas (too many dashes)
  • use same label format for resolution in all filenames
  • fix CSV
  • fix JSON

SUMMARY

Executed through the following command

datalad run -d . -m 'add mask suffix' "find atlases/mask -type f | rename 's/.nii.gz/_mask.nii.gz/g'" 

datalad run -d . -m 'fix res entity' "find atlases/mask -type f | rename 's/_res_/_res-/g'" 

datalad run -d . -m 'fix desc entity' "find atlases/mask -type f | rename 's/_descr-/_desc-/g'" 

datalad run -d . -m 'fix atlas' "find atlases/mask -type f -name 'MNI*' | rename 's/MNI152NLin6/space-MNI152NLin6/g'" 

datalad run -d . -m 'rm prefix corpus call' "find atlases/mask -type f -name 'Corpus*' | rename 's/CorpusCallosum_res/res/g'"

datalad run -d . -m 'rm _T1w_ in mask' "find atlases/mask -type f | rename 's/_T1w_/T1w/g'"

datalad run -d . -m 'fix desc entities in reference brain' "find atlases/reference_brains -type f | rename 's/_T1w_descr-brain/_desc-brain_T1w/g'"

datalad run -d . -m 'add atlas entity in reference brain' "find atlases/reference_brains -type f | rename 's/MNI/atlas-MNI/g'"

datalad run -d . -m 'fix symmetric' "find atlases/reference_brains -type f | rename 's/atlas-MNI152_T1_4mm_symmetric.nii/atlas-MNI152_res-4mm_desc-symmetric_T1w.nii/g'"

datalad run -d . -m 'add discrete segmentaton to labels' "find atlases/label/Human -type f | rename 's/.nii.gz/_dseg.nii.gz/g'"

datalad run -d . -m 'add atlas entity to labels' "cd atlases/label/Human/ && bash add_label_entity.sh"

=== Do not change lines below ===
{
 "chain": [],
 "cmd": "find atlases/mask -type f | rename 's/.nii.gz/_mask.nii.gz/g'",
 "exit": 0,
 "extra_inputs": [],
 "inputs": [],
 "outputs": [],
 "pwd": "."
}
^^^ Do not change lines above ^^^
=== Do not change lines below ===
{
 "chain": [],
 "cmd": "find atlases/mask -type f | rename 's/_res_/_res-/g'",
 "exit": 0,
 "extra_inputs": [],
 "inputs": [],
 "outputs": [],
 "pwd": "."
}
^^^ Do not change lines above ^^^
=== Do not change lines below ===
{
 "chain": [],
 "cmd": "find atlases/mask -type f | rename 's/_descr-/_desc-/g'",
 "exit": 0,
 "extra_inputs": [],
 "inputs": [],
 "outputs": [],
 "pwd": "."
}
^^^ Do not change lines above ^^^
=== Do not change lines below ===
{
 "chain": [],
 "cmd": "find atlases/mask -type f | rename 's/_desc-brainmask/_desc-brain/g'",
 "exit": 0,
 "extra_inputs": [],
 "inputs": [],
 "outputs": [],
 "pwd": "."
}
^^^ Do not change lines above ^^^
=== Do not change lines below ===
{
 "chain": [],
 "cmd": "find atlases/mask -type f -name 'MNI*' | rename 's/MNI152NLin6/space-MNI152NLin6/g'",
 "exit": 0,
 "extra_inputs": [],
 "inputs": [],
 "outputs": [],
 "pwd": "."
}
^^^ Do not change lines above ^^^
=== Do not change lines below ===
{
 "chain": [],
 "cmd": "find atlases/mask -type f -name 'Corpus*' | rename 's/_mask.nii.gz/_desc-CorpusCallosum_mask.nii.gz/g'",
 "exit": 0,
 "extra_inputs": [],
 "inputs": [],
 "outputs": [],
 "pwd": "."
}
^^^ Do not change lines above ^^^
=== Do not change lines below ===
{
 "chain": [],
 "cmd": "find atlases/mask -type f -name 'Corpus*' | rename 's/CorpusCallosum_res/res/g'",
 "exit": 0,
 "extra_inputs": [],
 "inputs": [],
 "outputs": [],
 "pwd": "."
}
^^^ Do not change lines above ^^^
=== Do not change lines below ===
{
 "chain": [],
 "cmd": "find atlases/mask -type f | rename 's/_T1w_/T1w/g'",
 "exit": 0,
 "extra_inputs": [],
 "inputs": [],
 "outputs": [],
 "pwd": "."
}
^^^ Do not change lines above ^^^
=== Do not change lines below ===
{
 "chain": [],
 "cmd": "find atlases/reference_brains -type f | rename 's/_T1w_descr-brain/_desc-brain_T1w/g'",
 "exit": 0,
 "extra_inputs": [],
 "inputs": [],
 "outputs": [],
 "pwd": "."
}
^^^ Do not change lines above ^^^
=== Do not change lines below ===
{
 "chain": [],
 "cmd": "find atlases/reference_brains -type f | rename 's/MNI/atlas-MNI/g'",
 "exit": 0,
 "extra_inputs": [],
 "inputs": [],
 "outputs": [],
 "pwd": "."
}
^^^ Do not change lines above ^^^
=== Do not change lines below ===
{
 "chain": [],
 "cmd": "find atlases/reference_brains -type f | rename 's/FSL/atlas-FSL/g'",
 "exit": 0,
 "extra_inputs": [],
 "inputs": [],
 "outputs": [],
 "pwd": "."
}
^^^ Do not change lines above ^^^
=== Do not change lines below ===
{
 "chain": [],
 "cmd": "find atlases/reference_brains -type f | rename 's/atlas-MNI152_T1_4mm_symmetric.nii/atlas-MNI152_res-4mm_desc-symmetric_T1w.nii/g'",
 "exit": 0,
 "extra_inputs": [],
 "inputs": [],
 "outputs": [],
 "pwd": "."
}
^^^ Do not change lines above ^^^
=== Do not change lines below ===
{
 "chain": [],
 "cmd": "find atlases/label/Human -type f | rename 's/.nii.gz/_dseg.nii.gz/g'",
 "exit": 0,
 "extra_inputs": [],
 "inputs": [],
 "outputs": [],
 "pwd": "."
}
^^^ Do not change lines above ^^^
=== Do not change lines below ===
{
 "chain": [],
 "cmd": "cd atlases/label/Human/ && bash add_label_entity.sh",
 "exit": 0,
 "extra_inputs": [],
 "inputs": [],
 "outputs": [],
 "pwd": "."
}
^^^ Do not change lines above ^^^
@Remi-Gau Remi-Gau marked this pull request as draft May 19, 2022 17:23
=== Do not change lines below ===
{
 "chain": [],
 "cmd": "python3 rename.py",
 "exit": 0,
 "extra_inputs": [],
 "inputs": [],
 "outputs": [],
 "pwd": "."
}
^^^ Do not change lines above ^^^
=== Do not change lines below ===
{
 "chain": [],
 "cmd": "python3 clean_up_json.py",
 "exit": 0,
 "extra_inputs": [],
 "inputs": [],
 "outputs": [],
 "pwd": "."
}
^^^ Do not change lines above ^^^
=== Do not change lines below ===
{
 "chain": [],
 "cmd": "python3 add_hemisphere_to_tsv.py",
 "exit": 0,
 "extra_inputs": [],
 "inputs": [],
 "outputs": [],
 "pwd": "."
}
^^^ Do not change lines above ^^^
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

make filenames BIDS compliant
1 participant