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

[BUG] nibabel 5.3.0 breaks dcmmeta.py #94

Closed
bpinsard opened this issue Oct 15, 2024 · 4 comments
Closed

[BUG] nibabel 5.3.0 breaks dcmmeta.py #94

bpinsard opened this issue Oct 15, 2024 · 4 comments

Comments

@bpinsard
Copy link

Seems like changes here nipy/nibabel#1336 broke dcmstack dcmmeta.make_empty (FYI: @effigies ), which in turns causes heudiconv to fail too @yarikoptic as can be seen in recent PRs ( eg. nipy/heudiconv#791 ).

As dcmstack do not seem to pin specific version of nibabel as reqs, any fresh install is likely to trigger that bug.

    @classmethod
    def make_empty(klass, shape, affine, reorient_transform=None,
                   slice_dim=None):
        '''Make an empty DcmMetaExtension.
    
        Parameters
        ----------
        shape : tuple
            The shape of the data associated with this extension.
    
        affine : array
            The RAS affine for the data associated with this extension.
    
        reorient_transform : array
            The transformation matrix representing any reorientation of the
            data array.
    
        slice_dim : int
            The index of the slice dimension for the data associated with this
            extension
    
        Returns
        -------
        result : DcmMetaExtension
            An empty DcmMetaExtension with the required values set to the
            given arguments.
    
        '''
        result = klass(dcm_meta_ecode, '{}')
>       result._content['global'] = OrderedDict()
E       TypeError: 'str' object does not support item assignment

@effigies
Copy link

I think if you use self.get_content() instead of self._content throughout this class, then you should be able to continue as you were. I didn't really expect people to depend on the underscored variable and aimed to keep the public functions constant.

I could also cut a bug-fix release where I switch ._content back to the unmangled object and use some other private variable to refer to the byte serialization.

@effigies
Copy link

@bpinsard Could you try patching in nipy/nibabel#1378 and seeing if that resolves your issue?

@bpinsard
Copy link
Author

All dcmstack tests are green with nibabel from that branch.

@bpinsard
Copy link
Author

heudiconv tests are back to green too.

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

No branches or pull requests

2 participants