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

10 次查看(过去 30 天)
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

采纳的回答

James Tursa
James Tursa 2014-6-18
Turn them into double. E.g.,
log(double(Spre)./double(Spost))
  2 个评论
Image Analyst
Image Analyst 2014-6-18
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 2014-6-18
编辑:Image Analyst 2014-6-18
Please accept and vote for an answer if it solved your problem.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Multirate Signal Processing 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by