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

[ENH] Upgrade custom entities #208

Merged
merged 21 commits into from
Jun 22, 2023

Conversation

arnaudbore
Copy link
Contributor

No description provided.

@arnaudbore arnaudbore changed the title [WIP][ENH] Upgrade custom entities [ENH] Upgrade custom entities Jun 13, 2023
@codecov-commenter
Copy link

codecov-commenter commented Jun 13, 2023

Codecov Report

Merging #208 (817daa5) into master (d823293) will increase coverage by 1.26%.
The diff coverage is 87.34%.

@@            Coverage Diff             @@
##           master     #208      +/-   ##
==========================================
+ Coverage   78.78%   80.04%   +1.26%     
==========================================
  Files          15       15              
  Lines         773      832      +59     
  Branches      111      137      +26     
==========================================
+ Hits          609      666      +57     
  Misses        134      134              
- Partials       30       32       +2     
Flag Coverage Δ
pytest 80.04% <87.34%> (+1.26%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
dcm2bids/utils/io.py 75.86% <ø> (+8.21%) ⬆️
dcm2bids/sidecar.py 86.69% <81.81%> (-0.81%) ⬇️
dcm2bids/acquisition.py 98.30% <100.00%> (+0.05%) ⬆️
dcm2bids/cli/dcm2bids.py 84.61% <100.00%> (+0.61%) ⬆️
dcm2bids/dcm2bids_gen.py 82.72% <100.00%> (+0.15%) ⬆️
dcm2bids/utils/utils.py 79.31% <100.00%> (+2.83%) ⬆️

... and 2 files with indirect coverage changes

@smeisler
Copy link
Collaborator

smeisler commented Jun 21, 2023

Some feedback:

  1. I like the new IntendedFor / id system
  2. Auto extraction of direction worked on my fmaps, but it would be nice to also add dir-<> labels to BOLD and DWI, which did not happen automatically in my tests
  3. When I auto-extracted features, the acq-<> label I manually specified seemed to have gotten ignored. I don’t know if this was intentional or not, but it would be nice if one can manually override auto-extraction (e.g., auto-extract direction, but manually add the acq label)
  4. I was not able to test the auto extraction of task names because our files did not fit the regex naming convention, but it looks like a nice feature
  5. Is there a way I can look at the a rendered documentation page for the development branch?

In relation to points 2-3, I have shared an example config and set of dicoms:

Desired tree:


└── ses-T1
    ├── anat
    │   ├── sub-READ1010_ses-T1_acq-VNavNorm_rec-defaced_T1w.json
    │   └── sub-READ1010_ses-T1_acq-VNavNorm_rec-defaced_T1w.nii.gz
    ├── dwi
    │   ├── sub-READ1010_ses-T1_acq-MDDW64_dir-PA_dwi.bval
    │   ├── sub-READ1010_ses-T1_acq-MDDW64_dir-PA_dwi.bvec
    │   ├── sub-READ1010_ses-T1_acq-MDDW64_dir-PA_dwi.json
    │   └── sub-READ1010_ses-T1_acq-MDDW64_dir-PA_dwi.nii.gz
    ├── fmap
    │   ├── sub-READ1010_ses-T1_acq-AM_dir-AP_epi.json
    │   ├── sub-READ1010_ses-T1_acq-AM_dir-AP_epi.nii.gz
    │   ├── sub-READ1010_ses-T1_acq-DWI_dir-AP_epi.json
    │   ├── sub-READ1010_ses-T1_acq-DWI_dir-AP_epi.nii.gz
    │   ├── sub-READ1010_ses-T1_acq-DWI_dir-PA_epi.json
    │   ├── sub-READ1010_ses-T1_acq-DWI_dir-PA_epi.nii.gz
    │   ├── sub-READ1010_ses-T1_acq-EF_dir-AP_epi.json
    │   ├── sub-READ1010_ses-T1_acq-EF_dir-AP_epi.nii.gz
    │   ├── sub-READ1010_ses-T1_acq-PSR_dir-AP_epi.json
    │   ├── sub-READ1010_ses-T1_acq-PSR_dir-AP_epi.nii.gz
    │   ├── sub-READ1010_ses-T1_acq-VM_dir-AP_epi.json
    │   └── sub-READ1010_ses-T1_acq-VM_dir-AP_epi.nii.gz
    └── func
        ├── sub-READ1010_ses-T1_task-AM_dir-PA_bold.json
        ├── sub-READ1010_ses-T1_task-AM_dir-PA_bold.nii.gz
        ├── sub-READ1010_ses-T1_task-EF_dir-PA_bold.json
        ├── sub-READ1010_ses-T1_task-EF_dir-PA_bold.nii.gz
        ├── sub-READ1010_ses-T1_task-PSR_dir-PA_bold.json
        ├── sub-READ1010_ses-T1_task-PSR_dir-PA_bold.nii.gz
        ├── sub-READ1010_ses-T1_task-VM_dir-PA_bold.json
        └── sub-READ1010_ses-T1_task-VM_dir-PA_bold.nii.gz

Actual tree with new config and automated label extraction. Note that the fmaps do not use the acq- label I supplied.

└── ses-T1
    ├── anat
    │   ├── sub-READ1010_ses-T1_acq-VNavNorm_T1w.json
    │   └── sub-READ1010_ses-T1_acq-VNavNorm_T1w.nii.gz
    ├── dwi
    │   ├── sub-READ1010_ses-T1_acq-MDDW64_dwi.bval
    │   ├── sub-READ1010_ses-T1_acq-MDDW64_dwi.bvec
    │   ├── sub-READ1010_ses-T1_acq-MDDW64_dwi.json
    │   └── sub-READ1010_ses-T1_acq-MDDW64_dwi.nii.gz
    ├── fmap
    │   ├── sub-READ1010_ses-T1_dir-PA_run-01_epi.json
    │   ├── sub-READ1010_ses-T1_dir-PA_run-01_epi.nii.gz
    │   ├── sub-READ1010_ses-T1_dir-PA_run-02_epi.json
    │   ├── sub-READ1010_ses-T1_dir-PA_run-02_epi.nii.gz
    │   ├── sub-READ1010_ses-T1_dir-PA_run-03_epi.json
    │   ├── sub-READ1010_ses-T1_dir-PA_run-03_epi.nii.gz
    │   ├── sub-READ1010_ses-T1_dir-PA_run-04_epi.json
    │   ├── sub-READ1010_ses-T1_dir-PA_run-04_epi.nii.gz
    │   ├── sub-READ1010_ses-T1_dir-PA_run-05_epi.json
    │   ├── sub-READ1010_ses-T1_dir-PA_run-05_epi.nii.gz
    │   ├── sub-READ1010_ses-T1_dir-PA_run-06_epi.json
    │   └── sub-READ1010_ses-T1_dir-PA_run-06_epi.nii.gz
    └── func
        ├── sub-READ1010_ses-T1_task-AM_bold.json
        ├── sub-READ1010_ses-T1_task-AM_bold.nii.gz
        ├── sub-READ1010_ses-T1_task-EF_bold.json
        ├── sub-READ1010_ses-T1_task-EF_bold.nii.gz
        ├── sub-READ1010_ses-T1_task-PSR_bold.json
        ├── sub-READ1010_ses-T1_task-PSR_bold.nii.gz
        ├── sub-READ1010_ses-T1_task-VM_bold.json
        └── sub-READ1010_ses-T1_task-VM_bold.nii.gz

@arnaudbore
Copy link
Contributor Author

Some feedback:

  1. I like the new IntendedFor / id system

Great feature indeed. Glad you like it! It makes everything easier especially for our users.

  1. Auto extraction of direction worked on my fmaps, but it would be nice to also add dir-<> labels to BOLD and DWI, which did not happen automatically in my tests

Check the documentation I give more information about this auto_extract_entities new feature. If you check the BIDS specification dir is only mandatory for fmaps.

  1. When I auto-extracted features, the acq-<> label I manually specified seemed to have gotten ignored. I don’t know if this was intentional or not, but it would be nice if one can manually override auto-extraction (e.g., auto-extract direction, but manually add the acq label)

Now it works the way it is suppose to work. :)

  1. I was not able to test the auto extraction of task names because our files did not fit the regex naming convention, but it looks like a nice feature

