How to multiply 3d-arrays without image processing toolbox
3 views (last 30 days)
Show older comments
Dear experts, I need to calculate an overlap between a binary 3D image (mri segment in .nii format) and a mask in MNI space (.nii) with the following dimensions (51, 75, 55). For this, I need to multiply both arrays with each other. Because the dimensions of my original 3D image were larger (153, 225, 165) than that of the mask, I needed to resize the 3D image first to get the same dimensions (51, 75, 55). I don't have an image processing toolbox within MATLAB, so I resized my original image with a for loop, as follows:
seg = spm_read_vols(spm_vol('/somedir/xxx/wseg.nii')); %the original 3D segmentation
for j=1:55 seg2(:,:,j)=imresize(seg(:,:,j),[51 75]); end
When I do this, I seem to loose information, as the total sum of my new array (seg2) becomes zero, while that of seg is not. I am searching for a solution for this problem. Thank you in advance.
0 Comments
Answers (1)
Ahmet Cecen
on 24 Apr 2018
Don't resize the Image, resize the Mask. I am assuming the Mask is 0/1 binary, so use nearest neighbor interpolation method.
See Also
Categories
Find more on MRI in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!