source: trunk/src/readCineHeader.m @ 980

Last change on this file since 980 was 979, checked in by sommeria, 4 years ago

phantom added, series corrected

File size: 2.6 KB
Line 
1function [CineFileHeader, BitmapInfoHeader, CameraSetup, imageLocations,  annotationSize] = readCineHeader(filePath)
2
3fid = fopen(filePath);
4
5CineFileHeader.Type = fread(fid, 1, 'uint16');
6CineFileHeader.Headersize = fread(fid, 1, 'uint16');
7CineFileHeader.Compression = fread(fid, 1, 'uint16');
8CineFileHeader.Version = fread(fid, 1, 'uint16');
9CineFileHeader.FirstMovieImage = fread(fid, 1, 'int32');
10CineFileHeader.TotalImageCount = fread(fid, 1, 'uint32');
11CineFileHeader.FirstImageNo = fread(fid, 1, 'int32');
12CineFileHeader.ImageCount = fread(fid, 1, 'uint32');
13CineFileHeader.OffImageHeader = fread(fid, 1, 'uint32');
14CineFileHeader.OffSetup = fread(fid, 1, 'uint32');
15CineFileHeader.OffImageOffsets = fread(fid, 1, 'uint32');
16CineFileHeader.TriggerTime = fread(fid, 1, 'uint64')/2^32; % Epoch time (secs since jan 1, 1970)
17%CineFileHeader.TriggerTime2 = fread(fid, 1, 'uint32');
18
19BitmapInfoHeader.biSize = fread(fid, 1, 'int32');
20BitmapInfoHeader.biWidth = fread(fid, 1, 'int32');
21BitmapInfoHeader.biHeight = fread(fid, 1, 'int32');
22BitmapInfoHeader.biPlanes = fread(fid, 1, 'uint16');
23BitmapInfoHeader.biBitCount = fread(fid, 1, 'uint16');
24BitmapInfoHeader.biCompression = fread(fid, 1, 'uint32');
25BitmapInfoHeader.biSizeImage = fread(fid, 1, 'uint32');
26BitmapInfoHeader.biXPelsPerMeter= fread(fid, 1, 'uint32');
27BitmapInfoHeader.biYPelsPerMeter= fread(fid, 1, 'int32');
28BitmapInfoHeader.biClrUsed = fread(fid, 1, 'uint32');
29BitmapInfoHeader.biClrImportant = fread(fid, 1, 'uint32');
30
31fseek(fid, hex2dec('0354'), 'bof');
32CameraSetup.FrameRate = fread(fid, 1, 'uint32');
33
34fseek(fid, hex2dec('0360'), 'bof');
35CameraSetup.PostTrigger = fread(fid, 1, 'uint32');
36
37fseek(fid, hex2dec('03D4'), 'bof');
38CameraSetup.RealBPP = fread(fid, 1, 'uint32');
39
40fseek(fid, hex2dec('16B8'), 'bof');
41CameraSetup.BlackLevel = fread(fid, 1, 'uint32');
42
43fseek(fid, hex2dec('16BC'), 'bof');
44CameraSetup.WhiteLevel = fread(fid, 1, 'uint32');
45
46fseek(fid, hex2dec('1B48'), 'bof');
47CameraSetup.fGain16_8 = fread(fid, 1, 'float32');
48
49fseek(fid, hex2dec('17CC'), 'bof');
50CameraSetup.fOffset = fread(fid, 1, 'float32');
51
52fseek(fid, hex2dec('17D0'), 'bof');
53CameraSetup.fGain = fread(fid, 1, 'float32');
54
55fseek(fid, hex2dec('17DC'), 'bof');
56CameraSetup.fGamma = fread(fid, 1, 'float32');
57
58fseek(fid, hex2dec('27D4'), 'bof');
59CameraSetup.RecBPP = fread(fid, 1, 'uint32');
60
61
62fseek(fid, CineFileHeader.OffImageOffsets, 'bof');
63imageBlockLocations = fread(fid, CineFileHeader.ImageCount, 'int64');
64
65
66fseek(fid, imageBlockLocations(1), 'bof');
67annotationSize = fread(fid, 1, 'uint32');
68
69
70imageLocations = imageBlockLocations + annotationSize;
71
72fclose(fid);
Note: See TracBrowser for help on using the repository browser.