Use R and support open source science!

Recently I have been using R for much of our data handling and analysis.

I am also interested in encouraging graduate and undergraduate students to adopt computational analytical skills early and strongly encourage them to learn how to code. I have started an informal coding group for biology students in the department who want to get started using R.

Please see the following sites:


I also maintain scripts, projects, and packages for analyzing data in my lab on the programming website github:

All scripts written here are used in the normal data analysis in my research laboratory. They are provided here for ease of access to my students and to facilitate updates.

If you are interested in using or improving these scripts, feel free to do so. At present, they are not very transferrable, being written with a particular problem in mind.


I have also made an on-line software tool using Shiny in R that helps perform the simple calculations used in an instrument in my lab that calibrates gas flow meters:


I have also developed a package for R, called “Thermimage”, which a collection of functions to assist in some of the nitty gritty calculations involved in thermal imaging.  Some of these are related to a desire to get thermal images converted into a structure that can be analysed and to streamline various correction factors that should be applied to thermal image analysis.

I have included a simple “tutorial” for Thermimage on github:

If you do get into trying to model your heat exchanges, maybe read through this link:

Working with FLIR’s software can be a challenge.  It is powerful for certain, but not suited for biological applications. It is also only available for users of Windows (FLIR has no useful Mac OSX alternative despite the heavy prevalence of Macs in Academia: hint, hint).  Software updates cost thousands of dollars and often crash (I spent $5K on Researcher R&D software, which could only run on one machine, eventually crashed and would not operate on a 64 bit OS).  So, for biologists on low budgets, if you are able to borrow a thermal camera to capture images, how do you analyse them without sacrificing a limb?  Solution: convert them to a file format that can be analysed with open source image analysis (ImageJ) which is far superior to the FLIR software anyway.  If you have a FLIR jpg, try this script out to convert your files into .csv, .png, or .pdf files to import into imageJ:



We also work with open source image analysis software, such as ImageJ, to analyse videos (image stacks) or import thermal image files.  Having access to the array of open-source plug-ins offered from other scientists is a an excellent resource.

The easiest way to facilitate access to all the latest plugins is to install FIJI, which is a wrapper for ImageJ with all the custom add-ons.

Not everything you need is installed in FIJI.  We have been importing text image files (csv files that are simply a c x r dimension matrix of temperature data that can be viewed in Excel numerically, or imported as an image into ImageJ/FIJI.  To do this, you have to install a custom batch macro.  Here is brief video tutorial showing how to install the custom macro to your start-up macros for easier access:

Once installed, you can now import a folder full of images for analysis of temperature (ImageJ calls these intensity values) as follows:

We have also assembled a collection of functions and macros and command line tools (ThermImageJ) that can allow you to use ImageJ directly to import and analyse thermal images.  See:

A demo is available on youtube:


4 thoughts on “Coding

  1. ThermImageJ is a really helpful piece of software and it is fantastic that you have made it freely available! I have (so far) just one question: Is it possible to use ThermImageJ commands in scripts? I tried to record a script while importing a FLIR jpg but this didn’t work. It would also be helpful to have something like a “one click FLIR jpg import” that simply accepts all parameters and constants that are read from the FLIR file.
    Best regards, Klaus


    • Hi Klaus. Thanks for the positive comment. Technically, yes and no is the answer. Yes, in the sense that all of the functions in ThermimageJ are basically ImageJ’s macro language, and I wouldn’t be bothered if you edited the ThermimageJ.ijm file yourself, but that is not a great solution. The reason I have implemented the extra step is 2 fold: the conversion process converts the 16 bit grey scale into a 32 bit numeric temperature value and this can’t be reversed once implemented (I call this the ‘slow’ calculation). Typically, my experience has been that the settings saved in the file are incorrect and need adjusting by the user anyway, which is why the window prompt is there.

      When I have time, I could try to implement different import JPG macro that just accepts the saved object parameters, but my worry is that will cause more confusion for many users who barely understand what these object parameters mean and generate lots of bad conversions that users may not be aware of.

      For future ref, please feel free to add comments to the github repository:

      It is easier for me to keep track of questions there and provide fixes/updates.


  2. I have added a new release that might help you out. v2.6.
    It basically bypasses the requirement for a dialog prompt window. I haven’t fully tested it, and this is not how I would use my macros anyway so it might not be what you need.
    I’ve basically added a query in the function that if the user wants to use the default parameters, the function will simply prompt for a file input and do its best to import and convert. I defaulted to greyscale palette for simplicity. Please use the github site for further questions so I have a record of edits/fixes/changes.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s