Login  Register

Re: trouble pasting in plugin

Posted by Michael Schmid on Mar 08, 2017; 4:39pm
URL: http://imagej.273.s1.nabble.com/trouble-pasting-in-plugin-tp5018241p5018244.html

Hi Joe,

you might try roi.endPaste() after each paste operation, to ensure the
operation is properly completed.
You can get the roi via imp1.getRoi() after imp1.setRoi(...).


Michael
________________________________________________________________
On 08/03/2017 15:22, Joe Vandergracht wrote:

> I am having a problem with pasting.  I have a workaround, but I would like to know the underlying issue as it may explain other issues I see from time to time.  In the code below I show that I copy the contents of one image into the clipboard, then (not showing all the code below) I make a larger image and then replicate the smaller image over and over to fill the larger image.
>
> When I use IJ.run("Paste"); it works fine
>
> When I use imp1.paste(); it only copies the last location
>
> Below is the code.  Please advise on the difference in behavior.
>
> (Running ImageJ 1.50g4    Java 1.8.0_60 64 bit  Mac OS 10.10.5)
>
> thanks,
>
> Joe
> _________________________________
>
>         ImagePlus imp = IJ.getImage();
> IJ.run(imp,"Select All", "");
>         imp.copy(false);
>
> /* skip a bit brother *//
>
> for ( k= 0; k <  factor; k++) {
> for (l = 0; l <  factor; l++) {
>   iXROI = k *  width;
>   iYROI = l *  width;
>
> imp1.setRoi (iXROI, iYROI, width,  width);
> /*IJ.run("Paste");  this works - copies into all locations*/
> imp1.paste();   /* this only copies into the last location */
> }
> }
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

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