Skip to content

AFNI and mixed datatypes #338

@neurolabusc

Description

@neurolabusc

For historical reasons, AFNI natively supports the datatype signed SHORT (INT16, -32768..32767) and FLOAT (SINGLE32). This matches original 12-bit MRI ADC (0..4095) and the Analyze format datatypes. In contrast, NIfTI includes additional datatypes including Unsigned SHORT (UINT16, 0..65535). Likewise, modern scanners use 16-bit ADC that can also generate unsigned shorts.

By default, dcm2niix will convert a 16-bit DICOM series to INT16 raw intensity of the voxels is in the range -32768..32767, but uses UINT16 if any voxels exceed 32767. This ensures lossless data conversion while supporting the historically more popular INT16 when possible.

However, there was an unintended consequence of this decision. Consider an fMRI study where each individual completes more than one run of the tasks. In this case, one series might be saved as INT16 while the other might be saved as UINT16. Since AFNI does not natively support UINT16, AFNI's 3dcalc will convert that run to FLOAT (requiring twice the disk space) while retaining the INT16 datatype for the other run. While AFNI can process each run, it seems that some AFNI tools such as 3dDeconvolve are unable to hand mixed datatypes and generate stats images that are gibberish (see attached).

Hopefully, AFNI can be extended to support mixed data types. In the meantime, AFNI users may consider the following:
1.) Choose -datum float when using 3dcalc. This will force INT16 data to be saved as FLOAT32. While this doubles the disk space, it will avoid this problem.
2.) One can run the developmental branch of dcm2niix can be built (Unix commands below). The new option -l o will retain the original datatype of the DICOM images, thus DICOM UINT16 data will always be saved as UINT16 regardless of the voxel range. AFNI's 3dcalc always convert UINT16 to float . While this doubles the disk space, it will avoid this problem.

git clone --branch development https://github.com/rordenlab/dcm2niix.git
cd dcm2niix/console
make

Stats

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions