I would like to assign one or more values to an image. How do I do that?
I'm writing a PlugIn to perform noise analysis on infrared images. At some point, the algorithm asks the User to input a "signal transfer function" (SiTF) that maps image units to degrees-Centigrade. After running my analysis, I'd like to be able to assign the SiTF value to the image. Why? So that if I run the analysis again (on, say, a different ROI) I don't have to type the darned number in again. I can just read it off the image. Visual Basic used to have "tags" for any object; they were strings that could be used for anything. I'm wondering if there is something similar associated with an Image within ImageJ that I can use to store my SiTF value. Any ideas? Dwight Bartholomew |
You can save the value as the "Info" image property. Use
imp.setProperty("Info", ""+value); to save the value and this method double getValue(ImagePlus imp) { Object info = imp.getProperty("Info"); if (info!=null && info instanceof String) return Tools.parseDouble((String)info, Double.NaN); else return Double.NaN; } to retrieve it. In a macro use setMetadata(value); to save the value and value = getMetadata(); to retrieve it. -wayne On Jan 29, 2008, at 4:50 PM, Dwight U. Bartholomew wrote: > I would like to assign one or more values to an image. How do I do > that? > > I'm writing a PlugIn to perform noise analysis on infrared images. At > some point, the algorithm asks the User to input a "signal transfer > function" (SiTF) that maps image units to degrees-Centigrade. > > After running my analysis, I'd like to be able to assign the SiTF value > to the image. Why? So that if I run the analysis again (on, say, a > different ROI) I don't have to type the darned number in again. I can > just read it off the image. > > Visual Basic used to have "tags" for any object; they were strings that > could be used for anything. I'm wondering if there is something > similar > associated with an Image within ImageJ that I can use to store my SiTF > value. > > Any ideas? > > Dwight Bartholomew > |
In reply to this post by DwightBart
The ImagePlus object has a the following methods:
setProperty(String key, Object value) getProperty(String key) I don't know if they get saved if you save out the file, but for changing ROIs, it should work just fine. --David ---------------------------------------- David Hovis Senior Research Associate Department of Materials Science Case Western Reserve University [hidden email] On Jan 29, 2008, at 4:50 PM, Dwight U. Bartholomew wrote: > I would like to assign one or more values to an image. How do I do > that? > > I'm writing a PlugIn to perform noise analysis on infrared images. At > some point, the algorithm asks the User to input a "signal transfer > function" (SiTF) that maps image units to degrees-Centigrade. > > > > After running my analysis, I'd like to be able to assign the SiTF > value > to the image. Why? So that if I run the analysis again (on, say, a > different ROI) I don't have to type the darned number in again. I can > just read it off the image. > > > > Visual Basic used to have "tags" for any object; they were strings > that > could be used for anything. I'm wondering if there is something > similar > associated with an Image within ImageJ that I can use to store my SiTF > value. > > > > Any ideas? > > > > Dwight Bartholomew |
Free forum by Nabble | Edit this page |