Login  Register

Re: How to move part of Image by macro

Posted by Rasband, Wayne (NIH/NIMH) [E] on Aug 29, 2013; 2:32am
URL: http://imagej.273.s1.nabble.com/How-to-move-part-of-Image-by-macro-tp5004599p5004603.html

On Aug 28, 2013, at 5:14 PM, Peter van Loon wrote:

> Hi,
>
> When I want to copy part of an Image it can be done by a Copy and Paste
> command and the moving the selection by mouse. If I record this and apply
> this in macro then it fails.
> This is the recording:
> makeRectangle(221, 394, 39, 36);
> run("Copy");
> run("Copy");
> run("Paste");
> makeRectangle(343, 394, 39, 36);
> run("Copy");
>
> Strange enough a run("Copy"); command is added after every rectangular
> selection I make by mouse.
> If I omit these 2 extra run("Copy"); commands, the results is the same.
> Can anybody tell me how I can do this by macro?

The makeRectangle() call that specifies the destination must be before run("Paste").

  makeRectangle(221, 394, 39, 36);
  run("Copy");
  makeRectangle(343, 394, 39, 36);
  run("Paste");

-wayne

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