Hello all,
I have written a ImageJ1 macro that computes the alpha shape for a given point selection. It works analogously to the “Convex Hull” command but can produce concave and hollow shapes depending on the particular point set and alpha value. The output is a composite selection of the alpha shape. Give it a try and let me know if it works for you. Three known issues: 1 - Technically the alpha shape can contain isolated edges that are not part of a polygon. These are not calculated by this script because ImageJ lacks the ability to combine multiple line ROIs. Generally these isolated edges are not practically useful. 2 - The script gets slow and can take a few minutes to complete once the number of points exceeds 200 or so. Constructing the Delaunay triangulation is slow. 3 - The script uses the ROI manager and will clobber anything that is in there when it is called. Script download: http://jonlake.com/download/Alpha_Shape.ijm A description of alpha shapes: http://cgm.cs.mcgill.ca/~godfried/teaching/projects97/belair/alpha.html -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
On Sunday 13 Jul 2014 14:32:42 Jonathan Lake wrote:
> I have written a ImageJ1 macro that computes the alpha shape for a given > point selection. It works analogously to the “Convex Hull” command but can > produce concave and hollow shapes depending on the particular point set and > alpha value. The output is a composite selection of the alpha shape. Give > it a try and let me know if it works for you. Thanks for posting this, but unfortunately it does not work under in my machine linux and openjdk 1.7.0. I am updated to the latest daily build. I create a new 8bit image, create a multi-point selection and run the macro, but then it shows an empty dialog and then it freezes. Cheers Gabriel -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by Jonathan Lake
Hmmm. Unfortunately I cannot readily replicate your environment to test it under those circumstances. It was written in Fiji with ImageJ 1.49d on OS X Mavericks. I have no idea what could cause a problem before it even manages to display the dialog.
try this version? https://www.dropbox.com/s/rvy2zsyb2cwbsus/Alpha_Shape_alternative.ijm -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
On Sunday 13 Jul 2014 16:59:35 Jonathan Lake wrote:
> Hmmm. Unfortunately I cannot readily replicate your environment to test it > under those circumstances. It was written in Fiji with ImageJ 1.49d on OS X > Mavericks. I have no idea what could cause a problem before it even manages > to display the dialog. > > try this version? > https://www.dropbox.com/s/rvy2zsyb2cwbsus/Alpha_Shape_alternative.ijm Tried it on Oracle Java 1.6.0_35. Similar story: It now shows the dialog, asks for a number (I leave the default of 0). Then it given an error saying: ----------------- Empty array in line 655. currentpoly - newArray ( uniquealphaedgelist [ currentpoint <]> ) ; ----------------- This is the same in IJ1 as in Fiji on Oracle Java. Cheers Gabriel -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Hi Gabriel,
on my system it works with alpha given with a comma: e.g. 5,0 not 5 or 0,0 , but i think the result is always the convex hull. Seemingly there is some number type error! Regards Karsten Am 14.07.2014 um 12:56 schrieb Gabriel Landini <[hidden email]>: > On Sunday 13 Jul 2014 16:59:35 Jonathan Lake wrote: >> Hmmm. Unfortunately I cannot readily replicate your environment to test it >> under those circumstances. It was written in Fiji with ImageJ 1.49d on OS X >> Mavericks. I have no idea what could cause a problem before it even manages >> to display the dialog. >> >> try this version? >> https://www.dropbox.com/s/rvy2zsyb2cwbsus/Alpha_Shape_alternative.ijm > > Tried it on Oracle Java 1.6.0_35. Similar story: > It now shows the dialog, asks for a number (I leave the default of 0). Then it > given an error saying: > ----------------- > Empty array in line 655. > > currentpoly - newArray ( uniquealphaedgelist [ currentpoint <]> ) ; > ----------------- > > This is the same in IJ1 as in Fiji on Oracle Java. > > Cheers > > Gabriel > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
On Monday 14 Jul 2014 13:17:54 Karsten wrote:
> on my system it works with alpha given with a comma: e.g. 5,0 not 5 or 0,0 , > but i think the result is always the convex hull. Seemingly there is some > number type error! Oh, yes I can reproduce that behaviour. Odd, because the comma should not be the decimal separator. I also get the convex hull (and all the points disappear). Thank you Gabriel -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
.. very good, at least the same behaviour.
I think there is a problem with Dialog.getNumber(). Still I have to leave now! Karsten Am 14.07.2014 um 13:26 schrieb Gabriel Landini <[hidden email]>: > On Monday 14 Jul 2014 13:17:54 Karsten wrote: >> on my system it works with alpha given with a comma: e.g. 5,0 not 5 or 0,0 , >> but i think the result is always the convex hull. Seemingly there is some >> number type error! > > Oh, yes I can reproduce that behaviour. > Odd, because the comma should not be the decimal separator. > I also get the convex hull (and all the points disappear). > > Thank you > > Gabriel > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by Gabriel Landini
perhaps ImageJ Macro does not properly digest that mixing between main code and blocked subfunction code!
Still I have to leave, really, now! Karsten Am 14.07.2014 um 13:26 schrieb Gabriel Landini <[hidden email]>: > On Monday 14 Jul 2014 13:17:54 Karsten wrote: >> on my system it works with alpha given with a comma: e.g. 5,0 not 5 or 0,0 , >> but i think the result is always the convex hull. Seemingly there is some >> number type error! > > Oh, yes I can reproduce that behaviour. > Odd, because the comma should not be the decimal separator. > I also get the convex hull (and all the points disappear). > > Thank you > > Gabriel > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Hi,
After different attempts I could run it, and it is working fine, depending on the value you get convex hull or proper a-shape. I did notice that the points must be quite close one to another. Hope this helps. Thomas > perhaps ImageJ Macro does not properly digest that mixing between main > code and blocked subfunction code! > > Still I have to leave, really, now! > > Karsten > > Am 14.07.2014 um 13:26 schrieb Gabriel Landini <[hidden email]>: > >> On Monday 14 Jul 2014 13:17:54 Karsten wrote: >>> on my system it works with alpha given with a comma: e.g. 5,0 not 5 or >>> 0,0 , >>> but i think the result is always the convex hull. Seemingly there is >>> some >>> number type error! >> >> Oh, yes I can reproduce that behaviour. >> Odd, because the comma should not be the decimal separator. >> I also get the convex hull (and all the points disappear). >> >> Thank you >> >> Gabriel >> >> -- >> ImageJ mailing list: http://imagej.nih.gov/ij/list.html > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > > -- Thomas Boudier, Associate Prof. UPMC, IPAL UMI 2955, Singapore. -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Free forum by Nabble | Edit this page |