필터 지우기
필터 지우기

how to calculate power of fraction without getting complex double ?

조회 수: 1 (최근 30일)
Hoda
Hoda 2014년 6월 19일
댓글: Hoda 2014년 6월 20일
Hi I am trying to make a map (Q). Everything goes well except for the section that delatR2_st = deltaR2_star .^(2/3); where this command creates a double complex matrix, and I dont want it to be complex. And this creates an error for the last command where I try to create the map Qmap(xsize_se,ysize_se) = deltaR2./deltaR2_st ; The errors I get are : Undefined function or variable 'deltaR2_st'.
Error in MVD (line 73) Qmap(xsize_se,ysize_se) = deltaR2./deltaR2_st ;
The code is attached bellow. Can you please help me out what to do.
SE = analyze75read('10_ep2d_ge_se_128_DCE_slice8.hdr'); GE = analyze75read('10_ep2d_ge_128_DCE_slice8.hdr'); TE = 120; % echo time 120 ms [xsize_se, ysize_se, tsize_se] = size(SE); [xsize_ge, ysize_ge, tsize_ge] = size(GE);
Qmap = zeros(xsize_se, ysize_se); IM_Slice = zeros(xsize_se, ysize_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);
Spre = double(Spre);
Spost = IM_signal_SE ; % post contrast signal SE
Spost = double (Spost);
deltaR2 = 1/TE .* log(Spre./Spost);
end
end
for n = 1:xsize_ge
for m = 1:ysize_ge
IM_signal_GE = squeeze(GE(n,m,:));
IM_signal_GE_baseline = squeeze(GE(n,m,4:16));
Spre_star = mean(IM_signal_GE_baseline);
Spost_star = IM_signal_GE ; % post contrast signal GE
Spre_star = double (Spre_star);
Spost_star = double (Spost_star);
deltaR2_star = 1/TE .* log(Spre_star./Spost_star);
end
end
delatR2_st = deltaR2_star .^(2/3);
Qmap(xsize_se,ysize_se) = deltaR2./deltaR2_st ;
  댓글 수: 1
dpb
dpb 2014년 6월 19일
Well, I'm not sure what you're after, but as soon as you take log(anything) where anything<1 then log() will be negative and the 2/3rds root of a negative value is complex.
You need some other kind of scaling to keep deltaR2_star>0; what that should be I've no klew...

댓글을 달려면 로그인하십시오.

채택된 답변

James Tursa
James Tursa 2014년 6월 19일
편집: James Tursa 2014년 6월 19일
Not sure what the overall calculation is doing, but if you will allow negative inputs, then maybe this formulation is what you can use:
delatR2_st = nthroot(deltaR2_star,3).^2;
  댓글 수: 1
Hoda
Hoda 2014년 6월 20일
Great, this worked, no complex values. But Im still getting an error when i try to run the last command Qmap(xsize_se,ysize_se) = deltaR2./deltaR2_st ; (the commands are according to the theory of making a specific map, called the Qmap, deltaR2 is the intensity of one image and deltaR2star is the intensity of another image. Their ration gives us the Qmap) Thanks alot.
the error I get is the following: Undefined function or variable 'deltaR2_st'.
Error in MVD (line 73) Qmap(xsize_se,ysize_se) = deltaR2./deltaR2_st ;

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Descriptive Statistics에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by