Login  Register

Re: Slider

Posted by dscho on Apr 20, 2014; 10:35pm
URL: http://imagej.273.s1.nabble.com/Slider-tp5007361p5007374.html

Hi Marc,

On Fri, 18 Apr 2014, Marc Walton wrote:

> I am trying to create a slider plugin for imagej to compare a two image
> stack as a "before" and "after" sequence. An example of a html-based
> tool can be found here: http://zurb.com/playground/twentytwenty.
>
> Has anyone made such a slider for imagej? Also for a novice java
> programmer, what would be the best approach to creating this?

As a rule of thumb, it is harder for novice Java programmers to make a
good GUI than one would naively think. (Most of those endeavors are given
up on when encountering the need for responsive layouts.)

Therefore, I would something completely different: write a macro that
obtains the names of the two images via a dialog
(http://imagej.nih.gov/ij/developer/macro/functions.html#Dialog.addChoice)
and then generates a 50/50 image and monitors the mouse position, updating
the image based on the x coordinate (first image for x = 0, second image
for x = width - 1).

Of course, you could always experiment with writing a plugin with a
preview option that contains a slider (unfortunately, the tutorial at
http://imagingbook.com/imagej-tutorial/ does not yet describe previewing
plugins).

After acquainting yourself with plugin programming by reading Werner
Bailer's tutorial, you will need to look at
http://jenkins.imagej.net/job/ImageJ1-javadoc/javadoc/ij/plugin/filter/ExtendedPlugInFilter.html#showDialog%28ij.ImagePlus,%20java.lang.String,%20ij.plugin.filter.PlugInFilterRunner%29
and at
http://jenkins.imagej.net/job/ImageJ1-javadoc/javadoc/ij/gui/GenericDialog.html#addSlider%28java.lang.String,%20double,%20double,%20double%29

Good luck!
Johannes

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