Re: Calibrated plots

Posted by Frederic V. Hessman on
URL: http://imagej.273.s1.nabble.com/Calibrated-plots-tp5019184p5019190.html

> On 9 Aug 2017, at 20:10, Curtis Rueden <[hidden email]> wrote:
>
>> Please use protected variables unless private ones are ABSOLUTELY
>> NECESSARY!
>
> I think that protected fields should never (or almost never) be used. For a
> rationale, see:
>  http://imagej.net/Coding_style#Private_over_protected_fields_and_methods
>
> As Michael says, making fields non-private locks them in stone forever. You
> also cannot intercept accesses or mutations, unlike getters and setters
> where the behavior can be customized via subclassing.

Depends upon which stone you’re talking about: in this case, it locked the object in stone, making it effectively impossible to subclass it meaningfully.  Yes, there are important internal variables that need to be privately protected, but variables that are simply class working variables that a daughter class necessarily has to access shouldn’t be made private - one has to consider not just the immediate class and its public access but also potential subclasses.

Alternatively, the class has to provide set/get access to all (and I mean ALL) of the needed variables.  Sounds like much more work than simply thinking unless your IDE does it for you.

>> For ImageJ 2.x I think that nonlinear coordinates had been discussed,
>> but I am not aware that they would have been implemented.
>
> ImgLib2 has the imglib2-realtransform library [1] which offers coordinate
> system transformations in real space, including arbitrary transforms which
> can be nonlinear. This component has not reached 1.0.0 yet, and AFAIK there
> are not yet many good examples of using it. However, as discussed years ago
> when ImageJ2 first began, we do plan to continue working on this. Many of
> the pieces are now in place, and the framework/infrastructure to support
> registration algorithms etc. will continue to improve.

One of these days…. Sorry I haven’t had time to help.

> From: Michael Schmid <[hidden email]>
> Subject: Re: Calibrated plots
> Date: 9 August 2017 at 19:48:35 CEST
> To: [hidden email]
> Reply-To: [hidden email]
>
> 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.


Great idea - I’ll look into it!

Rick


--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html