Hi DJ,
there might be some GUI tools out there to do this, but here is a snippet
of code for the command line. mask.img is your mask with the voxel
coordinates that you want to extract, input.img is the data that you want
to extract. There can be more than one input images.
% create volumes handles for mask and input image
Vm = spm_vol('mask.img');
Vi = spm_vol('input.img');
% OR to select mask and input images via GUI use
Vm = spm_vol(spm_select(1,'image','Select mask'));
Vi = spm_vol(spm_select(inf,'image','Select images'));
% read mask image and convert mm coordinates to voxel space
[Ym,XYZmm] = spm_read_vols(Vm);
XYZvx = Vm.mat \ [XYZmm; ones(1,size(XYZmm,2)];
% find voxels in mask (should have a non-zeros value)
ind = find(Ym(:));
% read the data from the voxels in mask
Y = spm_get_data(Vi,XYZvx(:,ind));
The dimensions of Y will be: nImage x nVoxel.
Cheers,
Jan
Donald Bolger wrote:
> Hey everyone,
>
>
>
> I can extract the raw data from individual voxels (using SPM) and for
> broader ROIs using either SPM or MARSBAR. The problem is that I’d like
> to apply a mask and extract the raw data from the remaining individual
> voxels for subsequent analyses. Does anyone have or know of any code
> that can enable the extraction of the raw data for large numbers of
> individual voxels at once?
>
>
>
> Thanks,
> DJ Bolger
>
>
>
>
>
>
>
> Department of Communication Sciences & Disorders Northwestern University
>
> 2240 Campus Drive
>
> Frances Searle Building, Room 2-342
>
> Evanston, Illinois, 60208
>
> Phone 847-491-2494
>
> Fax 847-491-4975
>
>
>
--
Jan Gläscher, Ph.D. Div. Humanities & Social Sciences
+1 (626) 395-3898 (office) Caltech, Broad Center, M/C 114-96
+1 (626) 395-2000 (fax) 1200 California Blvd
[log in to unmask] Pasadena, CA 91125
|