Commit ec67e930 authored by Simon Maretzke's avatar Simon Maretzke
Browse files

Improved GPU-support

parent d62b7fc5
Pipeline #100793 passed with stage
in 1 minute and 26 seconds
......@@ -269,7 +269,7 @@ if doIterativeOptimization
end
if numel(settings.support)
% If padding is applied to the data, the support has to be padded as well
support = gpuArrayIf(padarray(settings.support, [settings.pady, settings.padx]), useGPU);
support = padarray(gpuArrayIf(settings.support, useGPU), [settings.pady, settings.padx]);
proxSupport = @(f) support .* f;
else
proxSupport = Id;
......
......@@ -181,9 +181,9 @@ end
% Optional padding of holograms (and of optional support)
holograms = padarray(holograms, [settings.pady settings.padx], 'replicate');
holograms = padarray(gpuArrayIf(holograms, useGPU), [settings.pady settings.padx], 'replicate');
if ~isempty(settings.support)
settings.support = padarray(settings.support, [settings.pady settings.padx]);
support = padarray(gpuArrayIf(settings.support, useGPU), [settings.pady settings.padx]);
end
N = size(holograms(:,:,1));
......@@ -199,6 +199,7 @@ settingsCTF.padx = 0; % Holograms are already padded,
settingsCTF.pady = 0; % so no more padding necessary
settingsCTF.useGPUIfPossible = useGPU;
settingsCTF.optimization = struct;
settingsCTF.optimization.tolerance = 1e-2;
initialGuess = gpuArrayIf(phaserec_ctf(holograms, fresnelNumbers, settingsCTF), useGPU);
% Preliminary nonlinearity-correction in the reconstructed absorption, applied in the low-frequency
......@@ -235,7 +236,6 @@ 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)
holograms = gpuArrayIf(holograms, useGPU);
regWeightsTimes2 = 2*ctfRegWeights(N, mean(fresnelNumbers,2), settings.lim1, settings.lim2, useGPU);
TikhonovFunctional = NormSqFunctional * (F - holograms) ...
+ NormSqFunctional(@(f) real(ifft2(regWeightsTimes2 .* fft2(f))));
......@@ -257,7 +257,6 @@ if settings.minPhase > -inf || settings.maxPhase < inf || ~isempty(settings.supp
end
if numel(settings.support)
% If padding is applied to the data, the support has to be padded as well
support = gpuArrayIf(settings.support, useGPU);
projSupport = @(f) support .* f;
else
projSupport = Id;
......
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