GenericDialog addStringField addToSameRow addMessage not widening

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

GenericDialog addStringField addToSameRow addMessage not widening

Fred Damen
Greetings,

When adding a message following a string field the dialog is not widened to
encompass the additional string, see below, albeit, works with a checkbox.

Thanks,

Fred


import ij.*;
import ij.process.*;
import ij.gui.*;
import java.awt.*;
import ij.plugin.*;
import ij.plugin.frame.*;

public class tmp_Plugin implements PlugIn {

public void run(String arg) {

{
   GenericDialog gd = new GenericDialog("Title");
   gd.addCheckbox("param",false);
   gd.addToSameRow();
   gd.addMessage("See This");
   gd.showDialog();
}
{
   GenericDialog gd = new GenericDialog("Title");
   gd.addStringField("param", "");
   gd.addToSameRow();
   gd.addMessage("See This");
   gd.showDialog();
}

}
}

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Concatenator GenericDialog interface removes hyperness

Fred Damen
Greetings,

Calling the stack concatenator on hyperstacks from the
Image>Stacks>Tools>Concatenate menu item and specifying two hyperstacks(nz>1
and nf>1) results in a nonhyper-stack (nf==1); independent of selecting
the'display as 4D' option.

Although calling (new
Concatenator()).concatenateHyperstacks(ImagePlus[],String,true) works as
expected.

Thanks for listening,

Fred

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: GenericDialog addStringField addToSameRow addMessage not widening

Wayne Rasband-2
In reply to this post by Fred Damen
> On Apr 22, 2018, at 3:56 PM, Fred Damen <[hidden email]> wrote:
>
> Greetings,
>
> When adding a message following a string field the dialog is not widened to
> encompass the additional string, see below, albeit, works with a checkbox.

This bug is fixed in the latest ImageJ daily build (1.52b2).

-wayne


> Thanks,
>
> Fred
>
>
> import ij.*;
> import ij.process.*;
> import ij.gui.*;
> import java.awt.*;
> import ij.plugin.*;
> import ij.plugin.frame.*;
>
> public class tmp_Plugin implements PlugIn {
>
> public void run(String arg) {
>
> {
>   GenericDialog gd = new GenericDialog("Title");
>   gd.addCheckbox("param",false);
>   gd.addToSameRow();
>   gd.addMessage("See This");
>   gd.showDialog();
> }
> {
>   GenericDialog gd = new GenericDialog("Title");
>   gd.addStringField("param", "");
>   gd.addToSameRow();
>   gd.addMessage("See This");
>   gd.showDialog();
> }
>
> }
> }

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Concatenator GenericDialog interface removes hyperness

Fred Damen
In reply to this post by Fred Damen
Greetings,

After looking into this a little more, my statement that the
concatenateHyperstacks was working as expected is incorrect.  This method
dehyperizes the hyperstacks.  Note that my datasets are 32-bit float and
sometimes have nz==1  and/or nf==1;

From reviewing the code at:
https://imagej.nih.gov/ij/developer/source/ij/plugin/Concatenator.java.html

The method createHypervol appears like it should work, although it will not be
called if Concatenator is invoked from the gui and you supply a HyperStack;
and does not appear to be callable from outside its class.  Also, for note,
createHypervol does not seem to handle HyperStack RGB datasets.

From A below:
1) One reason someone would want to concatenate 'images' is to take/make
individual ImagePlus(s) and produce a series of images, i.e., hyperstack,
especially when each ImagePlus contains only a single volume.
2) If each stack was identified as containing different conceptual stuff,
i.e., representing a stack as substacks of multiple frames, then this
representation should be carried forward into the resultant ImagePlus, even if
the substack has only one slice.
3) The code assumes that all the 'images' have the same number of frames, but
does not express this fact.  There should be no conundrum with concatenating
varying number of frames, like there is with concatenating varying number of
slices.

From B) below:
1) Only color images are HyperStack(s)???

public class Concatenator implements PlugIn, ItemListener{
...
    public ImagePlus concatenateHyperstacks(ImagePlus[] images, String
newTitle, boolean keep) {
.A.
        int slices =  images[0].getNSlices();
        int frames = images[0].getNFrames();
        boolean concatSlices = slices>1 && frames==1;
.A.
            if (concatSlices) {
                slices = images[i].getNSlices();
                slices2 += slices;
                frames2 = frames;
            } else {
                frames = images[i].getNFrames();
                frames2 += frames;
                slices2 = slices;
            }
            for (int f=1; f<=frames; f++) {
.B.
        if (channels>1 && frames2>1)
            imp2.setOpenAsHyperStack(true);
...


Thanks for listening,

Fred

On Sun, April 22, 2018 10:43 pm, Fred Damen wrote:

> Greetings,
>
> Calling the stack concatenator on hyperstacks from the
> Image>Stacks>Tools>Concatenate menu item and specifying two hyperstacks(nz>1
> and nf>1) results in a nonhyper-stack (nf==1); independent of selecting
> the'display as 4D' option.
>
> Although calling (new
> Concatenator()).concatenateHyperstacks(ImagePlus[],String,true) works as
> expected.
>
> Thanks for listening,
>
> Fred
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

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