Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion MATLAB/Algorithms/AB_GMRES.m
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
resL2(k)=im3Dnorm(proj-Ax(compute_res(x,w(:,1:k),y,geo,angles,backproject,gpuids),geo,angles,'Siddon','gpuids',gpuids),'L2');
if k>1 && resL2(k)>resL2(k-1)
x=compute_res(x,w(:,1:end-1),y(1),geo,angles,backproject,gpuids);
disp(['Algorithm stoped in iteration ', num2str(k),' due to loss of ortogonality.'])
disp(['Algorithm stoped in iteration ', num2str(k),' due to loss of orthogonality.'])
return;
end

Expand Down
6 changes: 3 additions & 3 deletions MATLAB/Algorithms/AwASD_POCS.m
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@
% 'TViter': Defines the amount of TV iterations performed per SART
% iteration. Default is 20
%
% 'alpha': Defines the TV hyperparameter. default is 0.002
% 'alpha': Defines the TV hyperparameter. Default is 0.002
%
% 'alpha_red': Defines the reduction rate of the TV hyperparameter
%
% 'Ratio': The maximum allowed image/TV update ration. If the TV
% 'Ratio': The maximum allowed image/TV update ratio. If the TV
% update changes the image more than this, the parameter
% will be reduced.default is 0.95
% will be reduced. Default is 0.95
% 'maxL2err' Maximum L2 error to accept an image as valid. This
% parameter is crucial for the algorithm, determines at
% what point an image should not be updated further.
Expand Down
2 changes: 1 addition & 1 deletion MATLAB/Algorithms/BA_GMRES.m
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
resL2(k)=im3Dnorm(aux,'L2');
if k>1 && resL2(k)>resL2(k-1)
x=compute_res(x,w(:,1:k),y,geo);
disp(['Algorithm stoped in iteration ', num2str(k),' due to loss of ortogonality.'])
disp(['Algorithm stoped in iteration ', num2str(k),' due to loss of orthogonality.'])
return
end

Expand Down
6 changes: 3 additions & 3 deletions MATLAB/Algorithms/B_ASD_POCS_beta.m
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@
% 'TViter': Defines the amount of TV iterations performed per SART
% iteration. Default is 20
%
% 'alpha': Defines the TV hyperparameter. default is 0.002
% 'alpha': Defines the TV hyperparameter. Default is 0.002
%
% 'alpha_red': Defines the reduction rate of the TV hyperparameter
%
% 'Ratio': The maximum allowed image/TV update ration. If the TV
% 'Ratio': The maximum allowed image/TV update ratio. If the TV
% update changes the image more than this, the parameter
% will be reduced.default is 0.95
% will be reduced. Default is 0.95
% 'maxL2err' Maximum L2 error to accept an image as valid. This
% parameter is crucial for the algorithm, determines at
% what point an image should not be updated further.
Expand Down
8 changes: 4 additions & 4 deletions MATLAB/Algorithms/CGLS.m
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
% are requested, to plot their change w.r.t. this known
% data.
% 'restart' true or false. By default the algorithm will restart when
% loss of ortogonality is found.
% loss of orthogonality is found.
%--------------------------------------------------------------------------
%--------------------------------------------------------------------------
% This file is part of the TIGRE Toolbox
Expand Down Expand Up @@ -85,12 +85,12 @@
qualMeasOut(:,iter)=Measure_Quality(x0,x,QualMeasOpts);
end

