Macro to analyze periphery rectangular areas of rotated rectangles

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

Macro to analyze periphery rectangular areas of rotated rectangles

Roger Chang-3
Dear ImageJ Listserv members,
I am in the middle of writing an ImageJ macro to analyze the area in rotated
image selection rectangles' periphery rectangles. What I mean by periphery
rectangles is taking each of the four sides of the original rotated
rectangle selection and creating four smaller, periphery rectangles that
"surround" the original rotated rectangle on all four sides. However, these
periphery rectangles do not extend out, but extend into the original rotated
rectangle selection area.

I am having a lot of trouble calculating and defining these periphery
rectangles with trignometric calculations. If the angle is too close to 90
deg. or 0 deg., the periphery rectangles of the longer sides become shorter
or longer than the original rectangles.

Do any of you have any other suggestions of another approach to define these
four rotated, periphery rectangles that surround the original rotated
rectangle? Unfortunately, I have not found any mention of a rotate function
for image selections in the ImageJ Listserv or in the macro function list;
although there are many rotate functions for an entire image.

If any of my explanation was not clear, please feel free to reply for a
clarification.

Yours truly,
Roger Chang
Washington University in St. Louis BME Department: Efimov Lab
Reply | Threaded
Open this post in threaded view
|

Re: Macro to analyze periphery rectangular areas of rotated rectangles

Volker Baecker
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello Roger,
there is a rotate command for rois in ImageJ. You can find it in the
menu Edit>Selection>Rotate... The macro code to run it is
run("Rotate...", "angle=33");

This command calls a macro RotateSelection.txt that you can find in the
ij.jar.

I'm using ImageJ 1.41b but according to
http://rsbweb.nih.gov/ij/docs/all-notes.html
the rotate command for selections was introduced in 1.35b

Best regards,
Volker Baecker

Roger Chang a écrit :
| Dear ImageJ Listserv members,
| I am in the middle of writing an ImageJ macro to analyze the area in
rotated
| image selection rectangles' periphery rectangles. What I mean by periphery
| rectangles is taking each of the four sides of the original rotated
| rectangle selection and creating four smaller, periphery rectangles that
| "surround" the original rotated rectangle on all four sides. However,
these
| periphery rectangles do not extend out, but extend into the original
rotated
| rectangle selection area.
|
| I am having a lot of trouble calculating and defining these periphery
| rectangles with trignometric calculations. If the angle is too close to 90
| deg. or 0 deg., the periphery rectangles of the longer sides become
shorter
| or longer than the original rectangles.
|
| Do any of you have any other suggestions of another approach to define
these
| four rotated, periphery rectangles that surround the original rotated
| rectangle? Unfortunately, I have not found any mention of a rotate
function
| for image selections in the ImageJ Listserv or in the macro function list;
| although there are many rotate functions for an entire image.
|
| If any of my explanation was not clear, please feel free to reply for a
| clarification.
|
| Yours truly,
| Roger Chang
| Washington University in St. Louis BME Department: Efimov Lab
|
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFImVrMxZKX7A/4oMERAiSvAKDZJS9GmAYkujsJUusDpCxzAW3ZmQCfQ49o
L3SPwPPg9OeY/gi/VCCQVyU=
=deIl
-----END PGP SIGNATURE-----

--
passerelle antivirus du campus CNRS de Montpellier
--
Reply | Threaded
Open this post in threaded view
|

Re: Macro to analyze periphery rectangular areas of rotated rectangles

Roger Chang-3
Hi Volker,
I tried to use the run("Rotate...", "angle=33"); function, but I want the
image selection to rotate a value incorporated in a variable. Do you know
if instead it can rotate a value designated by such a variable?

