[pymvpa] reverse mapping searchlights with center_ids
kimberg at mail.med.upenn.edu
kimberg at mail.med.upenn.edu
Sun Apr 11 13:56:28 UTC 2010
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())
More information about the Pkg-ExpPsy-PyMVPA
mailing list