% The following should never happen, but the reallity is that if we use
% The following should never happen, but the reality is that if we use
% the residual from the algorithm, it starts diverging from this explicit residual value.
% This is an interesting fact that I believe may be caused either by
% the mismatch of the backprojection w.r.t the real adjoint, or
% numerical issues related to doing several order of magnitude
% difference operations on single precission numbers.
% difference operations on single precision numbers.
aux=proj-Ax(x,geo,angles,'Siddon','gpuids',gpuids);
resL2(iter)=im3Dnorm(aux,'L2');
if iter>1 && resL2(iter)>resL2(iter-1)
Expand All @@ -101,7 +101,7 @@
x=x-alpha*p;
% if the restart didn't work.
if remember==iter || ~restart
disp(['Algorithm stoped in iteration ', num2str(iter),' due to loss of ortogonality.'])
disp(['Algorithm stoped in iteration ', num2str(iter),' due to loss of orthogonality.'])
return;
end
remember=iter;
Expand Down
8 changes: 4 additions & 4 deletions MATLAB/Algorithms/IRN_TV_CGLS.m
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
% are requested, to plot their change w.r.t. this known
% data.
% 'restart' true or false. By default the algorithm will restart when
% loss of ortogonality is found.
% loss of orthogonality is found.
%--------------------------------------------------------------------------
%--------------------------------------------------------------------------
% This file is part of the TIGRE Toolbox
Expand Down Expand Up @@ -108,12 +108,12 @@
qualMeasOut(:,iter)=Measure_Quality(x_prev,x,QualMeasOpts);
end

% The following should never happen, but the reallity is that if we use
% The following should never happen, but the reality is that if we use
% the residual from the algorithm, it starts diverging from this explicit residual value.
% This is an interesting fact that I believe may be caused either by
% the mismatch of the backprojection w.r.t the real adjoint, or
% numerical issues related to doing several order of magnitude
% difference operations on single precission numbers.
% difference operations on single precision numbers.
aux=proj-Ax(x,geo,angles,'Siddon','gpuids',gpuids);
resL2(iter)=im3Dnorm(aux,'L2');
if mod(iter,niter_break)~=1 && resL2(iter)>resL2(iter-1)
Expand All @@ -123,7 +123,7 @@
x=x-alpha*p;
% if the restart didn't work.
if remember==iter || ~restart
disp(['Algorithm stoped in iteration ', num2str(iter),' due to loss of ortogonality.'])
disp(['Algorithm stoped in iteration ', num2str(iter),' due to loss of orthogonality.'])
return;
end
remember=iter;
Expand Down
10 changes: 5 additions & 5 deletions MATLAB/Algorithms/LSMR.m
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
% are requested, to plot their change w.r.t. this known
% data.
% 'restart' true or false. By default the algorithm will restart when
% loss of ortogonality is found.
% loss of orthogonality is found.
%--------------------------------------------------------------------------
%--------------------------------------------------------------------------
% This file is part of the TIGRE Toolbox
Expand Down Expand Up @@ -167,7 +167,7 @@
% (11) Compute ||r_k||
d = d + betacheck^2;
gamma_var = d + (betad - taud)^2 + betadd^2;
aux = sqrt(gamma_var); % this is the residual teh algorithm follows, but we lose ortogonality, so we compute it explicitly
aux = sqrt(gamma_var); % this is the residual the algorithm follows, but we lose orthogonality, so we compute it explicitly

% ||A^T r_k || is just |zetabar|

Expand All @@ -180,12 +180,12 @@
if measurequality
qualMeasOut(:,iter)=Measure_Quality(x0,x,QualMeasOpts);
end
% The following should never happen, but the reallity is that if we use
% The following should never happen, but the reality is that if we use
% the residual from the algorithm, it starts diverging from this explicit residual value.
% This is an interesting fact that I believe may be caused either by
% the mismatch of the backprojection w.r.t the real adjoint, or
% numerical issues related to doing several order of magnitude
% difference operations on single precission numbers.
% difference operations on single precision numbers.
aux=proj-Ax(x,geo,angles,'Siddon','gpuids',gpuids);
resL2(iter)=im3Dnorm(aux,'L2');
if iter>1 && resL2(iter)>resL2(iter-1)
Expand All @@ -196,7 +196,7 @@
x=x-(zeta / (rho*rhobar)) * hbar;
% if the restart didn't work.
if remember==iter || ~restart
disp(['Algorithm stoped in iteration ', num2str(iter),' due to loss of ortogonality.'])
disp(['Algorithm stoped in iteration ', num2str(iter),' due to loss of orthogonality.'])
return;
end
remember=iter;
Expand Down
8 changes: 4 additions & 4 deletions MATLAB/Algorithms/LSQR.m
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
% are requested, to plot their change w.r.t. this known
% data.
% 'restart' true or false. By default the algorithm will restart when
% loss of ortogonality is found.
% loss of orthogonality is found.
%--------------------------------------------------------------------------
%--------------------------------------------------------------------------
% This file is part of the TIGRE Toolbox
Expand Down Expand Up @@ -129,12 +129,12 @@
qualMeasOut(:,iter)=Measure_Quality(x0,x,QualMeasOpts);
end

