Skip to content
Snippets Groups Projects
Commit fd7e9b38 authored by Nicola Vigano's avatar Nicola Vigano
Browse files

EDF: fixed header length determination, so we can skip checking it each time!


Signed-off-by: default avatarNicola Vigano <nicola.vigano@esrf.fr>

git-svn-id: https://svn.code.sf.net/p/dct/code/trunk@538 4c865b51-4357-4376-afb4-474e03ccb993
parent a2522431
No related branches found
No related tags found
No related merge requests found
......@@ -306,7 +306,6 @@ for ss = 1:length(seedlist)
[greyvol, fullmedianvals, edfHeader] = sfGetVol(bb, ...
table_fullmedianvals, fullmedianvals, background_subtract, ...
seg.bbox);
edfHeader.headerlength = -1;
end
% label volume
......
......@@ -54,6 +54,7 @@ function edfheader = edf_info(fname)
edfheader = [];
endofheader = [];
edfheader.('headerlength') = 0;
while isempty(endofheader)
% Split lines
htxt = fgetl(fid);
......@@ -83,18 +84,19 @@ function edfheader = edf_info(fname)
% Look for end of header reached
endofheader = find( htxt == '}' );
% Plus 1 is for the newline
edfheader.headerlength = edfheader.headerlength + length(htxt) +1;
end
% Count the bytes of the header, and check if it is a standard header
filePosition = ftell(fid);
if mod(filePosition, 512) ~= 0
fprintf('Header is not multiple of 512 bytes in %s (%d instead)!\n', ...
fname, filePosition);
disp('Setting correctly!')
% XXX - may be cause of errors in edf_read. Check it!
filePosition = round(filePosition/512) * 512;
if (mod(edfheader.headerlength, 512) ~= 0)
warning('EDF:wrong_header_size', ...
'Header is not multiple of 512 bytes in %s (%d instead)!\n', ...
fname, edfheader.headerlength);
% disp('Setting correctly!')
% % XXX - may be cause of errors in edf_read. Check it!
% filePosition = round(filePosition/512) * 512;
end
edfheader.('headerlength') = filePosition;
% Release Resource
fclose(fid);
......
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