[pymvpa] select mask features

Michael Hanke michael.hanke at gmail.com
Thu Nov 6 18:14:07 UTC 2008


Hi James,

On Thu, Nov 06, 2008 at 12:58:02PM -0500, James M. Hughes wrote:
> Hi all,
> 
> I'm a bit confused about the API's instructions for using  
> MaskedDataset.selectFeaturesByMask, since my code's not working.
Yeah, that method is something we should have removed long ago.

> Basically, what I have is a NiftiDataset that has a mask already  
> applied to it.  I want to create my own new mask by just creating a  
> vector of ones and zeros, then apply it to the current data.
> 
> Right now, I have
> 
> n volumes x m features, (let's say the dataset originally had M  
> features, but m < M were chosen after applying one or more prior masks)
> 
> so I created a mask with m zeros, then set some number k of them to 1,  
> then called the selectFeaturesByMask method on the dataset.  I get the  
> following error:
> 
> <type 'exceptions.ValueError'>: shape mismatch: objects cannot be  
> broadcast to a single shape
> 
> which to me implies that my choice of mask size is somehow wrong.
Quick question: It sounds a bit like you know what features you want to
remove, i.e. feature id as opposed to feature coordinate in the
orginial data space. If that is the case, you can simply use
Dataset.selectFeatures() with the nonzeros of your mask vector.

Does that solve the problem?

Michael

-- 
GPG key:  1024D/3144BE0F Michael Hanke
http://apsy.gse.uni-magdeburg.de/hanke
ICQ: 48230050



More information about the Pkg-ExpPsy-PyMVPA mailing list