- gs_plane   and   gs_multiple_plane   are they the same function?
- What release of Matlab?
- "I defined Inten."   What value did you assign to   Inten ?
- "how to fix "Enter input arguments by typing them now?""   How does that question relate to   Error in gs_plane (line 46) ?
how to fix "Enter input arguments by typing them now?"
12 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I want to use this public code,but when I run the code I have this message:
Error in gs_plane (line 46)
[n,m,~] = size(Inten);.
I defined Inten. How can I fix it?
% Inputs:
% - Inten: Stack of intensity images
% - I0_idx: center image plane index in stack
% - zvec: vector indicating z values for images in stack
% - num_imgs: number of images to use on either side of the center plane
% - ps: pixel size
% - lambda: wavelength
% - N: number of loops to perform
%
% Outputs:
% - phi: phase matrix corresponding to intensity at center plane
% recovered by the algorithm
%
% Notes:
% - INPUT IMAGES [I0, I1, I2] MUST OF EQUAL SIZE.
% - The units for ps, lambda, and dz MUST BE CONSISTENT.
% - dz is the distance between I0 and I1, should be the negative of the
% distance from I0 and I2
%
% Laura Waller, Gautam Gunjala, July 2014
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [ phi ] = gs_multiple_plane( Inten, I0_idx, zvec, num_imgs, ps, lambda, N )
%
[n,m,~] = size(Inten);
E0_est = sqrt(Inten(:,:,I0_idx)).*exp(1i*zeros(n,m));
%
for iternum = 1:N
%
% Propagate forward and replace with measured intensity
prop = propagate(E0_est, lambda, zvec(I0_idx+1:I0_idx+num_imgs), ps);
prop = sqrt(Inten(:,:,I0_idx+1:I0_idx+num_imgs)).*exp(1i*angle(prop));
%
% Propagate all planes back to center
for i = 1: num_imgs
prop(:,:,i) = angle(propagate(prop(:,:,i),lambda, ...
-1*zvec(I0_idx+i),ps));
end
%
% Replace with center plane intensity
E0_est = sqrt(Inten(:,:,I0_idx)).*exp(1i*mean(prop,3));
%
% Flip stack for negative propagation
stk_temp = flipdim(Inten(:,:,I0_idx-num_imgs:I0_idx-1),3);
z_temp = flip(zvec(I0_idx-num_imgs:I0_idx-1));
%
% Propagate backward and replace with measured intensity
prop = propagate(E0_est, lambda, z_temp, ps);
prop = sqrt(stk_temp).*exp(1i*angle(prop));
%
% Propagate all planes back to center
for i = 1: num_imgs
prop(:,:,i) = angle(propagate(prop(:,:,i),lambda, ...
-1*z_temp(i),ps));
end
%
% Replace with center plane intensity
E0_est = sqrt(Inten(:,:,I0_idx)).*exp(1i*mean(prop,3));
end
%
phi = angle(E0_est);
2 comentarios
per isakson
el 21 de Dic. de 2016
Editada: per isakson
el 21 de Dic. de 2016
Waldemiro Kubucama
el 1 de Ag. de 2020
Hello, first press button "Run" in Matlab and after only you press the button "ENTER" i your computer. I think your problem will be solved.
Respuestas (0)
Ver también
Categorías
Más información sobre Get Started with MATLAB en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!