Dear Gitlab Users, for our upcoming upgrade to Gitlab v14, Gitlab will be unavailable on Thursday, 05.08.2021 from 5:00 pm to approximately 7:00 pm. Note that with v14, certain breaking changes will be introduced (https://about.gitlab.com/blog/2021/06/04/gitlab-moving-to-14-breaking-changes/).

Commit 82235c9d authored by paulphilipp.meyer's avatar paulphilipp.meyer
Browse files

merged and resolved the conflict in readSpec.m

parents c9754628 7d25c0e3
Pipeline #139457 passed with stage
in 1 minute and 40 seconds
# HoloTomoToolbox
## How to cite ?
when using this toolbox, please cite:
A phase-retrieval toolbox for X-ray holography and tomography
Leon M. Lohse, Anna-Lena Robisch, Mareike Töpperwien, Simon Maretzke, Martin Krenkel, Johannes Hagemann, and Tim Salditt
Journal of Synchrotron Radiation 27, 852-859 (2020).
https://doi.org/10.1107/S1600577520002398
## Documentation
See the [online-documentation](https://irp.pages.gwdg.de/holotomotoolbox/) and code examples in [examples/](examples/).
......
......@@ -67,6 +67,10 @@ function imTransformed = rotateImage(im, rotAngleDegree, settings)
% You should have received a copy of the GNU General Public License
% along with this program. If not, see <http://www.gnu.org/licenses/>.
if nargin == 0
imTransformed = rmfield(shiftRotateMagnifyImage, 'invertTransform');
return
end
if nargin < 3
settings = struct;
end
......
......@@ -66,6 +66,10 @@ function imTransformed = shiftImage(im, shifts, settings)
% You should have received a copy of the GNU General Public License
% along with this program. If not, see <http://www.gnu.org/licenses/>.
if nargin == 0
imTransformed = rmfield(shiftRotateMagnifyImage, 'invertTransform');
return
end
if nargin < 3
settings = struct;
end
......
......@@ -87,6 +87,10 @@ function imTransformed = shiftRotateImage(im, shifts, rotAngleDegree, settings)
% You should have received a copy of the GNU General Public License
% along with this program. If not, see <http://www.gnu.org/licenses/>.
if nargin == 0
imTransformed = shiftRotateMagnifyImage;
return
end
if nargin < 4
settings = struct;
end
......
......@@ -17,16 +17,14 @@ function [imCorr, corr2D] = removeStripes(imToCorr,settings)
%
% Other Parameters
% ----------------
% rangeTop : Default = 1:100
% Range at the top of the image to average.
% rangeTop : Default = []
% Range at the top of the image to average. [] results in the top most 4%
% rangeBottom : Default = []
% Range at the bottom of the image to average. [] results in the bottom most 100
% pixels of the image.
% rangeLeft : Default = 1:100
% Range at the left edge of the image to average.
% Range at the bottom of the image to average. [] results in the bottom most 4%
% rangeLeft : Default = []
% Range at the left edge of the image to average. [] results in the left most 4%
% rangeRight : Default = []
% Range at the right edge of the image to average. [] results in the right most
% 100 pixels of the image.
% Range at the right edge of the image to average. [] results in the right most 4%
% windowSize : Default = 5
% Window size for smoothing the profile via a moving mean.
% direction : Default = 'vertical'
......
......@@ -41,7 +41,6 @@ if(nargin < 2)
% find available scans in specified file
list_scans(file)
return
error('Not enough input arguments: specify filepath, scan number and column');
end
if (nargin < 3)
......
......@@ -236,7 +236,8 @@ F = NonlinearPhaseContrastOperator(N, fresnelNumbers, parOp);
% Tikhonov functional(f) = || F(f) - holograms ||_2^2 + 2*|| regWeights * fft2(f) ||_2^2,
% where regWeights contains the same Fourier-space regularization weights as used in phaserec_ctf
% (note that "*" denotes composition of Operators/functionals in the following statements)
regWeightsTimes2 = 2*ctfRegWeights(N, mean(fresnelNumbers,2), settings.lim1, settings.lim2, useGPU);
regWeightsTimes2 = 2*ctfRegWeights(N, mean(fresnelNumbers,2), settings.lim1, settings.lim2, ...
useGPU, 2*numHolos);
TikhonovFunctional = NormSqFunctional * (F - holograms) ...
+ NormSqFunctional(@(f) real(ifft2(regWeightsTimes2 .* fft2(f))));
......
function regWeights = ctfRegWeights(sizeHolo, fresnelNumbers, lim1, lim2, gpuFlag)
function regWeights = ctfRegWeights(sizeHolo, fresnelNumbers, lim1, lim2, gpuFlag, lim3)
% Computes a regularization weights in Fourier space, suitable for regularized inversion
% of the CTF and similar reconstruction methods. The main idea, originally proposed by
% Peter Cloetens, is to create a mask that smoothly transitions from one (typically low)
......@@ -32,11 +32,27 @@ xi = cell([ndim,1]);
[xi{:}] = fftfreq(sizeHolo, 1);
XiSqDivFresnel = 0;
for jj = 1:ndim
XiSqDivFresnel = XiSqDivFresnel + gpuArrayIf(xi{jj}, gpuFlag).^2 ./ (2*pi^2*fresnelNumbers(jj));
xi{jj} = gpuArrayIf(xi{jj}, gpuFlag);
XiSqDivFresnel = XiSqDivFresnel + xi{jj}.^2 ./ (2*pi^2*fresnelNumbers(jj));
end
sigma = (sqrt(2) - 1) / 2;
w = 1/2 * erfc((sqrt(XiSqDivFresnel) - 1) / (sqrt(2) * sigma));
regWeights = lim1 .* w + lim2 .* (1 - w);
% Additional regularization level for spatial frequencies beyond the
% numerical aperture of the optical system. Only relevant for
% deeply holographic data
if nargin == 6
fresnelNumbersFOV = fresnelNumbers(:) .* sizeHolo(:).^2;
freqCutoffFOV = pi .* (fresnelNumbersFOV./sizeHolo(:));
wCutoffFOV = 1;
XiSqDivCutoffFOV = 0;
for jj = 1:ndim
XiSqDivCutoffFOV = XiSqDivCutoffFOV + (xi{jj}./freqCutoffFOV(jj)).^2;
wCutoffFOV = wCutoffFOV .* (0.5 .* erfc((abs(xi{jj})./freqCutoffFOV(jj)-1)./0.1));
end
regWeights = wCutoffFOV .* regWeights + (1-wCutoffFOV) .* lim3;
end
end
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment