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!