Commit b964ae10 authored by smaretz's avatar smaretz
Browse files

some fixes

parent 9c5700a4
Pipeline #100462 passed with stage
in 1 minute and 19 seconds
......@@ -85,7 +85,7 @@ imageReader = getImageReaderIRP(detector);
switch(lower(detector))
case 'argos'
fileEnding = '_%04i.tif'; dumpEnding = '_%04i.tif.txt';
fileEnding = '_%04i.tif'; dumpEnding = '_%04i.edf.txt';
dx = 0.54e-6;
case 'talos'
fileEnding = '_%04i.tif'; dumpEnding = '_%04i.tif.txt';
......@@ -138,6 +138,7 @@ emptynumbers{2} = numLastangle+1:numLastangle+numFlats;
% darkfield images after tomographic scan
darknumbers = 2*numFlats+numAngles*numAverage+1:2*numFlats+numAngles*numAverage+numDarks;
%% read in empty images
emptys = cell(numel(emptynumbers),1);
for indEmpty = 1:numel(emptynumbers)
......@@ -164,7 +165,7 @@ fprintf('\n');
%% read in tomographic scan data
binningFactor = 1; % factor for binning of detector pixels, factor 1 does nothing
binningFactor = 2; % factor for binning of detector pixels, factor 1 does nothing
projs = zeros(size(raw0,1)/binningFactor,size(raw0,2)/binningFactor,numAngles,'single');
thetas = zeros(numAngles,1);
......@@ -284,29 +285,29 @@ fprintf('Fresnel number: %4.5f\n',F);
%% PHASE RECONSTRUCTION
%% First determine suitable method and parameters for an exemplary projection
projIdx = 1; %randi(size(projs,3));
projExample = projs(:,:,:,projIdx);
projExample = projs(:,:,projIdx);
figure('name', 'Original image'); showImage(projExample);
settingsRecon = struct;
settingsRecon.padx = 500;
settingsRecon.pady = 500;
settingsRecon.reg_alpha = 0.01;
settingsPhaseRecon = struct;
settingsPhaseRecon.padx = 500;
settingsPhaseRecon.pady = 500;
settingsPhaseRecon.reg_alpha = 0.01;
% Reconstruction with MBA-algorithm
projRecMBA = phaserec_mba(projExample, F, settingsRecon);
projRecMBA = phaserec_mba(projExample, F, settingsPhaseRecon);
figure('name', 'MBA-reconstruction'); showImage(projRecMBA);
% Reconstruction with BAC-algorithm
settingsRecon.reg_gamma = 1;
projRecBAC = phaserec_bac(projExample, settingsRecon);
settingsPhaseRecon.reg_gamma = 1;
projRecBAC = phaserec_bac(projExample, settingsPhaseRecon);
figure('name', 'BAC-reconstruction'); showImage(projRecBAC);
%% Reconstruct all projections angles with BAC using the determined settings
parfor indProj = 1:numAngles
disp(indProj);
projs(:,:,indProj) = phaserec_bac(projs(:,:,indProj), bacsettings);
projs(:,:,indProj) = phaserec_bac(projs(:,:,indProj), settingsPhaseRecon);
end
......@@ -316,7 +317,7 @@ showStack(projs,settings);
%% Take logarithm to convert intensities to absorption values
projsPad = -log(projs);
projs = -log(projs);
......@@ -324,9 +325,9 @@ projsPad = -log(projs);
%% First determine suitable reconstruction parameters by trial-reconstruction of a central tomographic slice
slicenumber = ceil(size(projs,1)/2);
sinoCrop = 50; % Number of pixels cropped from the edges of the sinogram before reconstruction
sinoPad = 500; % Number of pixels padded to the edges of the sinogram before reconstruction
sliceSize = 1800; % Size of the reconstructed slices
sinoCrop = 0; % Number of pixels cropped from the edges of the sinogram before reconstruction
sinoPad = ceil(0.25*size(projs,2)); % Number of pixels padded to the edges of the sinogram before reconstruction
sliceSize = size(projs,2); % Size of the reconstructed slices
settingsTomoRec = astraFDK;
settingsTomoRec.outputSize = sliceSize;
......@@ -336,15 +337,15 @@ settingsTomoRec.offset = 0; % position of the slice relative to the equator
% geometry. The value 0 corresponds to reconstructing the central slice
% Ring-removal settings: see documentation of ringremove for details
doRingRemoval = false;
doRingRemoval = true;
settingsRingremove = ringremove;
% Perform reconstruction with optional ring-removal
sino = squeeze(projs(slicenumber,:,:));
sino = projs(slicenumber,:,:);
if doRingRemoval
sino = ringremove(sino, settingsRingremove);
sino(:) = ringremove(squeeze(sino), settingsRingremove);
end
slice = astraFDK(padarray(sino(sinoCrop+1:end-sinoCrop,:), [sinoPad,0], 'replicate'), thetas, z01, z02, dx*1000 , settingsTomoRec);
slice = astraFDK(padarray(sino(:,sinoCrop+1:end-sinoCrop,:), [0,sinoPad,0], 'replicate'), thetas, z01, z02, dx*1000 , settingsTomoRec);
% View results to see whether parameters have to be adjusted
figure; showImage(slice); colormap bone;
......@@ -355,13 +356,14 @@ figure; showImage(slice); colormap bone;
% optional ring removal for all slices
if doRingRemoval
parfor sliceIdx = 1:size(projs,1)
disp(sliceIdx);
projs(sliceIdx,:,:) = ringremove(squeeze(projs(sliceIdx,:,:)), settingsRingremove);
end
end
settingsTomoRec.offset = 0;
settingsTomoRec.numSlices = size(projs,1); % all slices
slices = astraFBP(padarray(projs(:,sinoCrop+1:end-sinoCrop,:), [0, sinoPad], 'replicate'), thetas, settingsTomoRec);
slices = astraFDK(padarray(projs(:,sinoCrop+1:end-sinoCrop,:), [0,sinoPad,0], 'replicate'), thetas, z01, z02, dx*1000 , settingsTomoRec);
......
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