Print

Print


Sophie

spm_get is no longer used as of spm5. to fix the error change the first line of the code below to

V = spm_vol(spm_select(1,'image'));
I

Darren Gitelman, MD


On Thu, Feb 11, 2010 at 1:26 PM, Sophie Lafaille <[log in to unmask]> wrote:
I have a MTR image (Thanks to Benjamin Bender, my hero!). I'd like to use the matlab code below to integrate the values of my image.

I get an error message when I run it
??? Undefined function or method 'spm_get' for input arguments of type 'double'.

I'm on XP using SPM8. I don't know Matlab at all so I'm having problems troubleshooting it. Also, I've masked my image with the grey and white matter segmentations of my highres, this would make a difference in calculation?

thanks, sophie


From John Ashburner 2002  https://www.jiscmail.ac.uk/cgi-bin/webadmin?A2=ind02&L=SPM&P=R33843
If you want to integrate all the values in an image, you would need to write

some kind of a script to do it.  A possible example that you could copy and
paste into Matlab would be:
%____________________________________________________________

V = spm_vol(spm_get(1,'*.img'));
sm = 0;
for i=1:V.dim(3),
        M = spm_matrix([0 0 i]);
        img = spm_slice_vol(V,M,V.dim(1:2),0);
        sm = sm + sum(img(:));
end;
sm
fprintf('%g litres\n', sm*det(V.mat(1:3,1:3))/100^3)
%____________________________________________________________

The value of sm is the integral of intensity throughout the image.  If this
is an integral over a grey matter image, then you will need to scale by the
volume of each voxel ( det(V.mat(1:3,1:3)) )in order to get an answer in
units of cubic millimetres.



--
Sophie Josee Lafaille, M.Sc.
Research Coordinator
Law and Mental Health Program
Specialty Clinics, 4th Floor, RM 440
Centre for Addiction and Mental Health
250 College Street, Toronto, Ontario, Canada
M5T 1R8

Office: 416-535-8501 Ext. 6278