Thanks!
-Roger Chang
Washington University in St. Louis BME Department: Efimov Lab

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hello Roger,
> there is a rotate command for rois in ImageJ. You can find it in the
> menu Edit>Selection>Rotate... The macro code to run it is
> run("Rotate...", "angle=33");
>
> This command calls a macro RotateSelection.txt that you can find in the
> ij.jar.
>
> I'm using ImageJ 1.41b but according to
> http://rsbweb.nih.gov/ij/docs/all-notes.html
> the rotate command for selections was introduced in 1.35b
>
> Best regards,
> Volker Baecker
>
> Roger Chang a écrit :
> | Dear ImageJ Listserv members,
> | I am in the middle of writing an ImageJ macro to analyze the area in
> rotated
> | image selection rectangles' periphery rectangles. What I mean by
> periphery
> | rectangles is taking each of the four sides of the original rotated
> | rectangle selection and creating four smaller, periphery rectangles that
> | "surround" the original rotated rectangle on all four sides. However,
> these
> | periphery rectangles do not extend out, but extend into the original
> rotated
> | rectangle selection area.
> |
> | I am having a lot of trouble calculating and defining these periphery
> | rectangles with trignometric calculations. If the angle is too close to
> 90
> | deg. or 0 deg., the periphery rectangles of the longer sides become
> shorter
> | or longer than the original rectangles.
> |
> | Do any of you have any other suggestions of another approach to define
> these
> | four rotated, periphery rectangles that surround the original rotated
> | rectangle? Unfortunately, I have not found any mention of a rotate
> function
> | for image selections in the ImageJ Listserv or in the macro function
> list;
> | although there are many rotate functions for an entire image.
> |
> | If any of my explanation was not clear, please feel free to reply for a
> | clarification.
> |
> | Yours truly,
> | Roger Chang
> | Washington University in St. Louis BME Department: Efimov Lab
> |
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.6 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iD8DBQFImVrMxZKX7A/4oMERAiSvAKDZJS9GmAYkujsJUusDpCxzAW3ZmQCfQ49o
> L3SPwPPg9OeY/gi/VCCQVyU=
> =deIl
> -----END PGP SIGNATURE-----
>
> --
> passerelle antivirus du campus CNRS de Montpellier
> --
>
Reply | Threaded
Open this post in threaded view
|

Re: Macro to analyze periphery rectangular areas of rotated rectangles

Volker Baecker
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello Roger,
you can use string concatenation (the number is converted automatically
to a string).

angle = 12;
run("Rotate...", "angle=" + angle);

Volker

Roger Chang a écrit :
| Hi Volker,
| I tried to use the run("Rotate...", "angle=33"); function, but I want the
| image selection to rotate a value incorporated in a variable. Do you know
| if instead it can rotate a value designated by such a variable?
|
| Thanks!
| -Roger Chang
| Washington University in St. Louis BME Department: Efimov Lab
| Hello Roger,
| there is a rotate command for rois in ImageJ. You can find it in the
| menu Edit>Selection>Rotate... The macro code to run it is
| run("Rotate...", "angle=33");
|
| This command calls a macro RotateSelection.txt that you can find in the
| ij.jar.
|
| I'm using ImageJ 1.41b but according to
| http://rsbweb.nih.gov/ij/docs/all-notes.html
| the rotate command for selections was introduced in 1.35b
|
| Best regards,
| Volker Baecker
|
| Roger Chang a écrit :
| | Dear ImageJ Listserv members,
| | I am in the middle of writing an ImageJ macro to analyze the area in
| rotated
| | image selection rectangles' periphery rectangles. What I mean by
| periphery
| | rectangles is taking each of the four sides of the original rotated
| | rectangle selection and creating four smaller, periphery rectangles that
| | "surround" the original rotated rectangle on all four sides. However,
| these
| | periphery rectangles do not extend out, but extend into the original
| rotated
| | rectangle selection area.
| |
| | I am having a lot of trouble calculating and defining these periphery
| | rectangles with trignometric calculations. If the angle is too close to
| 90
| | deg. or 0 deg., the periphery rectangles of the longer sides become
| shorter
| | or longer than the original rectangles.
| |
| | Do any of you have any other suggestions of another approach to define
| these
| | four rotated, periphery rectangles that surround the original rotated
| | rectangle? Unfortunately, I have not found any mention of a rotate
| function
| | for image selections in the ImageJ Listserv or in the macro function
| list;
| | although there are many rotate functions for an entire image.
| |
| | If any of my explanation was not clear, please feel free to reply for a
| | clarification.
| |
| | Yours truly,
| | Roger Chang
| | Washington University in St. Louis BME Department: Efimov Lab
| |
|>
- --
passerelle antivirus du campus CNRS de Montpellier
- --
|>

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFImqkTxZKX7A/4oMERAinDAJ0ZFM0q3iu55gdYu3bC6Zm1qzAhDgCg3Ao5
CM/HsxATG7IAuoNEhbTT42Y=
=s+OB
-----END PGP SIGNATURE-----

