gtatters / Thermimage

R Package for working with radiometric thermal image files and data
GNU General Public License v3.0
164 stars 41 forks source link

AFF SEQ Files #22

Open mkostrun opened 1 year ago

mkostrun commented 1 year ago

This is more of a comment than issue:

I have an ancient FLIR SC6000 camera which came with even more ancient software for camera control/data acquisition called ExaminIR v. 1.20, so called, Basic version (as opposed to Pro and Max).

The basic version records thermal movies as files with an extension .SEQ. Their header suggests it is an Agema File Format (AFF) for sequence of thermal images. The exiftool cannot read these files (reviewing its source code suggests only the files with header FFF can be read). Flir software tools cannot read the format either (tested with ResearchIR, and so forth). I was wondering if you had insights into AFF beyond what exiftool does and does not provide. Do you have a copy of later version of Examin IR, or Pro or Max?

Currently, for me the only way to get the frames out without relying on a supply of graduate students or interns, is to do some desktop programming, and have that program move the cursor around to extract the images into csv files, but this takes 20seconds/frame.

Thanks,

gtatters commented 1 year ago

what FLIR does from software to software, camera to camera is always a mystery (purposely no doubt). maybe send me a sample file since I don't know what your question really is. As you can tell from this package, we make use of exiftool's extraction capacity.

mkostrun commented 1 year ago

It was not really a question. I am dealing with old legacy software and was just wondering how far back does your knowledge go. According to the receipts, the camera sc4000 was$75;000: while the software examinir with dongle was$15,000.The software was for winxp, which I put on a virtual machine, and only thing that is killing me is how to split those seq files to temperature pixel csv.—————————On Mar 17, 2023, at 08:58, Glenn Tattersall @.***> wrote: what FLIR does from software to software, camera to camera is always a mystery (purposely no doubt). maybe send me a sample file since I don't know what your question really is. As you can tell from this package, we make use of exiftool's extraction capacity.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***>

gtatters commented 1 year ago

Splitting the files should still be possible. Admittedly, this R package isn't the best for working with videos since R isn't a fast environment to work. You could explore some bash/terminal code I've shared here: https://github.com/gtatters/ThermimageBash

I know this code works on old .SEQ files collected with Thermocam Researcher Pro as far back as 2008 when I first started collecting. It also works on .SEQ or .FCF files collected with ExaminIR.

But Thermimage mostly converts the files into their raw data, and then those raw files can be imported into ImageJ and you could use ThermimageJ (https://github.com/gtatters/ThermimageJ) to convert the raw data into temperature. These files would be smaller than working with .csv temperature files anyway.

If you have a small file you want me to test things out with to verify the code can operate on it, please feel free to share via wetransfer.com. My email can be found on my lab website: https://tattersalllab.com/contact-information/

mkostrun commented 1 year ago

The splitting of the file  is based on the assumption that 0xfff marks the beginning of individual frames. Hex editor shows that .seq files I have, start with 0xaff, but this does not repeat within the file.As for csv files, they are not the problem. The problem is that the flir software I have, examinir, is basic version (as opposed to pro or max), and this is the only export that is supported.My workflow is thus, create seq file using examinir and human operator, followed by loading the same seq into the examinir and then use desktop programming to extract frames as csv’s. As i said earlier this is painfully slow: it takes 2hrs per 300-frame seq file, and requires supervision, and cannot be made in a single batch process.I will send you a short seq file on Monday. All I have are 74megs 450-frame files.MK —————————On Mar 17, 2023, at 18:02, Glenn Tattersall @.***> wrote: Splitting the files should still be possible. Admittedly, this R package isn't the best for working with videos since R isn't a fast environment to work. You could explore some bash/terminal code I've shared here: https://github.com/gtatters/ThermimageBash I know this code works on old .SEQ files collected with Thermocam Researcher Pro as far back as 2008 when I first started collecting. It also works on .SEQ or .FCF files collected with ExaminIR. But Thermimage mostly converts the files into their raw data, and then those raw files can be imported into ImageJ and you could use ThermimageJ (https://github.com/gtatters/ThermimageJ) to convert the raw data into temperature. These files would be smaller than working with .csv temperature files anyway. If you have a small file you want me to test things out with to verify the code can operate on it, please feel free to share via wetransfer.com. My email can be found on my lab website: https://tattersalllab.com/contact-information/

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***>

gtatters commented 1 year ago

my perl script (split.pl) can recognise some headers and that's what I will try with a sample file. The default one I'd first look for is "\x46\x46\x46\x00" but can try some others, simply to get and .fff file.

gtatters commented 1 year ago

The more up to date one is on ThermimageJ: https://github.com/gtatters/ThermImageJ/blob/master/scripts/split.pl

mkostrun commented 1 year ago

Ok, I reanalyzed the hex file. There is a header followed by 0xff2, then frame header, then 163,840 bytes for 320x256 pixels as uint16_t.This 0xff2 indicates subsequent frames. You wrote about converting from 16bit to float. Where would that data be in the header?—————————On Mar 18, 2023, at 07:49, Glenn Tattersall @.***> wrote: The more up to date one is on ThermimageJ: https://github.com/gtatters/ThermImageJ/blob/master/scripts/split.pl

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***>

gtatters commented 1 year ago

Not sure there will be any info on the conversion from 16bit to float within the file, but what could be stored within the info prior to the pixel start will be calibration constants for the conversion. Exiftool might be able to extract them for you.

https://exiftool.org/TagNames/FLIR.html

EEVBlog have a huge forum discussing how to convert FFF files into temperature.

And Walter Minkina's book discusses the algorithm to convert the raw value into temperature. Minkina, W. and Dudzik, S. 2009. Infrared Thermography: Errors and Uncertainties. Wiley Press, 192 pp.

the conversion formula is also contained within the raw2temp() function in the Thermimage package, but requires that you have the calibration coefficients (exiftool refers to them as Planck coefficients in reference to the formula used).

maybe try running:

exiftool yourfilename.seq

and share the output here?

mkostrun commented 1 year ago

Figured out how to descramble the uint16_t’s to get the proper uint’s. So now I have a conversion curve between temperatures and uint’s that can be constructed for each frame. The curve appears quadratic, with negative second derivative so probably there should be in the seq file offset and curve coefficients stored somewhere.—————————On Mar 18, 2023, at 17:48, Glenn Tattersall @.***> wrote: Not sure there will be any info on the conversion from 16bit to float within the file, but what could be stored within the info prior to the pixel start will be calibration constants for the conversion. Exiftool might be able to extract them for you. https://exiftool.org/TagNames/FLIR.html EEVBlog have a huge forum discussing how to convert FFF files into temperature. And Walter Minkina's book discusses the algorithm to convert the raw value into temperature. Minkina, W. and Dudzik, S. 2009. Infrared Thermography: Errors and Uncertainties. Wiley Press, 192 pp. the conversion formula is also contained within the raw2temp() function in the Thermimage package, but requires that you have the calibration coefficients (exiftool refers to them as Planck coefficients in reference to the formula used). maybe try running:

exiftool yourfilename.seq

and share the output here?

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***>

gtatters commented 1 year ago

yes, a quadratic describing the relationship between the raw data and temperature would work. It's one of the solutions I have in my imageJ code.

turgut-aydemir commented 3 months ago

Hi, i have a huge .seq file (21GB) and i need to read temperature values for each frame of it. how can i do it?