This should do the trick. It assumes that you have a 3D file. If you
have a 4D file, then it becomes harder to interpret.
hdr=spm_vol(imagename);
[img, xyz]=spm_read_vols(hdr);
imgvec(:,1)=1:1:prod(size(img)); %voxel index
imgvec(:,2)=img(:); %voxel values
imgvec(:,3:5)=xyz'; % xyz coordinates of each voxel
Best Regards, Donald McLaren
=================
D.G. McLaren, Ph.D.
Research Fellow, Department of Neurology, Massachusetts General Hospital and
Harvard Medical School
Postdoctoral Research Fellow, GRECC, Bedford VA
Website: http://www.martinos.org/~mclaren
Office: (773) 406-2464
=====================
This e-mail contains CONFIDENTIAL INFORMATION which may contain PROTECTED
HEALTHCARE INFORMATION and may also be LEGALLY PRIVILEGED and which is
intended only for the use of the individual or entity named above. If the
reader of the e-mail is not the intended recipient or the employee or agent
responsible for delivering it to the intended recipient, you are hereby
notified that you are in possession of confidential and privileged
information. Any unauthorized use, disclosure, copying or the taking of any
action in reliance on the contents of this information is strictly
prohibited and may be unlawful. If you have received this e-mail
unintentionally, please immediately notify the sender via telephone at (773)
406-2464 or email.
On Thu, Nov 8, 2012 at 12:53 PM, mehran sahandi
<[log in to unmask]> wrote:
>
> Dera sir
> I really appreciate if you would help me in this question:
> I want to have a vector which the vector index is voxels number and each
> cell contains corresponding voxel value.
>
> Best Regards
> Mehran Sahandi
> Comuter Engineering,EMU,Cyprus.
|