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

Filter target tractograms depending on the provided anatomy file #57

Open
2 tasks
jhlegarreta opened this issue Apr 4, 2023 · 3 comments · May be fixed by #58
Open
2 tasks

Filter target tractograms depending on the provided anatomy file #57

jhlegarreta opened this issue Apr 4, 2023 · 3 comments · May be fixed by #58
Assignees
Labels
area:scripts Items affecting the scripts module type:enhancement New feature or request

Comments

@jhlegarreta
Copy link
Contributor

A user reported that when using the downloaded RBx atlas and some custom target (test) dataset, the ae_bundle_streamlines.py script failed with the following output:

Namespace(anatomy_file='/root/tractolearn_data/rbx_atlas_v10.json',
atlas_path='/root/tractolearn_data/atlas/pop_average', batch_loading=None,
common_space_reference='/testdata/subj01/T1.nii.gz',
common_space_tractogram='/testdata/subj02/tracts100k.trk', device='cpu',
model='/root/tractolearn_data/best_model_contrastive_tractoinferno_hcp.pt',
num_neighbors=1, original_reference=None,
original_tractogram=None, output='test', overwrite=True,
thresholds_file='/root/tractolearn_data/thresholds_contrastive_tractoinferno_hcp.json', verbose=False)
INFO:root:Loading atlas files ...
  0%|                   
| 0/52 [00:00<?, ?it/s]
Traceback (most recent call last):
  File "/usr/local/bin/ae_bundle_streamlines", line 8, in <module>
    sys.exit(ae_bundle_streamlines.main())
  File "/tractolearn/scripts/ae_bundle_streamlines.py", line 397, in main
    assert (
AssertionError: [!] Threshold: fornix_group not in threshold file

The issue stems from the fact that when looping over the atlas path files in the script, there is a fornix_group.trk that is being found in the /atlas/pop_average RBx path, and such tractogram does not correspond to any entry in the JSON anatomy config file (or any other config file provided in zenodo actually). The RBx atlas path contains some "*_group.trk" files that are the concatenation of some other files, and we are not interested in considering those in tractolearn, at least within the context of the provided data in zenodo.

Thus, we should

  • Make sure that all config files involved in a process contain all the bundles indicated in the anatomy file. It could be a pre-check utils method that can be re-used across scripts.
  • As we are expecting for exact filename matches with the anatomy config file, we could filter any other file present in a given folder and, inform the user about the presence of other files in the atlas folder that do not correspond to the bundle names in the anatomy config files. Requiring that the folder only contains the bundles of interest and failing otherwise may be another option; however, since the contents of a given path may come from another process unrelated to tractolearn it may not be desirable to force users to remove such files from the path.
@jhlegarreta jhlegarreta added area:scripts Items affecting the scripts module type:enhancement New feature or request labels Apr 4, 2023
@jhlegarreta jhlegarreta self-assigned this Apr 4, 2023
@jhlegarreta
Copy link
Contributor Author

@fdumais any thought/preference?

@fdumais
Copy link

fdumais commented Apr 4, 2023

@jhlegarreta Yes, we should filter config and track group from RBx atlas that are not in our config
e.g. all config_group.json, all track group, we also need to remove CG sub part and replace it by the whole CG

This could be done when loading files based on 1 master config

@jhlegarreta
Copy link
Contributor Author

@jhlegarreta Yes, we should filter config and track group from RBx atlas that are not in our config
e.g. all config_group.json, all track group, we also need to remove CG sub part and replace it by the whole CG

This could be done when loading files based on 1 master config

Will propose a PR when I find the time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:scripts Items affecting the scripts module type:enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants