Posted by
Michael Schmid on
URL: http://imagej.273.s1.nabble.com/Calibrated-plots-tp5019184p5019186.html
Hi Rick,
well, I must admit that I am the culprit for the protected variables and
classes in the ImageJ Plot class.
The reason for not making them public is that as soon as something is
public, it is carved in stone; in other words, it must not be changed to
ensure compatibility.
At the moment, I am still working on the Plot class to enable saving of
the plots including the data, so one can at a later time zoom into the
plot or list values. So there might be still changes ahead...
Are you plotting spectra? Then I guess the problem lies not in the Plot
class but in the profile plot, because it always starts the x axis at a
distance of zero, instead of the actual x value (wavelength) according
to the image calibration. So you would need a custom Profiler class.
At least ImageJ 1.x has only linear calibration of the x and y
coordinates; For ImageJ 2.x I think that nonlinear coordinates had been
discussed, but I am not aware that they would have been implemented.
What you could do is the following:
(1) Create a plugin that calibrates a spectrum from the wavelengths of a
few known points with a polynomial (CurveFitter class). Save the
coefficients in the image properties.
(You could also save the coefficient in a file or the ImageJ prefs, to
apply the calibration to other spectra taken with the same setup).
(2) Create a plugin like the ij.plugin.Profiler that reads the
coefficients and uses them to create the x values. You can get a live
plot by implementing the PlotMaker interface. This could be a rather
short and simple plugin.
Maybe you can also create a profile for the whole spectrum; then you
don't need the 'live' function but you can simply zoom into the plot.
Or maybe I misunderstood your question?
Michael
________________________________________________________________
On 09/08/2017 17:46, Frederic V. Hessman wrote:
> It’s very nice to have the live plot of an image slice based upon the selection defined by the current ROI.
>
> I was hoping to use ImageJ to help some high school students process spectra derived from images, but when the image gets a wavelength calibration (unfortunately only linear - one needs a polynomial scale calibration for general purposes), the calibration doesn’t show up on the plot.
>
> I was going to sub-class Plot and PlotObject and … in order to get the required behavior, but the classes use private rather than protected variables, which makes life much harder - essentially, I’d have to copy the required code entirely.
>
> Any ideas?
>
> Please use protected variables unless private ones are ABSOLUTELY NECESSARY!
>
> Rick
>
> ------------------------------------------------------------------------------------------------
> Dr. Frederic V. Hessman
[hidden email]
> Institut für Astrophysik Tel. +49-551-39-5052
> Friedrich-Hund-Platz 1 Fax +49-551-39-5043
> 37077 Goettingen Room F04-133
>
http://www.Astro.physik.Uni-Goettingen.de/~hessman> -------------------------------------------------------------------------------------------------
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html