Hi Adam, I'll briefly answer question #3: `rr` and `cc` from `skimage.draw.circle()` correspond to indices of image pixels within the circle. They are meant to be used to do something to all values in that circle, e.g. set all values in that circle to one with `im[rr, cc] = 1`. I don't know of anyone else doing what you propose. We do strive for functional interfaces *where possible*, but what you describe certainly appears suited to an object-oriented framework. Given my above answer I think you want to track and monitor your *Particle*s *prior* to calling `skimage.draw`. The tweak I would make is not to draw anything at all until an output is requested, then batch up all of the circles/objects and have them drawn at that time. Before that point every *Particle* would exist in a much more compact state, probably just center coordinates and radius, and this will be both better and more precise to deal with when repositioning or otherwise tweaking things. Regards, Josh On Friday, December 6, 2013 6:07:57 PM UTC-6, Adam Hughes wrote:
Hi everyone,
My colleague Evelyn and I have been using scikit image's draw utilities to generate test data for modeling particle distributions on optical fibers (ie the SEM images I sent a few weeks ago). We are doing this to test some new models for nanoparticle cluster fitting that we've developed.
In working on this, we believe we've come up with a general framework for drawing 2D particle ensembles in skimage. One could envision using it to do something like:
Step 0: Generate a blank canvas of resolution 1024 x 768 Step 1: Add circles of average radius 5 pixels until 30% of the image is covered. - Arrange these randomly vs. equally spaced on a grid etc... Step 2: Add an "cluster" of particles to this image. Paint only the clusters red. Step 3: Run an optimization that maximizes the inter-particle spacing. Step 4: Make all the particles smaller than a certain area green. Step 5: Try watershedding etc...
By generating the sample images in skimage, we wouldn't have to break out of the python workflow to make our test data.
We believe that we've come up with some abstractions that would allow for such an toolset. This includes defining a abstract class for different particle shapes, and then wrapping skimage.draw() functions as a class method. Before we get invested in this, I had a few questions:
1. Is this something that, if executed well, would be of interest to incorporate into scikit image? If so, I will start working on it as a branch; otherwise, we'll just use skimage as a dependency. I'd image it would either be a submodule of skimage.draw(), something like skimage.draw.ensemble() or draw.psuedodata()...
2. Is anyone aware of a pre-existing tooset/library (preferrably in Python) that's built for this? And if so, is that library compatible to skimage?
3. When a user runs skimage.draw.circle(), it returns *rr* and *cc*, what are these? Is cc the "chain code"?
One caveat: our design plan is object oriented. We thought that the best way to have an image with several particles would require a *Particle*class to add enough metadata to the returns of scikit.draw() so that particles could indivually be tracked, isolated and manipulated. The ensemble would be created on a *Canvas* class (better name? *TestImage*?), which is responsible for storing an ensemble of Particles, as well as all the drawing and organization of the ensemble. For example, a circle would have attributes X, Y, R, which are then passed to a draw() method that called skimage.circle(). In this way, one could track particle positions, manipulate and redraw(). Would something like this clash with skimage's basic design paradigms? If so we, maybe it would best to keep this toolkit out of skimage.
PS, is anyone else working on this, or interested?
Thanks