[pymvpa] reverse mapping searchlights with center_ids

Yaroslav Halchenko debian at onerussian.com
Mon Apr 12 03:19:12 UTC 2010


I can be wrong, but I think you have done the detour but 'correct' (may be no the
best in terms of memory consumption but the easiest) way with this
bogusds -- actually I would have called it centerds to be closer to what
it is ;)

mapReverse has little to no clue in this case of original feature ids,
in terms of their correspondence to what they are in myds whenever you
provide a shape for your centerids features.  It just relies on feature
selection mask, and in this case since you have custom center_ids --
bogusds is the one...

the only thought of my paranoid and now tired brain is to assure
that correspondence of features would be the correct one... the question
could be dismissed if you go a bit different way...  e.g. (not tested...
just typing to give an idea):

myds_sl = np.zeros((myds.nfeatures,))
myds_sl[center_ids] = sl_map
mymap = myds.mapReverse(myds_sl)

and check either it matches what you got... and probably the above would
be the most "correct" one actually ;)

hope this helps

On Sun, 11 Apr 2010, kimberg at mail.med.upenn.edu wrote:

> Hi all, really simple question.  I'm running a searchlight for which I use one mask to delineate the extent of useful data and a separate mask to generate center_ids over which to sweep the searchlight.  I then tried to mapReverse() the searchlight map back into image space, but not surprisingly it complained that it wanted something the size of the dataset mask, not the size of the set of center_ids.  Of course, I have the feature IDs and the corresponding values I'd like to map, so I could just map them back by hand (my current script is even uglier, it creates a bogus dataset with the correct mapper, as illustrated below).  But I have the feeling there's a right way to do this that I'm just missing.  Thanks for any help,

> dan


>   myds=NiftiDataset(samples=LESIONFILE,mask=COVERAGEMASK,labels=n.array(labels))
>   bogusds=NiftiDataset(samples=LESIONFILE,mask=CENTERIDSMASK,labels=n.array(labels))
>   center_ids=myds.convertFeatureMask2FeatureIds(NiftiImage(CENTERIDSMASK).asarray())
>   cv=CrossValidatedTransferError(
>       TransferError(cc,errorfx=RMSErrorFx()),
>       NFoldSplitter(cvtype=1))
>   sl=Searchlight(cv,radius=opts.radius,center_ids=center_ids)
>   sl_map=sl(myds)
> # error:
>   mymap=myds.mapReverse(n.asanyarray(sl_map).squeeze())
> # ok:
>   mymap=bogusds.mapReverse(n.asanyarray(sl_map).squeeze())

> _______________________________________________
> Pkg-ExpPsy-PyMVPA mailing list
> Pkg-ExpPsy-PyMVPA at lists.alioth.debian.org
> http://lists.alioth.debian.org/mailman/listinfo/pkg-exppsy-pymvpa


-- 
                                  .-.
=------------------------------   /v\  ----------------------------=
Keep in touch                    // \\     (yoh@|www.)onerussian.com
Yaroslav Halchenko              /(   )\               ICQ#: 60653192
                   Linux User    ^^-^^    [175555]





More information about the Pkg-ExpPsy-PyMVPA mailing list