Filter löschen
Filter löschen

how to calculate power of fraction without getting complex double ?

1 Ansicht (letzte 30 Tage)
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 Kommentar
dpb
dpb am 19 Jun. 2014
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...

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

James Tursa
James Tursa am 19 Jun. 2014
Bearbeitet: James Tursa am 19 Jun. 2014
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 Kommentar
Hoda
Hoda am 20 Jun. 2014
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 ;

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by