Commit 18e208f8 authored by mtoeppe's avatar mtoeppe
Browse files

kleine aenderungen im template

parent 6a3ce55e
......@@ -29,16 +29,9 @@ addpath(genpath(toolboxPath));
%% Add ASTRA-toolbox to path
if ispc
astraPath = 'S:/Projects_X-ray_Imaging/holotomotoolbox/ASTRAToolbox/windows';
astraPath = 'S:/Projects_X-ray_Imaging/ASTRAToolbox/windows';
elseif isunix
computerName = char(java.net.InetAddress.getLocalHost.getHostName);
% If name is of the form 'santa0.roentgen.physik.uni-goettingen.de',
% only take prefix until first point:
pointIdx = strfind(computerName, '.');
if ~isempty(pointIdx)
computerName = computerName(1:pointIdx(1)-1);
end
astraPath = ['/IRP/AG_Salditt/Projects_X-ray_Imaging/ASTRAToolbox/', computerName];
astraPath = '/IRP/AG_Salditt/Projects_X-ray_Imaging/ASTRAToolbox/linux';
end
if ~exist(astraPath,'dir')
......@@ -90,13 +83,15 @@ switch(lower(detector))
dx = 6.5e-6;
end
fileName = [dataPath,'/',filePrefix,fileEnding];
dumpName = [dataPath,'/dump/',filePrefix,dumpEnding];
fileName = [filePrefix,fileEnding];
dumpName = [filePrefix,dumpEnding];
getFileName = @(number) fullfile(dataPath, sprintf(fileName,number));
getDumpName = @(number) fullfile(dataPath,'dump',sprintf(dumpName,number));
%% Read one image to check if path is correct
number = 100;
raw0 = imageReader(sprintf(fileName,number));
raw0 = imageReader(getFileName(number));
showImage(raw0);
colormap gray
......@@ -149,13 +144,13 @@ darknum = flatFilenum(2,end,end)+1:flatFilenum(2,end,end)+numDarks;
fprintf('... please check flat, projection and dark... \n' ) ;
for iii = 1 : numDistances
tmp = imageReader(sprintf(fileName,flatFilenum(1,iii,1)));
tmp = imageReader(getFileName(flatFilenum(1,iii,1)));
showImage(tmp);
title('Is this a flatfield? (Y- enter) (N - Ctr+c)')
colormap gray
pause()
tmp = imageReader(sprintf(fileName,projFilenum(iii,1)));
tmp = imageReader(getFileName(projFilenum(iii,1)));
showImage(tmp);
title('Is this a projection? (Y- enter) (N - Ctr+c)')
colormap gray
......@@ -163,7 +158,7 @@ for iii = 1 : numDistances
end
tmp = imageReader(sprintf(fileName,darknum(1)));
tmp = imageReader(getFileName(darknum(1)));
showImage(tmp);
title('Is this a darkfield? (Y- enter) (N - Ctr+c)')
colormap gray
......@@ -179,7 +174,7 @@ for indDistance = 1:numDistances
for indEmpty = 1:size(flatFilenum,1)
emptyTmp = zeros([size(raw0,1),size(raw0,2),numFlats], 'single');
for indImg = 1:numFlats
emptyTmp(:,:,indImg) = imageReader(sprintf(fileName,flatFilenum(indEmpty,indDistance,indImg)));
emptyTmp(:,:,indImg) = imageReader(getFileName(flatFilenum(indEmpty,indDistance,indImg)));
fprintf('.');
end
% take median of all emptys
......@@ -194,7 +189,7 @@ fprintf('... read darkfields... \n' ) ;
darkTmp = zeros(size(raw0,1),size(raw0,2),numDarks);
for indImg = 1:numDarks
darkTmp(:,:,indImg) = imageReader(sprintf(fileName,darknum(indImg)));
darkTmp(:,:,indImg) = imageReader(getFileName(darknum(indImg)));
fprintf('.');
end
% take median of all darkfield images
......@@ -208,7 +203,7 @@ fprintf('... calculate geometry parameters... \n' ) ;
% Read defocus distances from dump files
stx = zeros([1,numDistances]);
for distIdx = 1:numDistances
stx(distIdx) = wwas(sprintf(dumpName,projFilenum(distIdx,2)),xmotor);
stx(distIdx) = wwas(getDumpName(projFilenum(distIdx,2)),xmotor);
end
% calculate derived parameters: (suffixes 'x' and 'y' account for
......@@ -223,20 +218,20 @@ z12x = z02-z01x;
z12y = z02-z01y;
%
% magnifications
Mx = z02/z01x;
My = z02/z01y;
Mx = z02./z01x;
My = z02./z01y;
%
% effective distance between object and detetor
z_effx = z12x/Mx;
z_effy = z12y/My;
z_effx = z12x./Mx;
z_effy = z12y./My;
%
% effective pixel size
dxeffx = dx/Mx;
dxeffy = dx/My;
dxeffx = dx./Mx;
dxeffy = dx./My;
%
% Fresnel numbers in the effective geometry
Fx = dxeffx.^2/(z_effx*lambda);
Fy = dxeffy.^2/(z_effy*lambda);
Fx = dxeffx.^2./(z_effx*lambda);
Fy = dxeffy.^2./(z_effy*lambda);
% Magnifications and Fresnel numbers for all defocus distances (columns),
......@@ -247,10 +242,10 @@ F = [Fy(:).'; Fx(:).'];
%% Read, rescale and align holograms
% which distances should be read
% Which distances should be read?
distToUse = 1:numDistances;
% Settings for alignment of the different defocussed images. See
% Settings for alignment of the different defocused images. See
% documentation of rescaleDefocusSeries for details and additional options
alignSettings = rescaleDefocusSeries;
alignSettings.alignMethod = 'dftregistration';
......@@ -264,7 +259,7 @@ ctfsettingsAlign.betaDeltaRatio = 1/10;
ctfsettingsAlign.lim2 = 0.1;
alignSettings.ctfsettings = ctfsettingsAlign;
% no changes below this point
fprintf('... reading holograms... \n' ) ;
holograms = zeros([size(raw0,1), size(raw0,2), numel(distToUse), numAngles], 'single');
thetas = zeros([numAngles,1]);
......@@ -282,7 +277,7 @@ parfor indProj = 1:numAngles
emptyInterpolated = a*empty(:,:,indDistance,1)+(1-a)*empty(:,:,indDistance,2);
% read in data and perform empty beam correction
tmp = imageReader(sprintf(fileName,projFilenum(indDistance,indProj)));
tmp = imageReader(getFileName(projFilenum(indDistance,indProj)));
tmpCorr=(tmp-dark)./(emptyInterpolated-dark);
% remove hot pixels
......@@ -292,7 +287,7 @@ parfor indProj = 1:numAngles
% read rotation angle
if indProj~=1
thetas(indProj) = wwas(sprintf(dumpName,projFilenum(distToUse(1),indProj)),'stzrot');
thetas(indProj) = wwas(getDumpName(projFilenum(distToUse(1),indProj)),'stzrot');
else
thetas(indProj)=0;
end
......@@ -312,16 +307,14 @@ end
%% Show all holograms for a random tomographic angle to check results
projIdx = randi(numAngles);
for jj = 1:size(holograms,3)
figure; showImage(holograms(:,:,jj,projIdx));
showImage(holograms(:,:,jj,projIdx));
colormap gray
pause(1)
end
%% Show full tomographic data set for first distance to check results
figure; showStack(squeeze(holograms(:,:,1,:)));
%% OPTIONAL: delete corrupted holograms due to missing wedge from data
missingWedge = []; % Enter range of corrupted holograms here
holograms(:,:,:,missingWedge) = [];
......
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