function [dx_pixel, dy_pixel, binning, exposure, background_value, ...
          xd_pos, pix_size, psf_L, psf_dL, angle_range] ...
          = measurement_info( name_proj )
% This function looks for file with measurement information and reads needed information for the reconstruction process.

pom=name_proj(1:end-3);
if exist([pom 'ctm'])
    val='ctm';
elseif exist([pom 'ipro'])
    val='ipro';
end

info=fileread([name_proj(1:end-3),val]);

% detector pixel count horizontal
dx_pixel = info(strfind(info,'<roi_dx_pixel>')+14:strfind(info,'</roi_dx_pixel>')-1);
dx_pixel = str2double(dx_pixel);

% detector pixel count vertical
dy_pixel = info(strfind(info,'<roi_dy_pixel>')+14:strfind(info,'</roi_dy_pixel>')-1);
dy_pixel = str2double(dy_pixel);

% binning info
binning = info(strfind(info,'<binning>')+9:strfind(info,'</binning>')-1);
binning = str2double(binning);

% exposure time
exposure = info(strfind(info,'<exposure_time>')+15:strfind(info,'</exposure_time>')-1);
exposure = str2double(exposure);

% background value
background_value = info(strfind(info,'<FlatFieldCoefficient>')+22:strfind(info,'</FlatFieldCoefficient>')-1);
background_value = str2double(background_value);

% information about sample-detector distance
xd_pos = info(strfind(info,'<XD_position>')+13:strfind(info,'</XD_position>')-1);
xd_pos = str2double(xd_pos);

% single detector pixel size
pix_size = info(strfind(info,'<xd_pixelsize>')+14:strfind(info,'</xd_pixelsize>')-1);
pix_size = str2double(pix_size);

% source-to-sample distance parameters
psf_L = info(strfind(info,'<PixelSizeFactor_L>')+19:strfind(info,'</PixelSizeFactor_L>')-1);
psf_L = str2double(psf_L);
psf_dL = info(strfind(info,'<PixelSizeFactor_dL>')+20:strfind(info,'</PixelSizeFactor_dL>')-1);
psf_dL = str2double(psf_dL);

% angle range
angle_range = info(strfind(info,'<angle_range>')+13:strfind(info,'</angle_range>')-1);
angle_range = str2double(angle_range);

% % angle of first projection
% start_angle = info(strfind(info,'<start_angle>')+13:strfind(info,'</start_angle>')-1);
% start_angle = str2double(start_angle);

% % continuous or step scan?
% continuous_scan = info(strfind(info,'<ContinuousScan>')+16:strfind(info,'</ContinuousScan>')-1);
% continuous_scan = logical(str2double(num_proj));

end

