[SciPy-user] Looking for a way to cluster data
Tue Apr 28 07:36:25 CDT 2009
> If I understand you correctly, what you have is not a list of
> coordinates of freely-located points, it's a binary mask indicating
> which voxels are part of your object. So first of all, have you
> considered using volumetric visualization tools? These seem like they
> might be a better fit to your problem.
I haven't tried this yet, but I will - Zach suggested it too elsewhere
in this thread.
> If what you want to know about is the connectivity of your object,
> though, I can see why you might want to build chains of rods. The most
> direct approach is, for each cell that is a 1, to draw rods from it to
> each of its neighbors that is on. This may not give you what you want:
> if you have regions where all the cells are on, they'll be a dense
> grid of rods. It will also not allow you to provide long strings of
> rods to your 3D toolkit, or to eliminate short chains.
> As I see it, then, your problem is graph-theoretic: you have this
> fairly dense adjacency graph of "on" cells, and you want to pare it
> down. One good choice would be to produce a (minimum diameter?)
> spanning tree, which should be pretty easy to convert to a collection
> of strings of rods. But I think what you want is a graph library of
> some sort.
I may have (pre-emptively) read your mind because that's basically the
approach I took, but I'm not really interested directly in connectivity
information, just in ordering the voxel coordinates so I can draw the
lines as tubes. I used NetworkX but I've built the Minimum Spanning Tree
myself because NetworkX needs the edge information to create its graphs.
> On the other hand, if what you have is "fat" chains of on cells, and
> you want to build up a "skeleton" of them (like converting the pixels
> of an image of the letter o back to a circle), you might look at
> machine vision for help, they do this sort of thing often.
Thanks - that's not my problem - my chains are all lines of single-voxel
thickness to start.
Thanks for the suggestions. I've got a workable approach now that needs
some tweaking but basically works. Volumetric visualisation may do the
trick too and will be simple for me to try thanks to the wonderful mayavi.
More information about the SciPy-user