brainlife / validator-neuro-anat

Brain Life Datatype validator for neuro/anat
0 stars 1 forks source link

some t1w image not validating #4

Open soichih opened 6 years ago

soichih commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

@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.