Skip to content

Commit

Permalink
FIX: feGet fixed to support multi and single b value. Few changes in …
Browse files Browse the repository at this point in the history
…SHT packages too
  • Loading branch information
ccaiafa committed Dec 28, 2016
1 parent 3eeffa5 commit 42715ea
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function [F_N, Y_N] = leastSquaresSHT(N, F, dirs, basisType, weights)
function [F_N, Y_N, error] = leastSquaresSHT(N, F, dirs, basisType, weights)
%LEASTSQUARESSHT Spherical harmonic transform of F using least-squares
%
% N: maximum order of transform
Expand Down Expand Up @@ -35,6 +35,7 @@
% perform weighted least-squares transform
F_N = (Y_N'*diag(weights)*Y_N) \ (Y_N'*diag(weights) * F);
end



error = norm(Y_N*F_N-F)/norm(F);

end
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function [F_N, Y_N] = leastSquaresSHTeven(N, F, dirs, basisType, weights)
function [F_N, Y_N, error] = leastSquaresSHTeven(N, F, dirs, basisType, weights)
%LEASTSQUARESSHT Spherical harmonic transform of F using least-squares
%
% N: maximum order of transform
Expand Down Expand Up @@ -36,5 +36,5 @@
F_N = (Y_N'*diag(weights)*Y_N) \ (Y_N'*diag(weights) * F);
end


error = norm(Y_N*F_N-F)/norm(F);
end
Original file line number Diff line number Diff line change
Expand Up @@ -67,17 +67,18 @@
end

% plot 3d axes
maxF = max(max(abs(Fgrid)));
line([0 1.1*maxF],[0 0],[0 0],'color',[1 0 0])
line([0 0],[0 1.1*maxF],[0 0],'color',[0 1 0])
line([0 0],[0 0],[0 1.1*maxF],'color',[0 0 1])
% maxF = max(max(abs(Fgrid)));
% line([0 1.1*maxF],[0 0],[0 0],'color',[1 0 0])
% line([0 0],[0 1.1*maxF],[0 0],'color',[0 1 0])
% line([0 0],[0 0],[0 1.1*maxF],'color',[0 0 1])

% plot function
hold on
if isequal(realComplex, 'real')
Hp = surf(Dp_x, Dp_y, Dp_z);
Hn = surf(Dn_x, Dn_y, Dn_z);
set(Hp, 'FaceColor', 'b')
%set(Hp, 'FaceColor', 'b')
set(Hp, 'FaceColor', [0.9976, 0.7778, 0.2042])
set(Hp, 'EdgeAlpha', 0)
set(Hn, 'FaceColor', 'r')
set(Hn, 'EdgeAlpha', 0)
Expand Down
14 changes: 13 additions & 1 deletion life/fe/feGet.m
Original file line number Diff line number Diff line change
Expand Up @@ -1636,7 +1636,19 @@
end
end

val = val + repmat(mean(feGet(fe,'dsigmeasured'), 1),nTheta,1); %% add mean signal
dsigmeas = feGet(fe,'dsigmeasured');

if isfield(fe.life,'bvals_ind')
for n=1:length(fe.life.bvals_ind)
val(fe.life.bvals_ind{n},:) = val(fe.life.bvals_ind{n},:) + ...
repmat(mean(dsigmeas(fe.life.bvals_ind{n},:), 1),...
length(fe.life.bvals_ind{n}),1); %% add mean signal
end
else
val = val + repmat(mean(dsigmeas, 1),nTheta,1); %% add mean signal
end
%val = val(:);


case 'keepdirections'
ind = varargin{1};
Expand Down

0 comments on commit 42715ea

Please sign in to comment.