How can I reslice a 3D matrix obtained from CT data to convert anisotropic voxels into isotropic voxels?

6 views (last 30 days)
I have a 3D matrix (.mat file) obtained from a CT data. The CT data has anisotropic voxels and has dimensions of 0.415mm x 0.415mm x 0.833 mm. (i.e., Pixel size in xy plane is 0.415 mm; slice increment and slice thickness are 0.833mm). I need the final voxels to be isotropic and have the dimensions 0.415mm x 0.415mm x 0.415mm. Is there a function in Matlab which allows to reslice the matrix?
I really appreciate any help or suggestion.
Best,
Srujan

Answers (1)

Sachin Lodhi
Sachin Lodhi on 20 Dec 2023
Hi Srujan,
In MATLAB, the ‘imresize3’ function from the Image Processing Toolbox can be utilized to modify a 3D matrix, creating isotropic voxels by adjusting the scale of the volume across its dimensions.
With the initial voxel dimensions set at 0.415mm x 0.415mm x 0.833mm, and the target voxel size at 0.415mm x 0.415mm x 0.415mm, we need to rescale the z-dimension of the matrix by a factor derived from the ratio 0.415/0.833. This rescaling will ensure that the voxels dimensions are 0.415mm x 0.415mm x 0.415mm.
Here's an example code to achieve this:
% Load the 3D matrix from the .mat file
load('yourCTdata.mat'); % Replace 'yourCTdata.mat' with the actual filename
% Assume the variable in the .mat file is called 'ctData'
originalVoxelSize = [0.415, 0.415, 0.833]; % in mm
desiredVoxelSize = [0.415, 0.415, 0.415]; % in mm
% Calculate the resampling factor for the z-dimension
zResampleFactor = desiredVoxelSize(3) / originalVoxelSize(3);
% Resample the 3D matrix to achieve isotropic voxels
resampledCTData = imresize3(ctData, [1, 1, zResampleFactor]);
Please refer to the following MATLAB documentation page for more information on ‘imresize3’ function : https://www.mathworks.com/help/images/ref/imresize3.html#d126e185217
I hope this helps.
Best Regards,
Sachin

Community Treasure Hunt

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

Start Hunting!