[pymvpa] Searchlight radius questions

Michael Hanke mih at debian.org
Wed Sep 19 17:49:20 UTC 2012


[taking the discussion back on the list]

On Tue, Sep 11, 2012 at 10:46:33AM -0500, J.A. Etzel wrote:
> The counts for radius 0, 1, and 2 make sense to me. As I understand
> you, pyMVPA follows a "faces must touch" rule: each increase in
> radius is done by adding all the voxels that share at least face
> with the previous radius.
> 
> But I figure 86 voxels surrounding the center for a radius three
> searchlight, not 122. I posted pictures at:
> 
> http://mvpa.blogspot.com/2012/09/pymvpa-searchlight-shapes.html

<snip my sloppy description>

On Wed, Sep 19, 2012 at 09:07:13AM -0500, J.A. Etzel wrote:
> The description helps, but it's not quite obvious to me. I'll try to
> dig into the code. In the mean time could you send me the coordinates
> of a default spherical searchlight of radius 2 and 3? That would help
> me a lot to figure out what it's doing in typical practice.

As I have failed with my verbal description I'll now follow common
advise ("talk is cheap, show me the code"). If you run this little
script, you can (interactively) explore the shapes of the spheres
generated by PyMVPA.  But please keep in mind that PyMVPA supports
custom distance functions and non-cubic element sizes, so this is only
valid for the default settings.

Cheers,

Michael

PS: I have attached a JPG version of the figure too, in case you don't
    have Python handy -- but it is not interactive ;-)

-------------------------------------------------

import numpy as np
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as pl

from mvpa2.misc.neighborhood import Sphere

fig = pl.figure()

for i, radius in enumerate([1,2,3,4]):
    ax = fig.add_subplot(2, 2, 1+i, projection='3d')
    coords = Sphere(radius)((0,0,0))
    coords = np.array(coords).T
    ax.scatter(coords[0], coords[1], coords[2])

pl.show()

-- 
Michael Hanke
http://mih.voxindeserto.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: spheres.jpg
Type: image/jpeg
Size: 30488 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-exppsy-pymvpa/attachments/20120919/175ec814/attachment-0001.jpg>


More information about the Pkg-ExpPsy-PyMVPA mailing list