Hello, I have some non-standard TIFF files, called IRI files, produced by
some IR cameras from Avio. These are almost identical to TIFFs, they share the magic number and many of the TIFF tags. Unfortunately, they redefine a couple of the core TIFF tags, which causes any normal TIFF reader to improperly load the images. However, since these IRIs have the TIFF magic number, ImageJ believes it is a TIFF and improperly loads it. I have made a plugin which reads these IRIs, but of course I want to be able to use the standard File>Open menu as well as drop'n'drop the images. I've modified HandleExtraFiletypes to capture these IRIs, but control never reaches that plugin since ImageJ sees it as a TIFF file. What I've had to do is edit the Opener class, prepending a check for IRI files before the check for TIFF, returning UNKNOWN. This works, but for every new release of ImageJ I need to modify this one file. Is there some other way to do this without modifying the ImageJ code? Or perhaps some quick and easy way to put in my 2 lines of code to Opener.java, perhaps using diffs or something? Thanks, Josh |
Hi Josh,
I think the way ImageJ is currently structured, solving this problem is a bit difficult. I can tell you that the Bio-Formats plugin (http://www.loci.wisc.edu/ome/formats.html) supports many different TIFF variants, regardless of extension. If you implemented your support for IRI as a Bio-Formats file format reader, the Bio-Formats plugin would "do the right thing" with IRI files from then on. And the plugin is scriptable in a macro. But that still doesn't solve the issue with HandleExtraFileTypes. The current strategy there is for ImageJ to try the file itself first, then look for known standalone plugins, then finally try Bio-Formats if all else fails. This has the advantage of allowing standalone plugins to take precedence over Bio-Formats, but it's also a disadvantage in cases like yours, since ImageJ will try to handle the TIFF, rather than passing it off to your plugin or to Bio-Formats. If all you want to do is insert your extra lines of code into Opener.java with every new ImageJ release, you might be able to use diff and patch to do it, but I'm not sure. But it shouldn't be difficult to write a program looking for a particular line of code in Opener.java and insert your extra code immediately thereafter. -Curtis On 12/19/06, Josh Doe <[hidden email]> wrote: > Hello, I have some non-standard TIFF files, called IRI files, produced by > some IR cameras from Avio. These are almost identical to TIFFs, they share > the magic number and many of the TIFF tags. Unfortunately, they redefine a > couple of the core TIFF tags, which causes any normal TIFF reader to > improperly load the images. > > However, since these IRIs have the TIFF magic number, ImageJ believes it is > a TIFF and improperly loads it. I have made a plugin which reads these IRIs, > but of course I want to be able to use the standard File>Open menu as well > as drop'n'drop the images. I've modified HandleExtraFiletypes to capture > these IRIs, but control never reaches that plugin since ImageJ sees it as a > TIFF file. What I've had to do > is edit the Opener class, prepending a check for IRI files before the > check for TIFF, returning UNKNOWN. This works, but for every new > release of ImageJ I need to modify this one file. > > Is there some other way to do this without modifying the ImageJ code? Or > perhaps some quick and easy way to put in my 2 lines of code to Opener.java, > perhaps using diffs or something? > > Thanks, > Josh |
In reply to this post by Josh Doe-2
With ImageJ 1.38f, available at
<http://rsb.info.nih.gov/ij/notes.html>, you can use setOption("OpenUsingPlugins", true); in a macro to have common file types like TIFF, JPEG and GIF opened by external plugins. There is an example at http://rsb.info.nih.gov/ij/macros/ToggleOpenUsingPlugins.txt that demonstrates how to turn this option on and off. -wayne > Hi Josh, > > I think the way ImageJ is currently structured, solving this problem > is a bit difficult. > > I can tell you that the Bio-Formats plugin > (http://www.loci.wisc.edu/ome/formats.html) supports many different > TIFF variants, regardless of extension. If you implemented your > support for IRI as a Bio-Formats file format reader, the Bio-Formats > plugin would "do the right thing" with IRI files from then on. And the > plugin is scriptable in a macro. > > But that still doesn't solve the issue with HandleExtraFileTypes. The > current strategy there is for ImageJ to try the file itself first, > then look for known standalone plugins, then finally try Bio-Formats > if all else fails. This has the advantage of allowing standalone > plugins to take precedence over Bio-Formats, but it's also a > disadvantage in cases like yours, since ImageJ will try to handle the > TIFF, rather than passing it off to your plugin or to Bio-Formats. > > If all you want to do is insert your extra lines of code into > Opener.java with every new ImageJ release, you might be able to use > diff and patch to do it, but I'm not sure. But it shouldn't be > difficult to write a program looking for a particular line of code in > Opener.java and insert your extra code immediately thereafter. > > -Curtis > > On 12/19/06, Josh Doe <[log in to unmask]> wrote: > > Hello, I have some non-standard TIFF files, called IRI files, > produced by > > some IR cameras from Avio. These are almost identical to TIFFs, they > share > > the magic number and many of the TIFF tags. Unfortunately, they > redefine a > > couple of the core TIFF tags, which causes any normal TIFF reader to > > improperly load the images. > > > > However, since these IRIs have the TIFF magic number, ImageJ > believes it is > > a TIFF and improperly loads it. I have made a plugin which reads > these IRIs, > > but of course I want to be able to use the standard File>Open menu > as well > > as drop'n'drop the images. I've modified HandleExtraFiletypes to > capture > > these IRIs, but control never reaches that plugin since ImageJ sees > it as a > > TIFF file. What I've had to do > > is edit the Opener class, prepending a check for IRI files before the > > check for TIFF, returning UNKNOWN. This works, but for every new > > release of ImageJ I need to modify this one file. > > > > Is there some other way to do this without modifying the ImageJ > code? Or > > perhaps some quick and easy way to put in my 2 lines of code to > Opener.java, > > perhaps using diffs or something? > > > > Thanks, > > Josh > |
Free forum by Nabble | Edit this page |