--
passerelle antivirus du campus CNRS de Montpellier
--
Reply | Threaded
Open this post in threaded view
|

Re: Macro to analyze periphery rectangular areas of rotated rectangles

Roger Chang-3
Wow!
Thanks Wayne and Volker for the string concatenation tip! I did not think
that was even possible. That tip should help me tremendously in my future
programming ventures (I am really only a beginner programmer).

-Roger Chang
Washington University in St. Louis BME Department: Efimov Lab

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hello Roger,
> you can use string concatenation (the number is converted automatically
> to a string).
>
> angle = 12;
> run("Rotate...", "angle=" + angle);
>
> Volker
>
> Roger Chang a écrit :
> | Hi Volker,
> | I tried to use the run("Rotate...", "angle=33"); function, but I want
> the
> | image selection to rotate a value incorporated in a variable. Do you
> know
> | if instead it can rotate a value designated by such a variable?
> |
> | Thanks!
> | -Roger Chang
> | Washington University in St. Louis BME Department: Efimov Lab
> | Hello Roger,
> | there is a rotate command for rois in ImageJ. You can find it in the
> | menu Edit>Selection>Rotate... The macro code to run it is
> | run("Rotate...", "angle=33");
> |
> | This command calls a macro RotateSelection.txt that you can find in the
> | ij.jar.
> |
> | I'm using ImageJ 1.41b but according to
> | http://rsbweb.nih.gov/ij/docs/all-notes.html
> | the rotate command for selections was introduced in 1.35b
> |
> | Best regards,
> | Volker Baecker
> |
> | Roger Chang a écrit :
> | | Dear ImageJ Listserv members,
> | | I am in the middle of writing an ImageJ macro to analyze the area in
> | rotated
> | | image selection rectangles' periphery rectangles. What I mean by
> | periphery
> | | rectangles is taking each of the four sides of the original rotated
> | | rectangle selection and creating four smaller, periphery rectangles
> that
> | | "surround" the original rotated rectangle on all four sides. However,
> | these
> | | periphery rectangles do not extend out, but extend into the original
> | rotated
> | | rectangle selection area.
> | |
> | | I am having a lot of trouble calculating and defining these periphery
> | | rectangles with trignometric calculations. If the angle is too close
> to
> | 90
> | | deg. or 0 deg., the periphery rectangles of the longer sides become
> | shorter
> | | or longer than the original rectangles.
> | |
> | | Do any of you have any other suggestions of another approach to define
> | these
> | | four rotated, periphery rectangles that surround the original rotated
> | | rectangle? Unfortunately, I have not found any mention of a rotate
> | function
> | | for image selections in the ImageJ Listserv or in the macro function
> | list;
> | | although there are many rotate functions for an entire image.
> | |
> | | If any of my explanation was not clear, please feel free to reply for
> a
> | | clarification.
> | |
> | | Yours truly,
> | | Roger Chang
> | | Washington University in St. Louis BME Department: Efimov Lab
> | |
> |>
> - --
> passerelle antivirus du campus CNRS de Montpellier
> - --
> |>
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.6 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iD8DBQFImqkTxZKX7A/4oMERAinDAJ0ZFM0q3iu55gdYu3bC6Zm1qzAhDgCg3Ao5
> CM/HsxATG7IAuoNEhbTT42Y=
> =s+OB
> -----END PGP SIGNATURE-----
>
> --
> passerelle antivirus du campus CNRS de Montpellier
> --
>