Creating or appending to 'Image Info' from a Plug-in

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Creating or appending to 'Image Info' from a Plug-in

Richard VanMetter
In my work it is often useful to add information to the 'Image Info'
header of tiff files. This allows the information to be conveniently
accessed with >Image>Show Info in ImageJ. While this can be done
manually from a Text Window via the '>Edit>Copy to Image Info' menu
selection, I wanted to be able to do this automatically from within a
plug-in. As a result, I have recently researched how to append
information to the 'Image Info' header from within a plug-in and thought
it might be useful to others.

The following is a section of java that copies 'Image Info' from the
input image, appends additional information and attaches it to the
output image. This is done in the context of a Plug-in Filter where 'ip'
is the input imageProcessor and 'imp' is the input imagePlus.


     // get Info from the input imagePlus
         Object prop = imp.getProperty("Info");
         String impInfo = (String)prop;

     // create a new imagePlus object for the output imageProcessor ipOut
         ImagePlus impOut = new ImagePlus("Title of New Image",ipOut);

     // create the Info string for the output image
         String impOutInfo = "String to be pre-appended"
             +impInfo
             +"String to be post-appended";

     //set the value of Info in the output image
         impOut.setProperty("Info", impOutInfo);


The key thing in the above is that the required imagePlus property is
"Info".

I hope others find this useful, particularly where multiple 'processed'
versions of an input image are being created with different plugins or
parameters. When applying a series of plug-ins, this approach can
provide a detailed account of what image processing has been applied to
an image. This documentation is then viewable in ImageJ using the
'>Image>Show Info' menu selection.

Best wishes to all,
Richard VanMetter
Reply | Threaded
Open this post in threaded view
|

Re: Creating or appending to 'Image Info' from a Plug-in

Gong
Hi VanMetter

I really appreciate your code; it would save people a lot of time organzing data.

However, when I put your code in Beanshell of micromanager, I get "general error : imp .getProperty ( "Info" )". Am I (a beginning) using the code the right way? How should implement the code function?

Thank you in advance.

Gong