No BSD License
-
channelinforead(fid, lsminf)
CHANNELINFOREAD Read in channelinfo from Zeiss LSM file format
-
ifdread(fid)
IFDREAD read IFD entries from TIFF file according to TIFF standard
-
lsminfo(filename)
LSMINFO read headers and entry directories for Zeiss LSM files
-
scaninforead(fid, offset)
SCANINFOREAD Read in scaninfo database of Zeiss LSM file format
-
structappend(struct, field, v...
STRUCTAPPEND
-
structcombine(struct1, struct...
STRUCTCOMBINE
-
structmap(tagcode, map, numpr...
STRUCTMAP use struct as a map between field names and values
-
structread(fid, structdef);
STRUCTREAD read in structured data
-
structsizeof(structdef)
STRUCTSIZEOF Determine size (in bytes) of struct to be read
-
timestampsread(fid, lsminf)
TIMESTAMPSREAD Read in actual timestamps from Zeiss LSM file format, do some
-
LSM_H.m
-
TIFF_H.m
-
contents.m
-
contents.m
-
View all files
from
LSM File Toolbox
by Peter Li
Functions for reading info databases of Zeiss LSM confocal microscope files.
|
| structsizeof(structdef)
|
function [size, errormsg] = structsizeof(structdef)
%STRUCTSIZEOF Determine size (in bytes) of struct to be read
% SIZE = STRUCTSIZEOF(STRUCTDEF)
%
% Peter Li 30-Aug-05
% Some rights reserved. Licensed under Creative Commons: http://creativecommons.org/licenses/by-nc-sa/3.0/
if nargin ~= 1 | ~isstruct(structdef), error('First argument must be struct definition'); end
size = 0;
errormsg = '';
fields = fieldnames(structdef);
for i = 1:length(fields);
datatype = structdef.(fields{i});
% Parse num
starind = strfind(datatype, '*');
if length(starind) > 1, error(['Incorrect datatype format: ' datatype]); end
if starind
num = str2num(datatype(1:starind(1) - 1));
datatype = datatype(starind(1)+1:end);
else
num = 1;
end
switch datatype
case {'uchar' 'schar' 'uint8' 'int8'}
size = size + num;
case {'uint16' 'int16'}
size = size + (2 * num);
case {'uint32' 'int32' 'single' 'float32'}
size = size + (4 * num);
case {'uint64' 'int64' 'double' 'float64'}
size = size + (8 * num);
otherwise
size = -1;
errormsg = ['Unknown datatype: ' datatype];
return;
end
end
|
|
Contact us at files@mathworks.com