[Numpy-discussion] Adjacent matrix

Thiago Franco Moraes totonixsame@gmail....
Tue Jun 14 11:22:46 CDT 2011


On Tue, Jun 14, 2011 at 11:09 AM, Luis Pedro Coelho <lpc@cmu.edu> wrote:
> On Tuesday, June 14, 2011 08:50:47 AM Thiago Franco Moraes wrote:
>> On Tue, Jun 14, 2011 at 8:06 AM, Luis Pedro Coelho <lpc@cmu.edu> wrote:
>> > On Monday, June 13, 2011 03:55:46 PM Thiago Franco Moraes wrote:
>> >> "Find all of the grid points in that lie adjacent to one or more grid
>> >> points of opposite values."
>> >
>> >> This is the code used to calculate that matrix:
>> > [spin]
>> >
>> >> Where nx, ny and nz are the x, y, z dimensions from the "im" input
>> >> binary matrix. I think this operation is called bwperim.
>> >
>> > My package, mahotas, supports it directly:
>> >
>> > mahotas.bwperim(bw, n)
>> >
>> > at
>> > http://packages.python.org/mahotas/
>> >
>> > HTH,
>> > Luis
>>
>> Thanks Luis. But mahotas.bwperim only supports 2D images, my images
>> are 3D from Computerized Tomography (often very large) and I need
>> connectivity 26.
>
> If the images are binary, an alternative is mahotas.labeled.borders()
>
> It returns the pixels which have more than one value in  there neighbourhoods.
>
> HTH
> Luis

Thanks again Luis. I have to add the version which works with 3D
images is from git (https://github.com/luispedro/mahotas/), the one
installed with pip only works with 2D images.

> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
>


More information about the NumPy-Discussion mailing list