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 Center および File ExchangeMRI についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by