% The following should never happen, but the reallity is that if we use
% The following should never happen, but the reality is that if we use
% the residual from the algorithm, it starts diverging from this explicit residual value.
% This is an interesting fact that I believe may be caused either by
% the mismatch of the backprojection w.r.t the real adjoint, or
% numerical issues related to doing several order of magnitude
% difference operations on single precission numbers.
% difference operations on single precision numbers.
aux=proj-Ax(x,geo,angles,'Siddon','gpuids',gpuids);
resL2(iter)=im3Dnorm(aux,'L2');
if iter>1 && resL2(iter)>resL2(iter-1)
Expand All @@ -145,7 +145,7 @@
x=x-(phi / rho) * (v-w)/((theta / rho));
% if the restart didn't work.
if remember==iter || ~restart
disp(['Algorithm stoped in iteration ', num2str(iter),' due to loss of ortogonality.'])
disp(['Algorithm stoped in iteration ', num2str(iter),' due to loss of orthogonality.'])
return;
end
remember=iter;
Expand Down
6 changes: 3 additions & 3 deletions MATLAB/Algorithms/OS_ASD_POCS.m
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@
% 'TViter': Defines the amount of TV iterations performed per SART
% iteration. Default is 20
%
% 'alpha': Defines the TV hyperparameter. default is 0.002
% 'alpha': Defines the TV hyperparameter. Default is 0.002
%
% 'alpha_red': Defines the reduction rate of the TV hyperparameter
%
% 'Ratio': The maximum allowed image/TV update ration. If the TV
% 'Ratio': The maximum allowed image/TV update ratio. If the TV
% update changes the image more than this, the parameter
% will be reduced.default is 0.95
% will be reduced. Default is 0.95
% 'maxL2err' Maximum L2 error to accept an image as valid. This
% parameter is crucial for the algorithm, determines at
% what point an image should not be updated further.
Expand Down
6 changes: 3 additions & 3 deletions MATLAB/Algorithms/OS_AwASD_POCS.m
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@
% 'TViter': Defines the amount of TV iterations performed per SART
% iteration. Default is 20
%
% 'alpha': Defines the TV hyperparameter. default is 0.002
% 'alpha': Defines the TV hyperparameter. Default is 0.002
%
% 'alpha_red': Defines the reduction rate of the TV hyperparameter
%
% 'Ratio': The maximum allowed image/TV update ration. If the TV
% 'Ratio': The maximum allowed image/TV update ratio. If the TV
% update changes the image more than this, the parameter
% will be reduced.default is 0.95
% will be reduced. Default is 0.95
% 'maxL2err' Maximum L2 error to accept an image as valid. This
% parameter is crucial for the algorithm, determines at
% what point an image should not be updated further.
Expand Down
6 changes: 3 additions & 3 deletions MATLAB/Algorithms/PICCS.m
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@
% 'TViter': Defines the amount of TV iterations performed per SART
% iteration. Default is 20
%
% 'alpha': Defines the TV hyperparameter. default is 0.002
% 'alpha': Defines the TV hyperparameter. Default is 0.002
%
% 'alpha_red': Defines the reduction rate of the TV hyperparameter
%
% 'Ratio': The maximum allowed image/TV update ration. If the TV
% 'Ratio': The maximum allowed image/TV update ratio. If the TV
% update changes the image more than this, the parameter
% will be reduced.default is 0.95
% will be reduced. Default is 0.95
% 'maxL2err' Maximum L2 error to accept an image as valid. This
% parameter is crucial for the algorithm, determines at
% what point an image should not be updated further.
Expand Down
2 changes: 1 addition & 1 deletion MATLAB/Algorithms/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ This assumes the noise and the data follows Poisson distribution, so mostly usef

