How to open .lmf file
이전 댓글 표시
Dear All,
I have the pointclass3.lmf file as attached. But I dont know how to open it. In manual just said like below:
"This routine saves information about the photon history in a binary list mode file. The file will have the extension *.lmf. To save disk space, each record of a history in the binary file will have nine 16-bit integer values, one 64-bit float value, and one 8-bit value in the order indicated in the table. "
Anyone can hel me?
댓글 수: 8
Walter Roberson
2024년 11월 22일
.lmf files just might be related to https://amo-csd.lbl.gov/downloads/LMF2ROOT%20in%20a%20nutshell.pdf
I have no idea what the file is, but maybe this is a start.
% i'm assuming byte order and signedness of integer classes
% is there a header? file length is not integer-divisible by described record length
% i'm assuming that the data is not compressed, and that the there is nothing trailing the data
% that assumption leaves _at least_ 16B that can't be data.
fid = fopen('pointclass3.lmf');
stream = fread(fid,inf,'*uint8');
fclose(fid);
recordlen = 18 + 8 + 1; % 9x16b, 1x64b, 1x8b
headerlen = mod(numel(stream),recordlen); % is there a header??
header = stream(1:headerlen);
data = reshape(stream(headerlen+1:end),recordlen,[]);
% the 16b fields
fields1 = typecast(reshape(data(1:18,:),[],1),'uint16');
fields1 = reshape(fields1,9,[]).';
% the double float field
fields2 = typecast(reshape(data(19:26,:),[],1),'double');
% the 8b field (the recasting here is redundant, but i'm just being explicit)
fields3 = typecast(reshape(data(23,:),[],1),'uint8');
In the case of blindly decoding physical images, there's often some discernable structure that tells us if we're decoding things grossly wrong. With tabular data, we don't really get the same insight. The results can be completely wrong, and I would have no idea.
EDIT: My blind suggestion is probably garbage. This is probably closer, since you seem to be doing a lot of medical image stuff.
That suggests though, that each LMF file should have a text file which describes its structure -- something like a header file. This is at odds with my assumption that the LMF file itself apparently must have had a header due to its length.
Cris LaPierre
2024년 11월 23일
Can you share the table the quoted text refers to?
mohd akmal masud
2024년 11월 23일
편집: Walter Roberson
2024년 11월 23일
mohd akmal masud
2024년 11월 23일
Yee. Well, as much as that looks helpful, I'm not able to download 1.3GB in a reasonable timeframe.
The screenshot does, however tell us that there's an extra field. With that information, the file does appear to have an integer number of records.
fid = fopen('pointclass3.lmf');
stream = fread(fid,inf,'*uint8');
fclose(fid);
recordlen = 20 + 8 + 1; % 10x16b, 1x64b, 1x8b
headerlen = mod(numel(stream),recordlen) % is there a header??
header = stream(1:headerlen);
data = reshape(stream(headerlen+1:end),recordlen,[]);
% the 16b fields
xyz0 = typecast(reshape(data(1:6,:),[],1),'uint16');
xyz0 = reshape(xyz0,3,[]).';
xyzphantom = typecast(reshape(data(7:12,:),[],1),'uint16');
xyzphantom = reshape(xyzphantom,3,[]).';
xyzcrystal = typecast(reshape(data(13:18,:),[],1),'uint16');
xyzcrystal = reshape(xyzcrystal,3,[]).';
energy = typecast(reshape(data(19:20,:),[],1),'uint16');
% the double float field
photonweight = typecast(reshape(data(21:28,:),[],1),'double');
% the 8b field
scatterorder = typecast(reshape(data(29,:),[],1),'uint8');
mohd akmal masud
2024년 11월 23일
mohd akmal masud
2024년 11월 23일
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 National Instruments Frame Grabbers에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


