Hello Nicola,
you can call
imp.setStack(imp.getTitle(), imp.getStack());
after you added the second slice.
Volker
Nicola B. a écrit :
> Hi all
> I'm developing an interactive plugin and I have some problems upgrading
> imageStack.
> To understand working mode I try a simple code: ( I prefer if code not
> use IJ.run("Add slice") )
> -----------------------------------------------------------------
> int width = 200;
> int height = 200;
> ImageStack stack = null;
> ImagePlus imp = null;
>
> stack = new ImageStack(width, height);
> ColorProcessor cp1 = new ColorProcessor(width,height);
> stack.addSlice("", cp1, 0);
> imp = new ImagePlus("", stack);
>
> imp.show();
>
> ColorProcessor cp2 = new ColorProcessor(width,height);
> cp2.setColor(Color.RED);
> cp2.fill();
>
> //stack.addSlice("", cp2, 1);
> imp.getImageStack().addSlice("", cp2,1);
> imp.updateAndRepaintWindow();
> -----------------------------------------------------------------
>
> Code works ONLY if I call "imp.show();" at the end but this is a
> problem because I would show first slice and UPDATE stack when other
> slide will be added.
> PS: I prefer if code not use IJ.run("Add slice")
>
> Thanks a lot
> -Nicola B.
>
--
passerelle antivirus du campus CNRS de Montpellier
--