[pymvpa] selecting features by mask
john.clithero at gmail.com
Fri Aug 28 01:02:29 UTC 2009
Thanks. I took that and just made one (very) minor change --
"new_mask.data" instead of "new_mask", for ndarray -- and it appears
to have worked perfectly!
Hopefully this is what you had in mind:
dataset_wb = NiftiDataset((wb_file),
comb_mask = N.logical_and(new_mask.data != 0,
dataset_wb.mapper.getMask(copy=False) != 0)
fmask = dataset_wb.mapper.forward( comb_mask != 0 )
On Thu, Aug 27, 2009 at 8:09 PM, Michael Hanke<michael.hanke at gmail.com> wrote:
> On Thu, Aug 27, 2009 at 07:22:03PM -0400, John Clithero wrote:
>> Hi all,
>> Another relatively simple question (I think).
>> I can load/create a dataset as follows:
>> dataset_wb = NiftiDataset((wb_file),
>> And then, after this, I want to use SelectFeatures based on a mask I
>> have to run some additional classifiers on a subset of the features
>> using a new mask, say:
>> It is advantageous for me to create the dataset_wb as wholebrain using
>> the 'wb.nii.gz' mask and then after analyses, use this other mask on
>> the dataset (I want to detrend etc. at the whole-brain, not the ROI
>> It seems like something that used to exist,
>> "selectFeaturesByMask(mask, plain=False)"
>> would have been perfect for this. It seems that now, based on a post
>> earlier, a list of Ids from my roi_mask is needed for selectFeatures.
>> My question then, is given all of my fMRI data are in the same 3D
>> space (or, each timepoint is in the same 3D space as my masks), there
>> must be some way to use getOutId to get a list of Ids (say, Z) from
>> roi_mask to plug into
> Congrats, you fell into a pit we digged out for construction works and
> never closed ;-)
> The quickest way for you is probably to take a look at
> MaskedDataset.selectFeaturesByMask(). That is a 3-liner that should to
> what you need. It should be relatively straightforward to apply that to
> any NiftiDataset without having to subclass it.
> GPG key: 1024D/3144BE0F Michael Hanke
> Pkg-ExpPsy-PyMVPA mailing list
> Pkg-ExpPsy-PyMVPA at lists.alioth.debian.org
More information about the Pkg-ExpPsy-PyMVPA