Posted by
Kenneth Sloan-2 on
URL: http://imagej.273.s1.nabble.com/macro-convert-calibrated-value-to-raw-pixel-value-tp5022651p5022656.html
Thank you for all the prompt replies.
Most seem aimed at solving the SPECIFIC application problem. Again - this exercise was intended to
explore *mechanisms* that might be used in a more general setting.
I suppose we have established that the ImageJ macro language does not provide a way to set a specific x,y pixel
to a calibrated value (as opposed to a raw pixel value. Is that correct?
In this specific, toy, application, the new value depends only on the old value, and "changeValues" can be made to work.
But, I can envision many applications where the new pixel value depends on location as well as (or instead of) the current value).
For example - can I (in the macro language) draw a line in the image using a calibrated value? I haven't checked that, so his might be trivial.
It seems odd to provide a conversion from calibrated to raw, but not the other way. Similarly, it seems odd to include getPixel(), getValue(), and putPixel() but NOT putValue(). Is there some reason this is difficult to implement?
Is there enough information in the calibration (accessed how?) that would allow me to do the conversion myself?
From a design point of view, I would advocate adding putValue(x,y,cValue). It is sufficient (but not as nice) to instead
add rawFromCalibrated(cValue). Unless there is some problem I don't understand, I would add both.
======================
My second question hasn't drawn much comment: is there an efficient way to calculate a target image where every pixel is a function of x,y,value of the source image - instead of doing it "in-place" as I did. I tried to do this by calling selectImage() before every getPixel() and putPixel(), but that seemed horribly slow. But - I had other issues at the time, so this might not be so bad. This doesn't matter until I have a putValue() function.
Back to full Java, for me, I suppose.
--
Kenneth Sloan
[hidden email]
Vision is the art of seeing what is invisible to others.
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html