It seems to work well on my side and I hope it will start some talks with MRI technologists.

  1. Is there a way I can look at the a rendered documentation page for the development branch?

You can compile the documentation locally using this command line: portray as_html

@smeisler
Copy link
Collaborator

Check the documentation I give more information about this auto_extract_entities new feature. If you check the BIDS specification dir is only mandatory for fmaps.

Still, especially for those who collect reverse phase-encoded fmaps, having this information in the filenames (which is not-required but is still BIDS-valid for DWI/BOLD) could be helpful.

Now it works the way it is suppose to work. :)

Re-pulled the branch and retested - Indeed it does work!

I don't think I will have time to review the documentation before you plan to merge, but I would be happy to give feedback on that later. Great work!

@arnaudbore
Copy link
Contributor Author

Check the documentation I give more information about this auto_extract_entities new feature. If you check the BIDS specification dir is only mandatory for fmaps.

Still, especially for those who collect reverse phase-encoded fmaps, having this information in the filenames (which is not-required but is still BIDS-valid for DWI/BOLD) could be helpful.

I agree and people can easily make it work for dwi and bold if needed. I'll see that in the documentation.

Now it works the way it is suppose to work. :)

Re-pulled the branch and retested - Indeed it does work!

I don't think I will have time to review the documentation before you plan to merge, but I would be happy to give feedback on that later. Great work!

Thank you! 🎉

@arnaudbore arnaudbore merged commit 86f89e3 into UNFmontreal:master Jun 22, 2023
@arnaudbore arnaudbore deleted the enh_custom_labels branch July 3, 2023 22:15
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.

3 participants