function [x_metric, y_metric]=pixel2metric(x_pixel, y_pixel,sizeX,sizeY,Pixelsize,IOR,model)
% metric2pixel transformation of image coordinates from pixel space(matlab convention)
%                   to metric space (centered) (offset of 0.5 pixel in x an y)
%              
%
% Input data: - x_pixel, y_pixel - image ccordinates in pixel system 
%             - sizeX, sizeY - size of image in Pixel  
%             - Pixelsize - metric length of pixel
%
% Output data:- x_metrci,y_metric - image ccordinates in metric system 
%
%
% Definitions:- metric system is defined by the origin (center of sensor)
%               and the x-axis in column-direktion and y-axis in
%               row-direction
%             - pixel system is defined by origin in the middle of the
%               upper left pixel (1,1) - so upper left corner of the sensor
%               has (0.5 , 0.5) - and the x-axis in column-direktion and
%               y-axis in
%               row-direction  

centerX = sizeX/2+0.5; % Center x in pixel space
centerY = sizeY/2+0.5; % Center y in pixel space

% Transformation from pixel- into metric-space 

    x_metric = (x_pixel - 0.5 - centerX) * Pixelsize;
    y_metric = (y_pixel - 0.5 - centerY) * -Pixelsize;
       
         
end