Why do I get the error message with "more non-singleton rhs dimensions"?

1 view (last 30 days)
So I have this loop that works very well and fills comp with differences between images BW_vtk and BW_groundtruth. They are both 448x448x80 logical.
for k = 1:size(BW_vtk,3)
comp(:,:,k) = imfuse(BW_vtk(:,:,k), BW_groundtruth(:,:,k),'diff');
end
If I change it to this:
for k = 1:size(BW_vtk,3)
comp(:,:,k) = imfuse(BW_vtk(:,:,k), BW_groundtruth(:,:,k),'falsecolor');
end
I get the error message: Assignment has more non-singleton rhs dimensions than non-singleton subscripts
I don't understand why. It would be much nicer in falscolor. How can I fix it?

Accepted Answer

dpb
dpb on 31 Oct 2018
comp=imfuse(BW_vtk, BW_groundtruth,'falsecolor');
Method 'diff' returns a single value the difference so can be applied on a plane-by-plane basis but 'falsecolor' returns a RGB image which is three planes so can't store all three planes in a single plane; just work on the image as a whole.
  1 Comment
Petr Vorel
Petr Vorel on 1 Nov 2018
Edited: Petr Vorel on 1 Nov 2018
Thank you. I guess this answers my question but it produces another problem. The input to 'falsecolor' has to be either MxN och MxNx3 array and the output is MxNx3. So it seems it won't work anyway.

Sign in to comment.

More Answers (0)

Tags

Products


Release

R2017b

Community Treasure Hunt

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

Start Hunting!