Commit 543a05fa authored by Leon Merten Lohse's avatar Leon Merten Lohse

remove obsolete workaround in astraFDK.m to improve performance

parent c40abe3f
Pipeline #145710 passed with stage
in 1 minute and 51 seconds
......@@ -39,10 +39,9 @@ function vol = astraFDK(projs,tomoAngles,z01,z02,dx,settings)
% numSlices : Default = 1
% Number of slices to be reconstructed
% offset : Default = 0
% Offset of the reconstructed volume to the central slice of detector. If the
% entire volume is reconstructed, the offset should be 0. Otherwise it can be
% used to reconstruct single tomographic slcies at different heights of the
% object.
% Offset of the reconstructed volume to the central slice of detector.
% Can be used to compensate a shift between source and detector height or
% to reconstruct a subvolume.
% iradonOrientation : Default = true
% Orientation of the returned volume. iradonOrientation = true returns
% projections with the same orientation as Matlab's iradon function.
......@@ -156,35 +155,6 @@ if ~isreal(projs)
% WORKAROUND: Astra's FDK algorithm tends to cause crashes in MATLAB if the reconstructed volume
% is too large. In this case, the reconstruction has to be sequentially performed on smaller chunks
MAX_VOLUME_SIZE = 256*1024*1024; % Maximum 1 Gigabyte of volume data reconstructed in one chunk
numChunks = ceil(settings.outputSize.^2 * settings.numSlices / MAX_VOLUME_SIZE);
if numChunks > 1
vol = zeros([settings.outputSize*[1,1], settings.numSlices], 'single');
slicesPerChunk = ceil(settings.numSlices/numChunks);
% convert input to single precision to avoid copying in each call of astraFDK in the loop below
if ~isa(projs, 'single')
projs = single(projs);
for chunkIdx = 1:numChunks
firstSlice = 1+(chunkIdx-1)*slicesPerChunk;
lastSlice = min(firstSlice+slicesPerChunk-1, settings.numSlices);
midSlice = 0.5*(firstSlice+lastSlice);
settingsChunk = settings;
settingsChunk.numSlices = lastSlice - firstSlice + 1;
settingsChunk.offset = settings.offset + (midSlice-1) - (settings.numSlices-1)/2;
vol(:,:,firstSlice:lastSlice) = astraFDK(projs, tomoAngles, z01, z02, dx, settingsChunk);
%% here it starts
% create volume geometry
% input:
% size of volume in y, size of volume in x, size of volume in z,
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