How do I define log function for arguments of type int16 ?
9 ビュー (過去 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
0 件のコメント
採用された回答
James Tursa
2014 年 6 月 18 日
Turn them into double. E.g.,
log(double(Spre)./double(Spost))
2 件のコメント
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
2014 年 6 月 18 日
編集済み: Image Analyst
2014 年 6 月 18 日
Please accept and vote for an answer if it solved your problem.
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!