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

Possible error with ASLCONTEXT_TSV_NOT_CONSISTENT #1657

Closed
witherscp opened this issue Apr 12, 2023 · 2 comments
Closed

Possible error with ASLCONTEXT_TSV_NOT_CONSISTENT #1657

witherscp opened this issue Apr 12, 2023 · 2 comments

Comments

@witherscp
Copy link

Hi,

I have used dcm2niix to convert my ASL data collected with a 3T GE Discovery 750 scanner from dicom to BIDS format. As has been previously explained, the GE ASL sequences are unusual in that there is a deltam sequence computed in k-space and a m0scan. Both of these sequences are present within the same folder of dcm files. After running dcm2niix, I used bids-validator to ensure that the outputs were correct, but I encountered the same problem that other users have experienced. Can we possibly resolve the source of this problem?

With my example dataset, I ran nifti_tool -disp_hdr -infiles sub-p260_ses-research_asl.nii.gz. This is the output:

N-1 header file 'sub-p260_ses-research_asl.nii.gz', num_fields = 43

all fields:
  name                offset  nvals  values
  ------------------- ------  -----  ------
  sizeof_hdr             0      1    348
  data_type              4     10    
  db_name               14     18    
  extents               32      1    0
  session_error         36      1    0
  regular               38      1    r
  dim_info              39      1    57
  dim                   40      8    3 128 128 40 1 1 1 1
  intent_p1             56      1    0.0
  intent_p2             60      1    0.0
  intent_p3             64      1    0.0
  intent_code           68      1    0
  datatype              70      1    4
  bitpix                72      1    16
  slice_start           74      1    0
  pixdim                76      8    1.0 1.7266 1.7266 3.0 4.705 0.0 0.0 0.0
  vox_offset           108      1    352.0
  scl_slope            112      1    1.0
  scl_inter            116      1    0.0
  slice_end            120      1    0
  slice_code           122      1    0
  xyzt_units           123      1    10
  cal_max              124      1    0.0
  cal_min              128      1    0.0
  slice_duration       132      1    0.0
  toffset              136      1    0.0
  glmax                140      1    0
  glmin                144      1    0
  descrip              148     80    TE=11;Time=160846.000
  aux_file             228     24    
  qform_code           252      1    1
  sform_code           254      1    1
  quatern_b            256      1    0.0
  quatern_c            260      1    0.0
  quatern_d            264      1    0.0
  qoffset_x            268      1    -112.38221
  qoffset_y            272      1    -89.158218
  qoffset_z            276      1    -56.318401
  srow_x               280      4    1.7266 0.0 0.0 -112.38221
  srow_y               296      4    0.0 1.7266 0.0 -89.158218
  srow_z               312      4    0.0 0.0 3.0 -56.318401
  intent_name          328     16    
  magic                344      4    n+1

My aslcontext.tsv file looks like this:

volume_type
deltam

I notice a few things. First of all, there are three dimensions and the fourth one is set to 1. This means that there shouldn't be an error of a mismatch between dim[4] and the number of rows in the tsv file. Something weird seems to be going on though because the fourth pixdim is 4.705. I tried using fslchpixdim sub-p260_ses-research_asl.nii.gz 1.726600 1.726600 3 0 to change the fourth pixel dimension to 0 manually, but this did not resolve the error.

Do you have any suggestions?

Thanks!
Price

@effigies
Copy link
Collaborator

If I'm reading this and the linked threads correctly, this is a 4D _asl file with a single volume. In which case dim[0] should be 4, not 3. That would be consistent with pixdim[4] having a non-trivial value, and should then allow you to compare the 4th entry in the shape tuple with the length of your volume_type column.

There's probably an easy command-line tool to reshape a data array, but you could do something like this in Python:

import nibabel as nb
img = nb.load(in_fname)
print(img.shape)  # (128, 128, 40)
reshaped = img.slicer[:, :, :, None]
print(img.shape)  # (128, 128, 40, 1)
reshaped.to_filename(out_fname)

@witherscp
Copy link
Author

This fixed it! Thanks so much for the help.

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