Macro Help

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

Macro Help

macastronomer
I need to learn to write Macros, but I'm not even sure where to start with
this task. I'm familiar with some C++ and some Python, but not enough that I
know where to begin. I'm pretty good at understanding code that is already
written.

Here is the task I have, and an image to help clarify. Autodetecting the
membrane width will not work, which is why we need to multiple lines drawn
manually. The following are the script steps that would be needed:

Open an image, set the scale off of a micron bar.

Ask for the measurement frequency in distance.

Ask for a freehand line (in image it is the yellow line) down the center of
the membrane.

Ask for a freehand line on one side of the membrane (first cyan line).

Ask for a second freehand line on the other side of the membrane (second
cyan line).

Points should be created down the yellow line at the above given distance
until the end of the line is reached.

Straight line segments created between each point.

Then a perpendicular line drawn (the Red line) bisecting each line segment,
extending only to the cyan lines.

The length of each red line returned in the results (measurement) window.

Ask to make another measurement or end.

Burn lines into image and save.

<http://imagej.1557.x6.nabble.com/file/t381898/measure.png>



--
Sent from: http://imagej.1557.x6.nabble.com/

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Macro Help

Straub, Volko A. (Dr.)
Dear macastronomer,


Did you have a look at the macro section of the ImageJ documentation (<https://imagej.nih.gov/ij/docs/guide/146-14.html>https://imagej.nih.gov/ij/developer/macro/macros.html

[https://imagej.nih.gov/ij/developer/macro/images/shortcut.jpg]<https://imagej.nih.gov/ij/developer/macro/macros.html>

Macro Language - National Institutes of Health<https://imagej.nih.gov/ij/developer/macro/macros.html>
imagej.nih.gov
A macro is a simple program that automates a series of ImageJ commands. The easiest way to create a macro is to record a series of commands using the command recorder ...


) that describes the available macro commands? It also gives some very simple examples, links to a large list of more specific sample macros and refers to the Macro Recorder, which is a good starting point to find out about how to translate manual analysis steps into macro commands.

On the following page (https://imagej.nih.gov/ij/docs/guide/146-14.html) you can find links to various tutorials on writing ImageJ macros that provide more in depth introductions.

Hope you find the information that you need to get you started.

Volko

ImageJ User Guide - IJ 1.46r | Macros<https://imagej.nih.gov/ij/docs/guide/146-14.html>
imagej.nih.gov
There are more than 300 example macros, on the ImageJ Web site. To try one, open it in a browser window and drag it directly to the Main ImageJ window ...


ImageJ User Guide - IJ 1.46r | Macros<https://imagej.nih.gov/ij/docs/guide/146-14.html>
imagej.nih.gov
There are more than 300 example macros, on the ImageJ Web site. To try one, open it in a browser window and drag it directly to the Main ImageJ window ...


[https://imagej.nih.gov/ij/developer/macro/images/shortcut.jpg]<https://imagej.nih.gov/ij/developer/macro/macros.html>

Macro Language - National Institutes of Health<https://imagej.nih.gov/ij/developer/macro/macros.html>
imagej.nih.gov
A macro is a simple program that automates a series of ImageJ commands. The easiest way to create a macro is to record a series of commands using the command recorder ...


________________________________
From: macastronomer <[hidden email]>
Sent: 24 January 2018 22:35:55
To: [hidden email]
Subject: Macro Help

I need to learn to write Macros, but I'm not even sure where to start with
this task. I'm familiar with some C++ and some Python, but not enough that I
know where to begin. I'm pretty good at understanding code that is already
written.

Here is the task I have, and an image to help clarify. Autodetecting the
membrane width will not work, which is why we need to multiple lines drawn
manually. The following are the script steps that would be needed:

Open an image, set the scale off of a micron bar.

Ask for the measurement frequency in distance.

Ask for a freehand line (in image it is the yellow line) down the center of
the membrane.

Ask for a freehand line on one side of the membrane (first cyan line).

Ask for a second freehand line on the other side of the membrane (second
cyan line).

Points should be created down the yellow line at the above given distance
until the end of the line is reached.

Straight line segments created between each point.

Then a perpendicular line drawn (the Red line) bisecting each line segment,
extending only to the cyan lines.

The length of each red line returned in the results (measurement) window.

Ask to make another measurement or end.

Burn lines into image and save.

<http://imagej.1557.x6.nabble.com/file/t381898/measure.png>



--
Sent from: http://imagej.1557.x6.nabble.com/

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

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Macro Help

Herbie
In reply to this post by macastronomer
Good day,

could you post a link to the original image (without the drawings). Best
would be the raw image in an uncompressed format, preferably TIF or PNG.

Furthermore, it would be helpful to know whether your sample image is
representative of all the images you need to process, as it makes no sense
to come up with a solution that more or less works only for the sample
image...

Regards

Herbie




--
Sent from: http://imagej.1557.x6.nabble.com/

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Macro Help

Robert Baer
In reply to this post by macastronomer
Reading the docs is always good, but your skill set seems particularly
well suited to using Plugins > Marcos > Record to record the steps as
you manually analyze a typical image.  This macro may not be a finished
piece of work, but looking at what gets recorded will help you move
forward from there.

Rob


On 1/24/2018 4:35 PM, macastronomer wrote:

> I need to learn to write Macros, but I'm not even sure where to start with
> this task. I'm familiar with some C++ and some Python, but not enough that I
> know where to begin. I'm pretty good at understanding code that is already
> written.
>
> Here is the task I have, and an image to help clarify. Autodetecting the
> membrane width will not work, which is why we need to multiple lines drawn
> manually. The following are the script steps that would be needed:
>
> Open an image, set the scale off of a micron bar.
>
> Ask for the measurement frequency in distance.
>
> Ask for a freehand line (in image it is the yellow line) down the center of
> the membrane.
>
> Ask for a freehand line on one side of the membrane (first cyan line).
>
> Ask for a second freehand line on the other side of the membrane (second
> cyan line).
>
> Points should be created down the yellow line at the above given distance
> until the end of the line is reached.
>
> Straight line segments created between each point.
>
> Then a perpendicular line drawn (the Red line) bisecting each line segment,
> extending only to the cyan lines.
>
> The length of each red line returned in the results (measurement) window.
>
> Ask to make another measurement or end.
>
> Burn lines into image and save.
>
> <http://imagej.1557.x6.nabble.com/file/t381898/measure.png>
>
>
>
> --
> Sent from: http://imagej.1557.x6.nabble.com/
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html

--


--
Robert W. Baer, Ph.D.
Professor of Physiology
Kirksville College of Osteopathic Medicine
A T Still University of Health Sciences
800 W. Jefferson St
Kirksville, MO 63501
660-626-2321 Department
660-626-2965 FAX

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Macro Help

macastronomer
In reply to this post by Herbie
Hi Herbie,

Thanks for the help.

The images are very representative of all the images, however the density of
grayscale can fluctuate as the staining can vary. That's why we opt for a
semi-manual method.

Here's a PNG image.

<http://imagej.1557.x6.nabble.com/file/t381898/rep_image.png>

Thanks again.



--
Sent from: http://imagej.1557.x6.nabble.com/

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Macro Help

Herbie
Good day,

thanks for the image!

Attached please find a result with partial contours that are found
essentially without manual help.
See: <http://forum.imagej.net/t/corrosion-thickness-measurement/8310>

The determination of the the thickness for curved regions is not as easy.

Regards

Herbie

::::::::::::::::::::::::::::::::::::::::
Am 26.01.18 um 18:04 schrieb macastronomer:

> Hi Herbie,
>
> Thanks for the help.
>
> The images are very representative of all the images, however the density of
> grayscale can fluctuate as the staining can vary. That's why we opt for a
> semi-manual method.
>
> Here's a PNG image.
>
> <http://imagej.1557.x6.nabble.com/file/t381898/rep_image.png>
>
> Thanks again.
>
>
>
> --
> Sent from: http://imagej.1557.x6.nabble.com/
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

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

rep_image_PartialContours.png (768K) Download Attachment