How to multiply 3d-arrays without image processing toolbox

조회 수: 3 (최근 30일)
Gülizar Kaya
Gülizar Kaya 2018년 4월 24일
댓글: Gülizar Kaya 2018년 4월 25일
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.

답변 (1개)

Ahmet Cecen
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.
  댓글 수: 1
Gülizar Kaya
Gülizar Kaya 2018년 4월 25일
The image with the highest resolution is binary and in 3D. The mask is not binary, but also in 3D. I need to get the dimensions of both equal, because I am trying to obtain an exact location of the object within my binary image. The mask is made out of numbers indicating certain locations. If I am able to multiply the images, the new array will indicate the location of the object within the mask.
I have no idea how I have to use the nearest interpolation method. Can you please explain it more specifically. I am pretty new into coding.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 MRI에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by