How to move part of Image by macro

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

How to move part of Image by macro

Peter van Loon
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?

Regards,
Peter

Reply | Threaded
Open this post in threaded view
|

Re: How to move part of Image by macro

Rasband, Wayne (NIH/NIMH) [E]
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