make a polyline

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

make a polyline

Romain Guiet
Dear All,

I’m facing a “stupid’’ issue in macro language and I guess I’m missing something without finding what -_-'

Here you’ll find a montage image: https://dl.dropboxusercontent.com/u/22602328/imageJ/polylineIssue.jpg
as an example of each step:
1 2 3
4 5 6

1-I have a segmented particle
2-That I skeletonize
3-Make points from mask
4-Then create a polyline using
getSelectionCoordinates(xpoints, ypoints);
makeSelection("polyline", xpoints, ypoints);
5 and 6 are just magnification to more clearly see the issue :  a “zigzag” line instead of a “simpler” one.

In the next step I will measure pixel intensities on another image using this line and the getProfile() function…
(I’m interested in the shape of this profile, not the absolute values ;) )

Any simple idea ? or do I need to write a function findClosestNeighbour to apply, between step 3 and 4, on my points before creating the polyline.

Thanks in advance for any input,
Cheers,
Romain



---------------------------------------------------------------
Dr. Romain Guiet
Bioimaging and Optics Platform (PT-BIOP)
Ecole Polytechnique Fédérale de Lausanne (EPFL)
Faculty of Life Sciences
Station 19, AI 0140
CH-1015 Lausanne

Phone: [+4121 69] 39629
http://biop.epfl.ch/
---------------------------------------------------------------

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

Re: make a polyline

Michael Schmid
Hi Guiet,

it seems to me that the point is the function "Make points from mask".
I guess that it is a plugin. I am not aware of any built-in ImageJ function that can do it - at least in plain ("vanilla") ImageJ.

One could write such a plugin in a way that it follows a line:
- Find any point of the line, add it to list1 and mark it as found
Loop1:
- Find any unmarked neighbor of that point, and mark it as found and add it to list1
- loop until no unmarked neighbor
Loop2:
- Find another unmarked neighbor of the first point, add it to list 2
- loop until no unmarked neighbor
Concatenate the reversed list 1 to list 2.

The following 'code snippets for finding neighbors nay help you

Directions to the neighbors:
  final static int[] DIR_X_OFFSET = new int[] { 0, 1, 1, 1, 0, -1, -1, -1 };
  final static int[] DIR_Y_OFFSET = new int[] { -1, -1, 0, 1, 1, 1, 0, -1 };

Checking whether a neighbor pixel is inside the image bounds:
  https://github.com/imagej/imagej1/blob/master/ij/plugin/filter/MaximumFinder.java#l1249

Michael
________________________________________________________________
On Feb 27, 2015, at 08:24, Guiet Romain wrote:

> Dear All,
>
> I’m facing a “stupid’’ issue in macro language and I guess I’m missing something without finding what -_-'
>
> Here you’ll find a montage image: https://dl.dropboxusercontent.com/u/22602328/imageJ/polylineIssue.jpg
> as an example of each step:
> 1 2 3
> 4 5 6
>
> 1-I have a segmented particle
> 2-That I skeletonize
> 3-Make points from mask
> 4-Then create a polyline using
> getSelectionCoordinates(xpoints, ypoints);
> makeSelection("polyline", xpoints, ypoints);
> 5 and 6 are just magnification to more clearly see the issue :  a “zigzag” line instead of a “simpler” one.
>
> In the next step I will measure pixel intensities on another image using this line and the getProfile() function…
> (I’m interested in the shape of this profile, not the absolute values ;) )
>
> Any simple idea ? or do I need to write a function findClosestNeighbour to apply, between step 3 and 4, on my points before creating the polyline.
>
> Thanks in advance for any input,
> Cheers,
> Romain
>
>
>
> ---------------------------------------------------------------
> Dr. Romain Guiet
> Bioimaging and Optics Platform (PT-BIOP)
> Ecole Polytechnique Fédérale de Lausanne (EPFL)
> Faculty of Life Sciences
> Station 19, AI 0140
> CH-1015 Lausanne
>
> Phone: [+4121 69] 39629
> http://biop.epfl.ch/
> ---------------------------------------------------------------
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html

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