[Fwd: Macro to copy from clipboard]

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

[Fwd: Macro to copy from clipboard]

Huw Blackwell
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I'm trying to write a macro to automate the counting of particles on an
SEM image. The SEM image is always in the same position, so I want the
macro to take portion of the image, copy it, then paste it as new before
working on it. I have no problem doing this manually, however when
running these lines (created by the record Macro function), I get the
selection box appearing on the original image, and a new 1024 x 674 8bit
white background that doesn't contain the image from the original
sample. Anyone have any ideas why?

Code:
makeRectangle(0, 0, 1024, 674);
run("Copy");
newImage("Sample", "8-bit Clipboard", 1024, 674, 1);

Chewwit
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFEM9oS6iLyNw8zCE4RAhzgAKCvuJYkgFei8jxKD7p3nbE3dLDMmACgwkFO
ucowJdNPIqEpY8+GyWQFVfs=
=l6Gr
-----END PGP SIGNATURE-----
Reply | Threaded
Open this post in threaded view
|

Re: [Fwd: Macro to copy from clipboard]

Wayne Rasband
> I'm trying to write a macro to automate the counting of
> particles on an SEM image. The SEM image is always in the
> same position, so I want the macro to take portion of the
> image, copy it, then paste it as new before working on it. I
> have no problem doing this manually, however when running
> these lines (created by the record Macro function), I get
> the selection box appearing on the original image, and a new
> 1024 x 674 8bit white background that doesn't contain the
> image from the original sample. Anyone have any ideas why?
>
> Code:
> makeRectangle(0, 0, 1024, 674);
> run("Copy");
> newImage("Sample", "8-bit Clipboard", 1024, 674, 1);

This doesn't work because the newImage() function ignores the
"Clipboard" key word. You can work around this problem by using

     makeRectangle(0, 0, 1024, 674);
     run("Copy");
     newImage("Sample", "8-bit", 1024, 674, 1);
     run("Paste");

In ImageJ 1.37b or later, you can use

     makeRectangle(0, 0, 1024, 674);
     run("Copy");
     run("Internal Clipboard");

which uses the new File>New>Internal Clipboard command.

-wayne