Reading NIfTI rescale slope/inter in medicalVolume

Hi, I am wondering if it is a bug or something with the newly released medical imaging toolbox of version 2022b.
Problem:
I was given a NIfTI file of a parametric imaging. The data format is (signed) int16. There is a rescale slope/interception parameter in the NIfTI header (`raw.scl_slope`/`raw.scl_inter`). I want to read the matrix into a medical volume:
Vol = medicalVolume("%NIfTI_file.nii%")
However, `Vol.Voxels` is a matrix of int16, without applying the rescale parameters.
Expected outcome:
It should be able to do any of the following things:
  • Directly apply the rescaling;
  • Provide an argument to specify the type of output (`raw` vs `rescaled`);
  • Provide the rescaling information in the `medicalVolume` object that it produces.
Workaround:
Use the traditional `niftiread()` and `niftiinfo()` functions.
n = niftiread("%NIfTI_file.nii%");
n_info = niftiinfo("%NIfTI_file.nii%")
image = n_info.raw.scl_slope*double(n)+n_info.raw.scl_inter;
Question:
Is it a problem with the Medical Imaging Toolbox, or I was not correctly using is? Is there a workaround within the toolbox?
Thank you!

Answers (1)

Based on the provided description, it appears that you expect the "medicalVolume" function to load NifTi data while internally applying rescaling if it is available.
As per the documentation, the "medicalVolume" function has rescaling functionality specifically for DICOM images. The provided link below confirms this.
Consequently, when loading NifTi data using "medicalVolume," rescaling is not applied.
The Medical Imaging Toolbox provides functions such as” niftiread()” and “ niftiinfo()” specifically designed for reading NifTi files and extracting metadata. The workaround you suggested is indeed the most suitable approach for handling rescaling within your implementation.
Hope the information helps you with the issue.

Categories

Products

Release

R2022b

Asked:

on 20 Oct 2022

Answered:

on 27 Sep 2023

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!