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 |
Hi,
On Sun, 1 Aug 2010, Juan Francisco wrote: > 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 |
In reply to this post by Juan Francisco-2
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 ________________________________________________________________ On 1 Aug 2010, at 20:49, Juan Francisco wrote: > 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 > > > |
Hi,
On Mon, 2 Aug 2010, Michael Schmid wrote: > 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 |
In reply to this post by Juan Francisco-2
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 On 01/08/10 19:49, Juan Francisco wrote: > 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 > > > -- 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 |
In reply to this post by Juan Francisco-2
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:[hidden email]] On Behalf Of Juan Francisco Sent: 01 August 2010 19:49 To: [hidden email] 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 |
In reply to this post by dscho
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 ________________________________________________________________ On 2 Aug 2010, at 14:24, Johannes Schindelin wrote: > Hi, > > On Mon, 2 Aug 2010, Michael Schmid wrote: > >> 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 |
Free forum by Nabble | Edit this page |