sina-mansour / UKB-connectomics

This repository will host scripts used to map structural and functional brain connectivity matrices for the UK biobank dataset.
https://www.biorxiv.org/content/10.1101/2023.03.10.532036v1
62 stars 7 forks source link

Strange multiplier in combined atlases #27

Closed sina-mansour closed 2 years ago

sina-mansour commented 2 years ago

The original atlases (both cortical and subcortical) are stored without any intensity scaling (multiplier of 1):

$ mrinfo /home/sina/Documents/Research/Datasets/UK_biobank/sample/1000243_2_0/dMRI/dMRI/atlases/native.dMRI_space.Tian_Subcortex_S4_3T.nii.gz
************************************************
Image name:          "/home/sina/Documents/Research/Datasets/UK_biobank/sample/1000243_2_0/dMRI/dMRI/atlases/native.dMRI_space.Tian_Subcortex_S4_3T.nii.gz"
************************************************
  Dimensions:        256 x 256 x 256
  Voxel size:        1 x 1 x 1
  Data strides:      [ 1 2 3 ]
  Format:            NIfTI-1.1 (GZip compressed)
  Data type:         unsigned 32 bit integer (little endian)
  Intensity scaling: offset = 0, multiplier = 1
  Transform:               0.9998    -0.02077    0.001549      -120.5
                          0.02079      0.9996    -0.02094      -151.6
                        -0.001113     0.02097      0.9998      -146.7
  comments:          6.0.4:ddd0a010
  mrtrix_version:    3.0.3-49-g99449855

However, the combined atlases generated from our python script contain a strange multiplier for scaling the NIFTI image:

$ mrinfo /home/sina/Documents/Research/Datasets/UK_biobank/sample/1000243_2_0/dMRI/dMRI/atlases/combinations/native.dMRI_space.aparc.a2009s+Tian_Subcortex_S1_3T.nii.gz
************************************************
Image name:          "/home/sina/Documents/Research/Datasets/UK_biobank/sample/1000243_2_0/dMRI/dMRI/atlases/combinations/native.dMRI_space.aparc.a2009s+Tian_Subcortex_S1_3T.nii.gz"
************************************************
  Dimensions:        256 x 256 x 256
  Voxel size:        1 x 1 x 1
  Data strides:      [ 1 2 3 ]
  Format:            NIfTI-1.1 (GZip compressed)
  Data type:         unsigned 32 bit integer (little endian)
  Intensity scaling: offset = 0, multiplier = 3.8184229111948298e-08
  Transform:               0.9998    -0.02077    0.001549      -120.5
                          0.02079      0.9996    -0.02094      -151.6
                        -0.001113     0.02097      0.9998      -146.7
  comments:          transform modifie
  mrtrix_version:    3.0.3-49-g99449855

This is unnecessary and may confuse future users. I'll look into the python scripts to resolve the issue.

sina-mansour commented 2 years ago

Update: This is most likely due to Nibabel's default saving procedure trying to optimize the intensity scaling values for optimal precision. (see https://nipy.org/nibabel/nifti_images.html#data-scaling)

I'll add an explicit offset of zero and a multiplier of one to avoid this unwanted change.