http://imagej.273.s1.nabble.com/how-to-set-calibration-in-API-tp5018687p5018690.html
> read and write the variables without getVariable or setVariable methods.
Perfect -- thank you for your quick reply.
>
> Michael
> ________________________________________________________________
> On 09/05/2017 15:23, Aryeh Weiss wrote:
>> 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_file
>>
>>
>>
>> However, 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.html>>
>> and 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
>>
>