Hi Gabriel,
you could use imp.copy(false) and imp2.paste. It does the same
without "IJ.run", also using the clipboard.
One level deeper - without the clipboard - I fear that you would have
to write it yourself, with a loop and ip.getPixel, ip.set (or
ip.putPixel).
The Blitter commands like ip.copyBits always take a full ip as a
source; this won't help.
Michael
________________________________________________________________
On 9 Mar 2009, at 15:15, Gabriel Landini wrote:
> Hi,
> Rather than calling: IJ.run("Copy"); and IJ.run("Paste"); in a
> plugin, can
> somebody please suggest a way to directly copy from an existing ROI
> in an
> ImagePlus and paste it directly into another ROI in a different
> ImagePlus?
> (the ROIs are the same type and size).
>
> And similarly is there a way to execute a "Duplicate..." command so
> it is
> guaranteed that a particular image is being duplicated ?
> I just want the ROI to be duplicated, as when using the
> Duplicate... command,
> but I wonder if calling IJ.run("Duplicate...", "_temp"); one runs
> the risk (as
> in macros) of not accessing the right image if one mistakenly
> clicks into
> another image while the plugin is being executed.
>
> Many thanks
>
> Gabriel