How to multiply 3d-arrays without image processing toolbox
3 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
回答 (1 件)
Ahmet Cecen
2018 年 4 月 24 日
Don't resize the Image, resize the Mask. I am assuming the Mask is 0/1 binary, so use nearest neighbor interpolation method.
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!