Hello.
I have two 3D matrix of binary images loaded in matlab named ORIG and PORE. I have two 3D matrix of 16 images named ORIG(300x300x16) and PORE(300x300x16). I was wondering how can I extract sum of images in those two 3D matrix. I wanted to do the sum from the each of the coresponding images (first from ORIG matrix compared to first from PORE matrix, second from ORIG matrix compared to second from PORE matrix, etc.) from both matrix and to put them in a new (16x1) variable where I will have all the values as a result of sum computations of those two matrix. I have a code that I wrote for the comparison of two single images and it works fine. But now i want to try and do it for a whole batch of images (16 of them), since that will reduce time and manual labour.
Here is the snipet of my code that I have done so far. The problem lies somewhere here:
TargetImg=ORIG;
TestImg=PORE;
[u, v, q]=size(TargetImg);
TargetMask = logical(TargetImg);
NotTargetMask = logical(1-TargetMask);
TestMask= logical(TestImg);
FPimg = TestMask.*NotTargetMask;
FP=zeros(q,1);
for i=1:q
FP(q,1) = sum(FPimg(:));
end
The problem that I have here is that FP returns (I think) the sum of all FPimg matrix(sum of all 16 images) as all values inside this FP variable.
FP=[24253 24253 24253 24253 24253....
And I need it to return sum of each two images compared from both matrix ORIG and PORE. I do not know how to perform this and I'm strugling with it.
I hope that I explained it clearly for everybody to understand.
Thanks in advance!