Skip to content
Snippets Groups Projects
Commit 550a4877 authored by Laura Nervo's avatar Laura Nervo Committed by Nicola Vigano
Browse files

gtPlotUVW : function to plot UV list from forward simulation on summed image...

gtPlotUVW : function to plot UV list from forward simulation on summed image of difspots if existing, using the current fitted geometry
            UV list is produced by gtCalculateGrain

Signed-off-by: default avatarLaura Nervo <laura.nervo@esrf.fr>

git-svn-id: https://svn.code.sf.net/p/dct/code/trunk@872 4c865b51-4357-4376-afb4-474e03ccb993
parent 1cbf8e05
Branches main
Tags v0.4.5
No related merge requests found
function hf = gtPlotUVW(im,uv,geo)
% hf = gtPlotUVW(im,uv,geo)
%
% INPUT:
% im = output from gtPlaceDifspotsinfull <double 2048x2048>
% uv = u,v list to plot <double Nx2>
% geo = fitted geometry possibly
%
% OUTPUT:
% hf = figure handle
if ~exist('im','var') || isempty(im)
im = zeros(geo.detsizeu, geo.detsizev);
end
hf = figure();
if ~isempty(im)
imshow(im,[])
hold on
end
detsizeu = geo.detsizeu;
detsizev = geo.detsizev;
beamdir = geo.beamdir';
detdiru = geo.detdiru';
detdirv = geo.detdirv';
detdir = geo.detnorm;
detpos = geo.detrefpos; % mm
detrefu = geo.detrefu;
detrefv = geo.detrefv;
if isfield(geo,'Xzero')
olddiru = geo.Xzero(1:3);
olddirv = geo.Xzero(4:6);
oldpos = geo.Xzero(7:9).*((geo.pixelsizeu+geo.pixelsizev)/2); % mm
else
olddiru = detdiru;
olddirv = detdirv;
oldpos = geo.detrefpos;%.*geo.pixelsize
end
% Image frame
plot([0 detsizeu+1],[0 0],'k')
plot([0 detsizeu+1],[detsizev+1 detsizev+1],'k')
plot([0 0],[0 detsizev+1],'k')
plot([detsizeu+1 detsizeu+1],[0 detsizev+1],'k')
%% Midlines
plot([0 detsizeu+1],[detsizev/2+0.5 detsizev/2+0.5],'-.y','Linewidth',1)
plot([detsizeu/2+0.5 detsizeu/2+0.5],[0 detsizev+1],'-.y','Linewidth',1)
Qdet = gtFedDetectorProjectionTensor(detdiru,detdirv,1,1);
%% Beam direction in image
beamuv = Qdet*beamdir;
% Arrow in figure indicating beam direction
if (dot(beamdir,detdir)-1)<0.001 % // 1
plot(detrefu,detrefv,'.w','MarkerSize',20)
elseif (dot(beamdir,detdir)+1)<0.001 % // -1
plot(detrefu,detrefv,'xw','MarkerSize',20)
else
quiver(detrefu,detrefv,beamuv(1),beamuv(2),1000,'-w','Linewidth',2)
end
%% origin u,v
plot(0,0,'.y','MarkerSize',20)
plot(0,0,'oy','MarkerSize',10)
% unit vectors u,v
quiver(0,0,0,1,150,'-y','Linewidth',2)
quiver(0,0,1,0,150,'-y','Linewidth',2)
%% center displacement
shift=oldpos-detpos;
newcenu=detrefu+dot(shift,olddiru)./geo.pixelsizeu;
newcenv=detrefv+dot(shift,olddirv)./geo.pixelsizev;
plot(newcenu,newcenv,'+y','MarkerSize',20)
for i=1:N
plot(uv(i,1),uv(i,2),'.r','MarkerSize',30)
end
end %end of function
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment