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

some t1w image not validating #4

Open
soichih opened this issue May 14, 2018 · 6 comments
Open

some t1w image not validating #4

soichih opened this issue May 14, 2018 · 6 comments

Comments

@soichih
Copy link
Contributor

soichih commented May 14, 2018

A user informed me that this validator is failing with his t1w image that he is trying to upload.

Nibabel gives following output for this input. Please note the dim is not right..

<class 'nibabel.nifti1.Nifti1Header'> object, endian='>'
sizeof_hdr      : 348
data_type       : 
db_name         : 3107
extents         : 16384
session_error   : -1
regular         : r
dim_info        : 0
dim             : [  4 176 240 256   1   0   0   0]

But, mrinfo shows following dimensions

 Format:            NIfTI-1.1
 Dimensions:        176 x 240 x 256 x 1
 Voxel size:        1 x 1 x 1 x 0

I can open this image just fine with fslview, freeview, etc..

@aarya22 @skoudoro do you know what could be going wrong with this?

@aarya22
Copy link
Contributor

aarya22 commented May 14, 2018

Do you know what error message they are getting?

I think the error could be in 47-49:

    dims = img.header['dim'][0]
    if dims != 3:
        results['errors'].append("input should be 3D but has " + str(dims))

Not sure how to fix this, I thought the dimensions were supposed to be 3?

@soichih
Copy link
Contributor Author

soichih commented May 15, 2018

Yes, that's the message user is seeing.

error_t1

According to mrinfo, it is 3D, but nibabel doesn't think so.. (I am guessing?)

@skoudoro
Copy link

  • do we know Nibabel version? maybe this reading problem has been fixed already?
  • is this problem appears on many t1 or just this one?

Otherwise, a workaround to get the dimensions is to replace dims = img.header['dim'][0] by dims = img.get_data().ndim or dims = len(img.get_data().shape)

@soichih
Copy link
Contributor Author

soichih commented May 15, 2018

I am seeing this issue with nibabel 2.2.1 (the latest via pip).

Most other t1 shows something like this.

dim : [ 3 260 311 260 1 1 1 1]

The workaround didn't work with the problem dataset.

i.get_data().ndim
4
i.get_data().shape
(176, 240, 256, 1)

Maybe we can just count dimensions with >1?

Now, even if we can just patch around this issue, I am not sure if the problem dataset is actually a valid T1 (will it break some App?)

@skoudoro
Copy link

Thank you for all this info.

Maybe we can just count dimensions with >1?

I think we should avoid doing that

Now, even if we can just patch around this issue, I am not sure if the problem dataset is actually a valid T1 (will it break some App?)

Agree with that point. we should test this dataset with other apps. if it breaks them too, we assume it is not a valid dataset. Otherwise, we can be less strict with the test by doing
if i.get_data().ndim < 3:

@soichih
Copy link
Contributor Author

soichih commented May 15, 2018

@bcmcpher Have you seen an issue like this? The user mentions that he downloaded the dataset from LONI / PPMI. I don't have access to it.

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

3 participants