Login  Register

draw contour for given pixel value

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
9 messages Options Options
Embed post
Permalink
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

draw contour for given pixel value

Neil Fazel
For an image with almost elliptic intensity contours, is there a way to draw a selection for a contour corresponding to a given pixel value? For example, I would click on a pixel and it would start from there and trace an almost elliptical contour having that pixel's value.  Since the selection would be almost elliptic but not completely, the elliptical selection tool, or oval profiling macro, can't be used.

I have attached an example of such an image.

Thanks,
Neil


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

recovered reference intensity - 5671.png (58K) Download Attachment
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

Re: draw contour for given pixel value

Michael Schmid
Hi Neil,

simply use the Wand tool. It's probably best to set a slight tolerance (1 or 2) and 8-connected mode in its options.

The Wand selects a single pixel value (with some tolerance if specified), so in principle it will select a ring around the maximum. The ImageJ built-in Wand will always include 'inner hole' in the selection, however, so you get everything inside selected as well.

By the way, you can then very easily fit an ellipse to the shape: Have 'Fit Ellipse' enabled in 'Set Measurement' and use 'Measure'.

Michael
________________________________________________________________
On Jun 26, 2013, at 17:44, Neil Fazel wrote:

> For an image with almost elliptic intensity contours, is there a way to draw a selection for a contour corresponding to a given pixel value? For example, I would click on a pixel and it would start from there and trace an almost elliptical contour having that pixel's value.  Since the selection would be almost elliptic but not completely, the elliptical selection tool, or oval profiling macro, can't be used.
>
> I have attached an example of such an image.
>
> Thanks,
> Neil

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

Re: draw contour for given pixel value

Walter O'Dell PhD
In reply to this post by Neil Fazel
there is a contour plotting plugin that I wrote quite a few years ago that permits the user to preselect a series of gray-scale intensities on which to draw a contour.
This is close to what you want I believe.
http://rsbweb.nih.gov/ij/plugins/contour-plotter.html

It appears to me that you took a gray-scale picture and applied a colormap such as fire, in which case your raw data is gray-scale to begin with.  I suppose that you if wanted a contour at a particular pixel you could hover the mouse over particular pixel in the image, read the pixel value from the main IJ window and then enter that value into the interface in the contour plotter plugin.

On Jun 26, 2013, at 11:44 AM, Neil Fazel <[hidden email]> wrote:

> For an image with almost elliptic intensity contours, is there a way to draw a selection for a contour corresponding to a given pixel value? For example, I would click on a pixel and it would start from there and trace an almost elliptical contour having that pixel's value.  Since the selection would be almost elliptic but not completely, the elliptical selection tool, or oval profiling macro, can't be used.
>
> I have attached an example of such an image.
>
> Thanks,
> Neil
>
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
> <recovered reference intensity - 5671.png>

Walter O'Dell, PhD
Assistant Professor
Dept. Radiation Oncology
McKnight Brain Inst. Rm LG-177
PO Box 100385
UF Health Cancer Center
University of Florida
Gainesville, FL 32610
[hidden email]
352-273-9030
http://odell.radonc.med.ufl.edu




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

Re: draw contour for given pixel value

Neil Fazel
In reply to this post by Neil Fazel
Hi Walter,

   Thank you for the tip; the plugin you suggested does exactly what I want. (The original image was indeed grayscale.)

I specified the pixel value, used Contour Plotter to find the contour for it, and then used "set as ROI" to create a region of interest. This is somewhat unrelated to my original question, but is there a way to get the XYZ coordinates for such a selection? I would like to transfer the ROI to another image and list all the pixel values for the pixels on the contour.

Regards,
Neil

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

Re: draw contour for given pixel value

Neil Fazel
In reply to this post by Neil Fazel
Thanks Michael; the Wand Tool also works. (I find that it's a little finicky; sometimes the contour may be enlarged by clicking outside it, but not made smaller but clicking inside it.)

Do you know of a way to list the XYZ values for a selection created by the Wand Tool?

Neil

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

Re: draw contour for given pixel value

Tiago Ferreira-2
Dear Neil,

On 2013.06.26, at 17:31 , Neil Fazel wrote:
> Do you know of a way to list the XYZ values for a selection created by the Wand Tool?

You can use Edit>Selection>Properties to obtain the coordinates (at one pixel intervals)
of any selection.

I came across this finding by looking at the user guide, that is getting outdated but
still covers all of ImageJ basics:

<http://imagej.nih.gov/ij/docs/guide/146-27.html#toc-Subsubsection-27.12.12>

HTH,
-tiago

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

Re: draw contour for given pixel value

Michael Schmid
In reply to this post by Neil Fazel
Hi Neil,

the standard ImageJ Wand works as a Wand only if you click outside the current selection (press shift-A to deselect if required). When clicking inside the current selection, you can drag the selection to some other position.

If you don't like this behavior, you can use the Versatile_Wand plugin (you have to specify 'include holes' in its options):

http://imagejdocu.tudor.lu/doku.php?id=plugin:segmentation:versatile_wand:start

--

For getting the coordinates:
Apart from Tiago's suggestion, Edit>Selection>Properties, you can use the macro command getSelectionCoordinates:
  http://rsb.info.nih.gov/ij/developer/macro/functions.html#getSelectionCoordinates

Look at the getCursorLocDemo macro to see how to write a macro that takes mouse coordinates upon a click; then you deselect all, run doWand(x, y, tolerance, mode) and finally get the selection coordinates and save them, process them, or whatever you like, in your macro - which would be nice if you have to do this on many images.

http://rsb.info.nih.gov/ij/macros//GetCursorLocDemo.txt

In a macro, if you have a grayscale image, you could also read the pixel value at that coordinate, threshold the image between this value and maximum, and create a selection. This would eliminate the need for the Wand, which does not work well if you have steep slopes or the image data are noisy.

Michael
________________________________________________________________
On Jun 26, 2013, at 23:31, Neil Fazel wrote:

> Thanks Michael; the Wand Tool also works. (I find that it's a little finicky; sometimes the contour may be enlarged by clicking outside it, but not made smaller but clicking inside it.)
>
> Do you know of a way to list the XYZ values for a selection created by the Wand Tool?
>
> Neil
>

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

Re: draw contour for given pixel value

Neil Fazel
In reply to this post by Neil Fazel
Hi Tiago,

   Thanks for the tip. I'd missed that little box in the selection properties dialogue. It only gives XY values, but knowing the coordinates I could write a macro to get the pixel values. (The original selection created by Contour Plotter is an iso-intensity contour with known Z, but when I restore the selection on another image, pixel values change.)

Regards,
Neil

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

Re: draw contour for given pixel value

Neil Fazel
In reply to this post by Neil Fazel
Hi Michael,

   Thank you for the information. I tried Versatile Wand and it's a nifty tool. I think that and getSelectionCoordinates() should do the job for me.

Regards,
Neil

BTW, for anyone else wanting to use Versatile Wand: the .java file downloads as versatile_wand.java, but the class name in the program is Versatile_Wand; be sure to rename the file to match the class name before compiling.

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