Posted by
Aryeh Weiss on
May 09, 2017; 1:23pm
URL: http://imagej.273.s1.nabble.com/how-to-set-calibration-in-API-tp5018687.html
I wrote a python script to import my AFM image files, and it works
great. These are small text images, with some metadata prepended, so I
used this example as a starting point:
http://imagej.net/Jython_Scripting_Examples#Creating_an_image_from_a_text_fileHowever, one of the things that I want to do is to set the spatial
calibration of the imported image.
Right now I am doing it this way:
IJ.run(imp, "Properties...", "channels=1 slices=1 frames=1 unit=micron
pixel_width="+str(xCal)+" pixel_height="+str(yCal)+" voxel_depth=1.0000")
where xCal and yCal are previously found from the metadata.
There must be a way to do it without this call to IJ.run
I thought to use the Calibration class:
https://imagej.nih.gov/ij/developer/api/ij/measure/Calibration.htmland this let me set the units, but I did not see a method here to change
the value of the calibration.
ImagePlus has setProperty(java.lang.String key, java.lang.Object value)
but for this I need to know the name of the key (which I suppose I can
get from the popup window of the Properties... command).
So my questions are:
1. What is the correct way to do this?
2. If setProperty() is the way to go, where in the API can I find a list
of the predefined properties?
Thank is advance.
--aryeh
--
Aryeh Weiss
Faculty of Engineering
Bar Ilan University
Ramat Gan 52900 Israel
Ph: 972-3-5317638
FAX: 972-3-7384051
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html