-
Notifications
You must be signed in to change notification settings - Fork 262
numpy.AxisError: axis 1 is out of bounds for array of dimension 1 #1245
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
Comments
Looks like this was added in #439. Unfortunately, I don't know anything about this code. Do you have a proposal? Possibly @moloney or @ZviBaratz would have some insight here. |
cc also @matthew-brett who is at least more versed in DICOM than I. |
Sample tracew DICOMs were collected and available now at http://datasets.datalad.org/?dir=/dicoms/dartmouth-phantoms/Siemens-DWITrace-20230803 . But upon quick try with |
@effigies what could/should we do about this issue ? unfortunately people keep running into it... could we may be just safeguard the |
It would be nice if we could actually get our hands on erroring data, because I don't have any context for what this looks like under expected and erroring cases, so it's hard to know what the right thing to do is. nibabel/nibabel/nicom/dicomwrappers.py Lines 542 to 546 in 5d884bd
Maybe it would make sense to use: if stackid_tag in dim_seq:
stackid_dim_idx = dim_seq.index(stackid_tag)
dim_seq.pop(stackid_dim_idx)
if len(frame_indices.shape) > 1:
frame_indices = np.delete(frame_indices, stackid_dim_idx, axis=1)
else:
msg = (
f'Cannot remove dimension {stackid_dim_idx} from frame_indices (shape: {frame_indices.shape}).\n'
'Please report this at https://github.com/nipy/nibabel/issues and reference issue gh-1245'
)
warnings.warn(msg) That way we can get a sense of what things look like when this is hit. I'm not sure if we have example data that hits this, but we can look for that once we have something to compare it to. |
re sample -- I did find one. I believe it is |
Okay, at least in that case Do we know if this is a bug to work around, or a particular interpretation of the standard that occurs in well-defined circumstances? |
It looks like the bug was actually introduced in #795. That was aimed at Philips DICOMs, but causing errors on Siemens XA30 DICOMs. @mgxd Do you remember much about the details of that one? The XA30 image has 39 ISOTROPIC frames, which are getting dropped by: nibabel/nibabel/nicom/dicomwrappers.py Lines 509 to 516 in 5d884bd
|
Should we just skip doing that on non-Philips DICOMs and be done? |
I guess. Sorry, the details of this one won't stay in my head for more than about 20 minutes after I stop looking at it. I have a branch where I pulled in Chris' QA repository for testing. I can write the test if one of you can suggest a patch? |
I know it's low priority, but if this could patched in the next release it would be greatly appreciated. The Siemens Prisma OS upgrades are changing to this standard. |
I think I have a fix. Please give it a test:
|
Thank you, I can confirm this fix solves the issue. |
originally appeared in
numpy.AxisError: axis 1 is out of bounds for array of dimension 1
heudiconv#670with traceback
so it feels that may be hardcoded
axis=1
should be "reconsidered" there?The text was updated successfully, but these errors were encountered: