Support the Arctic Sea Ice Forum and Blog

Author Topic: ImageJ = Photoshop for Scientists  (Read 13958 times)

anonymous

  • Guest
ImageJ = Photoshop for Scientists
« on: March 27, 2013, 08:44:37 AM »
I just like to point to this apparently unknown piece of excellent software, which allows you to do really amazing things. ImageJ was build with Java, so it runs on all systems supporting Java, it is free and has a strong community within health science.



These are the features I like the most:

Read binary data, practically it means you can read NSIDC extent maps (*.bin) and PIOMAS gridded data (*.heff). Here is a tutorial with Walt Meier explaining the extent part: Exploring Sea Ice Data from Satellites

Arbitrary large images, if your images go beyond 10,000 pixels your machine may struggle. ImageJ handles this nicely. Here is an example with 35668 x 14558 pixels I made of hourly images of Coast Guard Cutter Healy in the Arctic.

Cool plugins, here the: list. Check out the analysis section.

Macros, well even Photoshop and Gimp have macros, but ImageJ has a recorder. So, once you find yourself doing same thing over and over again, record your actions, edit the macro to your needs and run it by clicking an icon. Downloading images and saving them as animated gif is a snap.

Stacks, basically layers, but more powerful. Here ImageJ turns into an animation editor, you can explore a stack of images with your mouse wheel, very comfortable. ImageJ saves stacks as tiff, animated gif or AVI.




« Last Edit: March 27, 2013, 09:01:18 AM by arcticio »

A-Team

  • Young ice
  • Posts: 2977
    • View Profile
  • Liked: 944
  • Likes Given: 35
Re: ImageJ = Photoshop for Scientists
« Reply #1 on: July 19, 2015, 05:11:00 AM »
I use ImageJ2 quite a bit. It is very convenient in terms of updating all of its many .jars (java archive plugins) every time it starts up. A great many independent academics drop their favorite analytic tool and explanation into this architecture. It has the great advantage of correctly opening and processing 16 and 32 bit images; the former is essential when working with Landsat-8.

It has lately become quite easy to switch back and forth seamlessly to Gimp and online G'mac. This adds a very large number of capabilities that no one program has alone. The most important single command in ImageJ1 (FIJI) is local adaptive contrast, called CLAHE in the Process menu. This is missing in Gimp which uses instead a global histogram equalization under the Auto menu..

Below, I used another command to adjust a palette that the University of Hamburg uses to encode sea ice concentration. There is nothing wrong with the original palette. It is a logical grayscale step palette, with blue hue tinting, appropriate for open water they wish to display. However, weak blues become difficult for the eye to distinguish from white -- yet these low sea ice concentrations are often a sign of things to come.

Below I used ImageJ2 'exp' under Process -> Math menu to exponentiate the map and embedded palette. This give much greater emphasis to scattered weak bluish pixels. The original resolution at of 3.125 km is retained. A similar effect could be created, but not so easily or systematically, by adjusting gamma within Gimp.

Click to get the animation started. The 19 July 15 Bremen version should start on its own.
« Last Edit: July 20, 2015, 11:29:22 PM by A-Team »

A-Team

  • Young ice
  • Posts: 2977
    • View Profile
  • Liked: 944
  • Likes Given: 35
Re: ImageJ = Photoshop for Scientists
« Reply #2 on: July 20, 2015, 02:54:28 AM »
ImageJ is bizarre in its haphazard provisioning of 'undo'. This is a shock after coming from Gimp with its unlimited depth of undo (plus direct navigation to the last acceptable versions). Sometimes ImageJ has one level, sometimes none at all -- and only sometimes is that preceded by a warning. It doesn't matter how much RAM is allocated to it.

For workarounds, I tend to do short sequences of commands, then save or more commonly exit to Gimp via Copy to System Clipboard for polishing steps. That way, no harm done by no undo -- just close the file, re-open and re-do. Alternatively, I make a duplicate of the working file before experimenting on it with a dodgy new command. Some menu items offer this as a checkbox.

ImageJ is also odd in that it is hard to say when it has committed to a step vs simply presented you with a preview not labelled as such.

It also provides no choices within the set of open windows. For example, it will try make a stack out of everything open, there is no way of selecting a subset. There is no way of re-ordering files in a stack -- that maymake no sense for a time series but does in making attractive colors by shuffling RGB channels. Here the files must be sequentially uploaded in the desired final order.

For these reasons -- and a memory leak that can drain 16 GB of RAM, leaving other applications with nothing -- I tend to shut it down frequently and get a clean start. The programmers claim this is not a memory leak per se -- I guess it all depends on what you mean by 'per se'. Excellent resource: http://imagej.net/Frequently_Asked_Questions

While I am yet to use 2% of the plugins, it's worth noting that biomedical film, slicing, ROI movement and gel enhancements, as well as their analysis, are very similar to improving poor contrast images encountered in Greenland, the Arctic and Antarctica and in making time series of ice and glacier movements. Both groups of researchers are stuck with a certain level of resolution and have to make the most of it.

One more thing I use a lot: the vast range of file types that can be imported. Here is a big difference between a scientific tilt (ImageJ) and artistic (Gimp) -- the former are very keen to import raw data as image.

One import command that is really under-used on these forums is "Extract images from PDF..." which pulls out the full author-submitted resolution of journal pictures. You cannot get at these by simply enlarging a journal pdf in a web browser or pdf reader as these just provide quickie linear interpolation that loses resolution upon screen capture. If the authors only submitted a cheesy resolution, try imageraider.com to locate a better resolution image elsewhere on the internet.
« Last Edit: July 20, 2015, 04:09:46 PM by A-Team »

A-Team

  • Young ice
  • Posts: 2977
    • View Profile
  • Liked: 944
  • Likes Given: 35
Re: ImageJ = Photoshop for Scientists
« Reply #3 on: July 20, 2015, 05:01:37 PM »
With daily satellite coverage, we often want to display a time series as animation. While this is straightforward (see post #1 by long-gone Anonymous) from an ImageJ stack if the individual frames are already optimal and not too big, more commonly some 3-4 step enhancement needs to be applied to each frame.

This can get really tedious in Gimp layers because of erratic implementation of chaining -- only a handful of commands can be set to apply to single layers, active layers, chained-up layers, or all layers. In particular, common contrast adjustments only apply to the active layer, making it necessary to step through the layers applying the commands repetitively. Gimp does have an automated batch mode that was in early beta last time I tried it.

ImageJ has macros but more importantly, a macro recorder. This means just walking through whatever steps that need to be taken on an image with the recorder on and saving as a menu tool. I do not have the time or interest to delve into scripting languages because my tasks change too often -- most of my automation needs are one-time, one-off (ie, the macro needs to be faster than manual in getting a postable product) so I am looking for something completely mindless like this recorder.

An ImageJ macro will run on a target folder, producing a product folder. Nothing unusual about that but it means the individual files do not need to be opened and stacked, which could be quite onerous in the case of gigabyte Landsat and Sentinel images.

If the target folder can be remote (specified by its url), the whole time-wasting download-to-hard-drive step could be skipped -- desirable if these files are only needed temporarily. Many satellite sites are very systematically organized in terms of folders and file naming.

However commonly a given folder contains multiple variations of the same basic file, eg high or low resolution (AMSR ice maps); location map, annotated, unannotated (Cresis); preview, metadata, bands (Landsat) and so forth. In these situations, it is easy to compile a list of the subset urls. I don't know if ImageJ can accept a list of remote urls as target. The other issue is daily updating -- how to add a new frame or two to an existing animation without redoing the entire computation.

ImageJ explains step-by-step macro recording in several tutorials and provides many concrete examples. I will add some new ones that perform common cryosphere tasks as time permits.

http://rsbweb.nih.gov/ij/docs/guide/146-14.html
http://fiji.sc/Introduction_into_Macro_Programming
http://rsb.info.nih.gov/ij/developer/macro/macros.html
http://rsb.info.nih.gov/ij/developer/macro/functions.html