Borrar filtros
Borrar filtros

How do I define log function for arguments of type int16 ?

11 visualizaciones (últimos 30 días)
Hoda
Hoda el 18 de Jun. de 2014
Editada: Image Analyst el 18 de Jun. de 2014
I am doing image processing and at some point in my code I need to find the natural log of a ratio (ration between the pre-contrast "Spre" and post-contrast signal intensities "Spost").But they are of type int16 and matlab gives me an error that "Undefined function 'log' for input arguments of type 'int16'". Could you please help me out with a solution, thanks alot.
R2 = 1./SE;
TE = 120; % echo time 120 ms
SE = analyze75read('10_ep2d_ge_se_128_DCE_slice8.hdr');
[xsize_se, ysize_se, tsize_se] = size(SE);
for x = 1:xsize_se
for y = 1:ysize_se
IM_signal_SE = squeeze(SE(x,y,:));
IM_signal_SE_baseline = squeeze(SE(x,y,4:15));
Spre = mean(IM_signal_SE_baseline); % pre contrast (AVERAGE baseline signal intensity)
Spost = IM_signal_SE - Spre; % post contrast signal SE
*deltaR2 = 1/TE (log(Spre./Spost));*
end
end

Respuesta aceptada

James Tursa
James Tursa el 18 de Jun. de 2014
Turn them into double. E.g.,
log(double(Spre)./double(Spost))
  2 comentarios
Image Analyst
Image Analyst el 18 de Jun. de 2014
Hoda said in his own Answer (which I deleted because only 1 Answer can be accepted), which he mistakenly accepted:
Thank you very much!
I transferred it here and deleted Hoda's answer so he can officially Accept James's answer instead.
Image Analyst
Image Analyst el 18 de Jun. de 2014
Editada: Image Analyst el 18 de Jun. de 2014
Please accept and vote for an answer if it solved your problem.

Iniciar sesión para comentar.

Más respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by