Non-singleton dimensions of the two input arrays must match each other.
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Stelios Fanourakis
el 27 de Mzo. de 2018
Comentada: Stelios Fanourakis
el 28 de Mzo. de 2018
I cannot understand what's the problem. This code works for other jpg images but for my dicom stack of images it comes up with an error (see subject line), to the _Background_blending = bsxfun(@times, Background, bsxfun(@minus,1,alpha)); line. PLease Help. Thanks!
Foreground = im2double(mask)*350-50;
Background = im2double(I);
% build alpha layer for Foreground
alpha = bsxfun(@times, ones(size(Foreground,1), size(Foreground,2)), .6);
figure(3)
imshow(alpha)
% find a scale dynamically with some limit
Foreground_min = min( min(Foreground(:)), -50 );
Foreground_max = max( max(Foreground(:)), 300 );
% overlay the image by blending
Background_blending = bsxfun(@times, Background, bsxfun(@minus,1,alpha));
0 comentarios
Respuesta aceptada
Walter Roberson
el 27 de Mzo. de 2018
Your code overuses bsxfun. You only need at most one bsxfun call.
Your code probably reduces down to
Background_blending = Background .* (1-0.6);
Anyhow, your bug is in assuming that mask and "I" have the same number of rows and columns (but possibly different numbers of planes).
4 comentarios
Walter Roberson
el 27 de Mzo. de 2018
Yes, what I said about mask and "I" having different numbers of rows and columns really is my answer to your earlier problem. The fact that it worked on some jpeg images does not tell us anything useful, because we do not know that the jpeg images had the same number of rows and columns as the dicom images, and we have no information about the size of mask or the size of "I". If you had posted more complete code we might have been able to tell you why the sizes were not the same.
Más respuestas (0)
Ver también
Categorías
Más información sobre 3-D Volumetric Image Processing en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!