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

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

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

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)

Categories

Products

Release

R2017b

Tags

Asked:

on 31 Oct 2018

Edited:

on 1 Nov 2018

Community Treasure Hunt

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

Start Hunting!