Changeset 993 for trunk/src/readCineHeader.m
- Timestamp:
- Feb 6, 2017, 11:29:01 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/readCineHeader.m
r979 r993 1 function [CineFileHeader, BitmapInfoHeader, CameraSetup, imageLocations, annotationSize] = readCineHeader(filePath)1 function [CineFileHeader, BitmapInfoHeader, CameraSetup, TimeOnlyBlock, ExposureOnlyBlock, TimeCodeBlock, imageLocations, annotationSize] = readCineHeader(filePath) 2 2 3 3 fid = fopen(filePath); … … 28 28 BitmapInfoHeader.biClrUsed = fread(fid, 1, 'uint32'); 29 29 BitmapInfoHeader.biClrImportant = fread(fid, 1, 'uint32'); 30 31 fseek(fid, hex2dec('00E2'), 'bof'); 32 CameraSetup.Length = fread(fid, 1, 'uint16'); 33 34 fseek(fid, hex2dec('0370'), 'bof'); 35 CameraSetup.FirmwareVersion = fread(fid, 1, 'uint32'); 36 37 fseek(fid, hex2dec('0374'), 'bof'); 38 CameraSetup.SoftwareVersion = fread(fid, 1, 'uint32'); 30 39 31 40 fseek(fid, hex2dec('0354'), 'bof'); … … 60 69 61 70 71 %% Tagged Information Blocks 72 % AnalogDigitalSignals (ADS) -> not contained in MIRO cine-files 73 % ImageTimeTaggedBlock (ITTB) -> not contained in MIRO cine-files 74 75 % TimeOnlyBlock (TOB) -> Type should be 1002 76 PositionTOB = CineFileHeader.OffSetup + CameraSetup.Length; 77 fseek(fid, PositionTOB , 'bof'); 78 TimeOnlyBlock.Length = fread(fid, 1, 'uint32'); 79 TimeOnlyBlock.Type = fread(fid, 1, 'uint16'); 80 TimeOnlyBlock.Reserved = fread(fid, 1, 'uint16'); 81 TimeOnlyBlock.Data = transpose([1:CineFileHeader.ImageCount ; fread(fid,[2,CineFileHeader.ImageCount], 'uint32')]); % Framenumber combined with Data contained in TOB 82 TimeOnlyBlock.TimestampsDatetime = datetime(TimeOnlyBlock.Data(:,3), 'ConvertFrom', 'posixtime'); % Timestamp as Datetime 83 % TimeOnlyBlock.TimestampsDatestr = datestr(TimeOnlyBlock.TimestampsDatetime); % Timestamp as String 84 TimeOnlyBlock.TimestampsMillisec = TimeOnlyBlock.Data(:,2)./(2^32); % Milliseconds of the Timestamp 85 TimeOnlyBlock.ExposureTimeDelays = [0 ; TimeOnlyBlock.TimestampsMillisec(2:end)-TimeOnlyBlock.TimestampsMillisec(1:end-1)]; % Timedifference between two frames. First frame is set to have no timedifference 86 87 % ExposureOnlyBlock (EOB) -> Type should be 1003 88 PositionEOB = PositionTOB + TimeOnlyBlock.Length; 89 fseek(fid, PositionEOB , 'bof'); 90 ExposureOnlyBlock.Length = fread(fid, 1, 'uint32'); 91 ExposureOnlyBlock.Type = fread(fid, 1, 'uint16'); 92 ExposureOnlyBlock.Reserved = fread(fid, 1, 'uint16'); 93 ExposureOnlyBlock.Data = fread(fid,CineFileHeader.ImageCount, 'uint32'); 94 ExposureOnlyBlock.ExposureTimesMillisec = ExposureOnlyBlock.Data ./(2^32) .*1000; 95 ExposureOnlyBlock.test1 = fread(fid, 1, 'uint32'); 96 ExposureOnlyBlock.test2 = fread(fid, 1, 'uint16'); 97 ExposureOnlyBlock.test3 = fread(fid, 1, 'uint16'); 98 99 % RangeDataBlock (RDB) -> not contained in MIRO cine-files 100 % BinSigBlock (BSB) -> not contained in MIRO cine-files 101 % AnaSigBlock (ASB) -> not contained in MIRO cine-files 102 103 % TimeCodeBlock (TCB) -> Type should be 1007 104 PositionTCB = PositionEOB + ExposureOnlyBlock.Length; 105 fseek(fid, PositionTCB , 'bof'); 106 TimeCodeBlock.Length = fread(fid, 1, 'uint32'); 107 TimeCodeBlock.Type = fread(fid, 1, 'uint16'); 108 TimeCodeBlock.Reserved = fread(fid, 1, 'uint16'); 109 TimeCodeBlock.Data = fread(fid, 1, 'uint8'); 110 111 112 %% Image Locations and their Annotations 62 113 fseek(fid, CineFileHeader.OffImageOffsets, 'bof'); 63 114 imageBlockLocations = fread(fid, CineFileHeader.ImageCount, 'int64'); 64 65 115 66 116 fseek(fid, imageBlockLocations(1), 'bof'); 67 117 annotationSize = fread(fid, 1, 'uint32'); 68 118 69 70 119 imageLocations = imageBlockLocations + annotationSize; 71 120 121 122 %% 72 123 fclose(fid);
Note: See TracChangeset
for help on using the changeset viewer.