# Krylov Subspace algorithms

These are fast coverging iterative algorithms. The have some issues with regards of semiconvergence and loss of ortogonality, so in some cases they may not produce best results,
These are fast coverging iterative algorithms. The have some issues with regards of semiconvergence and loss of orthogonality, so in some cases they may not produce best results,
but the main advantage is that few iterations should produce a good image.

Non regularized:
Expand Down
2 changes: 1 addition & 1 deletion MATLAB/Algorithms/hybrid_LSQR.m
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@
aux=proj-Ax(x,geo,angles,'Siddon','gpuids',gpuids);
resL2(ii)=im3Dnorm(aux,'L2');
if ii>1 && resL2(ii)>resL2(ii-1)
disp(['Algorithm stoped in iteration ', num2str(ii),' due to loss of ortogonality.'])
disp(['Algorithm stoped in iteration ', num2str(ii),' due to loss of orthogonality.'])
return;
end

Expand Down
2 changes: 1 addition & 1 deletion MATLAB/Algorithms/hybrid_fLSQR_TV.m
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@
aux=proj-Ax(x,geo,angles,'Siddon','gpuids',gpuids);
errorL2(ii)=im3Dnorm(aux,'L2');
if ii>1 && resL2(ii)>resL2(ii-1)
disp(['Algorithm stoped in iteration ', num2str(ii),' due to loss of ortogonality.'])
disp(['Algorithm stoped in iteration ', num2str(ii),' due to loss of orthogonality.'])
return;
end
if (ii==1 && verbose)
Expand Down
6 changes: 3 additions & 3 deletions MATLAB/Demos/d06_Algorithms01.m
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@
% ANGLES : Propjection angles
% And has a single optional argument:
% FILTER: filter type applied to the projections. Possible options are
% 'ram-lal' (default)
% 'ram-lak' (default)
% 'shepp-logan'
% 'cosine'
% 'hamming'
% 'hann'
% The choice of filter will modify the noise and sopme discreatization
% The choice of filter will modify the noise and some discretization
% errors, depending on which is chosen.
%
imgFDK1=FDK(noise_projections,geo,angles,'filter','hann');
Expand All @@ -62,5 +62,5 @@
plotImg([imgFDK1 imgFDK2],'Dim','Z');

% but it can be seen that one has bigger errors in the whole image, while
% hte other just in the boundaries
% the other just in the boundaries
plotImg([abs(head-imgFDK1) abs(head-imgFDK2)],'Dim','Z');
16 changes: 8 additions & 8 deletions MATLAB/Demos/d09_Algorithms04.m
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
%
% This demo presents the Total variation algorithms in TIGRE. Total
% variation algorithms try to minimize the variation (gradient) of the
% image, assuming its piecewise smooth, as most things in nature are (i.e.
% image, assuming it's piecewise smooth, as most things in nature are (i.e.
% human body).
%
% This set of algorithms is specially good performing when the noise is
% This set of algorithms is especially well-performing when the noise is
% very big or the number of projections is small, however, they require more
% computational time and memory than the other algorithms to run.
%
Expand Down Expand Up @@ -69,7 +69,7 @@
% ASD-POCS has a variety of optional arguments, and some of them are crucial
% to determine the behavior of the algorithm. The advantage of ASD-POCS is
% the power to create good images from bad data, but it needs a lot of
% tunning.
% tuning.
%
% Optional parameters that are very relevant:
% ----------------------------------------------
Expand All @@ -78,10 +78,10 @@
% what point an image should not be updated further.
% Default is 20% of the FDK L2 norm.
%
% its called epsilon in the paper
% it's called epsilon in the paper
epsilon=im3Dnorm(Ax(FDK(noise_projections,geo,angles),geo,angles)-noise_projections,'L2')*0.15;
% 'alpha': Defines the TV hyperparameter. default is 0.002.
% However the paper mentions 0.2 as good choice
% 'alpha': Defines the TV hyperparameter. Default is 0.002.
% However the paper mentions 0.2 as a good choice
alpha=0.002;

