Discussion:
Circular plot with ImageJ
Juan Francisco
2010-08-01 18:49:16 UTC
Permalink
Dear all:
I try to get a plot along a circular profile over an image, however I just can
do a plot when a line or rectangular selection is performe with ImageJ
Pls, anyone knows how to get a circular profile with ImahgeJ
Thanks a lot!!!
JFC
Johannes Schindelin
2010-08-02 08:13:11 UTC
Permalink
Hi,
Post by Juan Francisco
I try to get a plot along a circular profile over an image, however I
just can do a plot when a line or rectangular selection is performe with
ImageJ Pls, anyone knows how to get a circular profile with ImahgeJ
If you happen to have Fiji installed, just open the script editor with
File>New>Script, select Beanshell as language from the Language menu, and
paste and run this code:

-- snip --
import ij.IJ;
import ij.ImagePlus;
import ij.WindowManager;

import ij.gui.PolygonRoi;
import ij.gui.Roi;

import java.awt.Rectangle;

ImagePlus image = IJ.getImage();
if (image != null) {
Rectangle rect = image.getRoi().getBounds();
float r1 = rect.width / 2.0f;
float r2 = rect.height / 2.0f;
float x = rect.x + r1;
float y = rect.y + r2;
int nPoints = (int)(Math.PI * (r1 + r2) / 2);
int[] xPoints = new int[nPoints], yPoints = new int[nPoints];
for (int i = 0; i < nPoints; i++) {
xPoints[i] = (int)Math.round(x + r1 * Math.cos(i * 2 * Math.PI / nPoints));
yPoints[i] = (int)Math.round(y + r2 * Math.sin(i * 2 * Math.PI / nPoints));
}
image.setRoi(new PolygonRoi(xPoints, yPoints, nPoints, PolygonRoi.POLYLINE));
image.updateAndDraw();
}
-- snap --

After that, the oval selection is a segmented line selection, and you can
run the line profile on it.

Note: this is not super-precise, as it will round the coordinates to the
next integral numbers.

Note also that the oval ROIs do not respect the line width from
Edit>Options>Line Width..., but the segmented line does.

Ciao,
Johannes
Michael Schmid
2010-08-02 12:15:46 UTC
Permalink
Hi Juan,

you can use the Polar Transformer and then do a normal (linear)
linescan.

http://rsb.info.nih.gov/ij/plugins/polar-transformer.html

Michael
________________________________________________________________
Post by Juan Francisco
I try to get a plot along a circular profile over an image, however I just can
do a plot when a line or rectangular selection is performe with ImageJ
Pls, anyone knows how to get a circular profile with ImahgeJ
Thanks a lot!!!
JFC
Johannes Schindelin
2010-08-02 12:24:06 UTC
Permalink
Hi,
you can use the Polar Transformer and then do a normal (linear) linescan.
http://rsb.info.nih.gov/ij/plugins/polar-transformer.html
Note that you will then analyze interpolated data, not your original ones.
Not wanting to start a flamewar, I nevertheless feel the urge to point out
that not all scientists are happy with analyses that use processed data
when they could have used the original pixel intensities instead.

Ciao,
Johannes
Michael Schmid
2010-08-02 16:37:43 UTC
Permalink
Hi everyone,

without wanting to enter a lengthy discussion - it depends on what
you want. Interpolation may be desired in some cases (smoothly
varying pixel values), undesirable in others. ImageJ has an option in
the Profile Plot options for interpolation.

So, if you want interpolation, use the polar transformer, but then it
may make sense to deselect interpolation in the Profile Plot Options
to avoid interpolating pixel values that are already a result of
interpolation.

If you don't want interpolation, use the plugin by Johannes or some
equivalent macro that simply takes the pixel values at the nearest
point.

Michael
________________________________________________________________
Post by Johannes Schindelin
Hi,
you can use the Polar Transformer and then do a normal (linear) linescan.
http://rsb.info.nih.gov/ij/plugins/polar-transformer.html
Note that you will then analyze interpolated data, not your
original ones.
Not wanting to start a flamewar, I nevertheless feel the urge to point out
that not all scientists are happy with analyses that use processed data
when they could have used the original pixel intensities instead.
Ciao,
Johannes
Dr Richard Mort
2010-08-02 13:07:09 UTC
Permalink
It might be that Clonal Tools is of use to you:

http://imagejdocu.tudor.lu/doku.php?id=plugin:analysis:clonaltools:start

It might not be exactly what you need but I'm sure if you look at the
code you could modify it for your needs.
Cheers
Richard
Post by Juan Francisco
I try to get a plot along a circular profile over an image, however I just can
do a plot when a line or rectangular selection is performe with ImageJ
Pls, anyone knows how to get a circular profile with ImahgeJ
Thanks a lot!!!
JFC
--
Dr Richard Mort
MRC Human Genetics Unit
Western General Hospital
Crewe Road
Edinburgh
EH4 2XU, UK.

Phone: +44 (0)131 332 2471 x 3205
Fax: +44 (0)131 467 8456
Julian Cooper
2010-08-02 14:53:33 UTC
Permalink
Hi Juan,

There is an "Oval Profile Plot" plugin that does what you are describing (using the "Along Oval" option) if you go into it with a circular selection:
http://rsb.info.nih.gov/ij/plugins/oval-profile.html

It only works with 8 and 16 bit grayscale images, so your image would have to be duplicated and converted first if it is not 8/16bit (note that the inbuilt ImageJ profile plot uses gray value for RGB images anyway).

Kind regards,

Julian

-----Original Message-----
From: ImageJ Interest Group [mailto:IMAGEJ-9srhZJH3/***@public.gmane.org] On Behalf Of Juan Francisco
Sent: 01 August 2010 19:49
To: IMAGEJ-9srhZJH3/***@public.gmane.org
Subject: Circular plot with ImageJ


Dear all:
I try to get a plot along a circular profile over an image, however I just can
do a plot when a line or rectangular selection is performe with ImageJ
Pls, anyone knows how to get a circular profile with ImahgeJ
Thanks a lot!!!
JFC
Loading...