[SciPy-User] Points with given distance to a polygon

Thøger Emil Juul Thorsen thoeger@fys.ku...
Mon Aug 2 09:19:15 CDT 2010


Shapely indeed looks like exactly what I was searching for! Thanks! I
love Python; I'm able to do stuff after a couple of months which I
couldn't figure out how to do in IDL after years of usage. :-D

/Emil


On Mon, 2010-07-26 at 14:28 -0500, Joe Kington wrote:
> On Mon, Jul 26, 2010 at 1:26 PM, Zachary Pincus
> <zachary.pincus@yale.edu> wrote:
>         > I am working on a project where I am defining some regions
>         of
>         > interest.
>         > I have a 2200x2200 px 2D Array in which my ROI is defined by
>         a
>         > polygon.
>         > However, my data are smoothed by a gaussian kernel of width
>         300px,
>         > and I
>         > would like to draw some lines indicating this inner 150px
>         distance to
>         > the borders of the ROI. I cannot come up with any way to do
>         this, does
>         > anyone have an idea?
>         
>         
>         Two broad options spring to mind:
>         (1) Geometric -- shrink the polygon along the normals to the
>         vertices.
>         [Oh, I see that eat has given pseudocode for same... good]
>         (2) Gridded -- rasterize the polygon to a binary mask (no
>         tools for
>         this in scipy, I fear... but if you're handy with opengl or
>         something,
>         that's not too hard), and then use scipy.ndimage to erode or
>         dilate
>         the mask as necessary.
>         
>         Zach
>         
>         _______________________________________________
>         SciPy-User mailing list
>         SciPy-User@scipy.org
>         http://mail.scipy.org/mailman/listinfo/scipy-user
>         
> 
> If you go with a purely geometric method, look into a module like
> shapely to buffer the polygon. (similar to the code snipped eat
> posted, but more flexible) 
> 
> See this example for a general idea.  
> 
> -Joe
> _______________________________________________
> SciPy-User mailing list
> SciPy-User@scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user





More information about the SciPy-User mailing list