Skip to content

Conversation

@gagnonanthony
Copy link
Member

Quick description

Reference was set to 'same' only if the input tractogram was a .trk, which made the following saving function fail. Simply added the .h5 in the extension possibilities.

Type of change

Check the relevant options.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Provide data, screenshots, command line to test (if relevant)

error message:

DEBUG:root:Loading tractogram from /var/folders/23/p0fh1nrd473dtfz3cx_4g0j00000gn/T/tmpvd14_zqp/tractogram.trk with reference None.
Traceback (most recent call last):
  File "/Users/anthonygagnon/envs/scilus3.12/bin/scil_tractogram_commit", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/Users/anthonygagnon/code/scilpy/src/scilpy/cli/scil_tractogram_commit.py", line 487, in main
    _save_results(args, tmp_dir, ext, hdf5_file, offsets_list,
  File "/Users/anthonygagnon/code/scilpy/src/scilpy/cli/scil_tractogram_commit.py", line 247, in _save_results
    sft = load_tractogram(args.in_tractogram, args.reference)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/anthonygagnon/envs/scilus3.12/lib/python3.12/site-packages/dipy/testing/decorators.py", line 201, in wrapper
    return convert_positional_to_keyword(func, args, kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/anthonygagnon/envs/scilus3.12/lib/python3.12/site-packages/dipy/testing/decorators.py", line 192, in convert_positional_to_keyword
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/Users/anthonygagnon/envs/scilus3.12/lib/python3.12/site-packages/dipy/io/streamline.py", line 154, in load_tractogram
    if not is_header_compatible(filename, reference):
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/anthonygagnon/envs/scilus3.12/lib/python3.12/site-packages/dipy/io/utils.py", line 376, in is_header_compatible
    affine_2, dimensions_2, voxel_sizes_2, voxel_order_2 = get_reference_info(
                                                           ^^^^^^^^^^^^^^^^^^^
  File "/Users/anthonygagnon/envs/scilus3.12/lib/python3.12/site-packages/dipy/io/utils.py", line 345, in get_reference_info
    raise TypeError("Input reference is not one of the supported format")
TypeError: Input reference is not one of the supported format

Checklist

  • My code follows the style guidelines of this project (run autopep8)
  • I added relevant citations to scripts, modules and functions docstrings and descriptions
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I moved all functions from the script file (except the argparser and main) to scilpy modules
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

@AntoineTheb
Copy link
Contributor

Does the .h5 have its own reference ? We commit omit one for TRKs as they include the ref's affine in their header. What about these .h5 ?

@AntoineTheb
Copy link
Contributor

Also a duplicate of #1279 ?

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.

2 participants