% 'TViter': Defines the amount of TV iterations performed per SART
Expand All @@ -104,9 +104,9 @@
% 'alpha_red': Defines the reduction rate of the TV hyperparameter
alpha_red=0.95;

% 'Ratio': The maximum allowed image/TV update ration. If the TV
% 'Ratio': The maximum allowed image/TV update ratio. If the TV
% update changes the image more than this, the parameter
% will be reduced.default is 0.95
% will be reduced. Default is 0.95
ratio=0.94;

% 'Verbose' 1 or 0. Default is 1. Gives information about the
Expand Down
6 changes: 3 additions & 3 deletions MATLAB/Demos/d11_PostProcessing.m
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
head=headPhantom(geo.nVoxel);
projections=Ax(head,geo,angles,'interpolated');
noise_projections=addCTnoise(projections);
%% Lets just use FDK
%% Let's just use FDK

imgFDK=FDK(noise_projections,geo,angles);

Expand All @@ -42,7 +42,7 @@
%
% im3Ddenoise : Denoises a 3D image, using Total Variation denoising.
%
% Argumetns are the hyperparameter and number of iterations (same as in
% Arguments are the hyperparameter and number of iterations (same as in
% SART-TV)
imgdenoised=im3DDenoise(imgFDK,'TV',100,15);

Expand All @@ -55,7 +55,7 @@
%% plot results
% denoised image is clearer
plotImg([imgFDK imgdenoised imcroped],'Dim','Z')
% however, teh denoising has no knoledge of the original data (projections)
% however, the denoising has no knoledge of the original data (projections)
% this it doesnt reduce the error. The error increases, specially in small
% areas
plotImg(abs([head-imgFDK head-imgdenoised head-imcroped]),'Dim','Z')
Expand Down
2 changes: 1 addition & 1 deletion MATLAB/Demos/d20_Algorithms05.m
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
%
% This demo presents the FISTA algorithm in TIGRE. using a total variation proximal.
% Total variation algorithms try to minimize the variation (gradient) of the
% image, assuming its piecewise smooth, as most things in nature are (i.e.
% image, assuming it's piecewise smooth, as most things in nature are (i.e.
% human body). FISTA attempts to perform this with much faster convergence
% than standard gradient algorithms such as SIRT.
%
Expand Down
6 changes: 3 additions & 3 deletions MATLAB/Utilities/cropCBCT.m
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@
% Coded by: Ander Biguri
%--------------------------------------------------------------------------

% Tangent is equal, cropRadious:
% Tangent is equal, cropRadius:
cropR=((geo.sDetector(1)/2+abs(geo.offDetector(1)))*geo.DSO)/geo.DSD;
%maximum distance from O
% maximum distance from O
maxD=min(geo.nVoxel(1:2)-1)/2;

% Crop radious will be theminimum of them
% Crop radius will be the minimum of them
cropR=min([cropR/geo.dVoxel(1) maxD]);
[x,y]=meshgrid(1:size(img,1),1:size(img,2));
inM=(x-size(img,1)/2).^2+(y-size(img,2)/2).^2<cropR^2;
Expand Down
Loading
Loading