I am assuming you have a tmap file saved as 3D analyze file (*.img) and some threshold value (e.g. t > 2.5).
Then (1) the needed I, J, K indices and tvalues are obtained with the powerful find routine in Matlab and
(2) the Volume of the cluster should be the length(I) multipled by the voxel spatial dimensions (e.g. xdim*ydim*zdim/1000 mL):
%________________________________________________
t_threshold=2.5;tmap_file='my_tmap_analyze_file.img';
%=============================================
dat=spm_vol(tmap_file);tmap=spm_read_vols(dat); %Read data
siz=dat.dim(1:3);voxel_dimes_in_mm=dat.private.hdr.dime.pixdim(2:4)); nx=siz(1);ny=siz(2);nz=siz(3); %Geometry info from header
pos_indices=find(tmap > t_threshold); %Spatial indices
tvalues=tmap(pos_indices); %Tvalues [postive for now]
[I, J, K] = ind2sub([nx ny nz], pos_indices); %Coordinates
volume_of_pos_cluster_in_mL=length(pos_indices)*prod(voxel_dimes_in_mm)/1000 %Cluster volume in mL (divide by 1000 to convert from mm to cm*cm*cm=1mL)
num2str([tvalues I J K]) %T-values and the corresponding I, J, K coordinates all of these are column vectors, may save as text or matlab file or binary mask as needed
%-------------------------------------------------------------------------------------------------------------
%The codet below provides more details, just make sure that spm2 is in your Path (uses spm_vol.m and spm_read_vols.m):
function [out,indices,I,J,K,vol]=Return_cluster_indices2012(tmap_file, t_threshold)
%KMH2012
%add spm2 main paths
% Tvalue=(mean1-mean2)/pooled_sd
%[I,J,K]=find(spm_read_vols(spm_vol(tmap_file)) >tmap_threshold);
%returns the indices of a passed volume based on a specified threshold
if ~exist('t_thresh','var'), t_threshold=[2.5];end %t-thresholds. Testing mn1>mn2; the negative values are for mn2<mn1
%provide the path location and file name
tmap_file=[your_path filesep 'tmap_file.img'];
if ~exist(tmap_file),[file,p]=uigetfile('*.img','Slect a tmap analyze file');tmap_file=[p file]; end;
%Read the file with spm routines
dat=spm_vol(tmap_file);tmap=spm_read_vols(dat);
[nx,ny,nz]=size(tmap);
%Show the map as needed or the view the file using SPM spm_orthviews
%px=ceil(sqrt(nz));py=ceil(nz/px);for z=1:nz,subplot(px,py,z),imagesc(tmap(:,:,z));colormap(gray);end;
%pos_indices=find(tmap>t_thresh);%assuming you are interested in positive values
%the x,y,z coordinates can also be directly obtained using the same function above
%[I,J,K] = ind2sub([nx nu nz],pos_indices);
%The matlab routine sub2ind takes [nx ny nz]; I,J,K
%neg_indices=find(tmap<t_threshold);%[if] you are interested in negative values or testing mn1 < mn2
pos_indices=find(tmap>t_threshold);
[I, J, K] = ind2sub([nx ny nz], pos_indices);
%May check the I, J, K with those in a standardazed lookup table
%volume of all voxels in mL=cm*cm*cm (divide by 1000 to convert from mm units) that satisfied the requested threshold criterion (positive)
vol=length(I)*prod(dat.private.hdr.dime.pixdim(2:4))/1000
num2str([tvalues I J K]) %T-values and the corresponding I, J, K coordinates all of these are column vectors, may save as text or matlab file or binary mask as needed
out.file=tmap_file;
out.siz=[nx ny nz]
out.indices=[I J K]
out.vol=vol
%may save the threholded locations file and check with MRIcro or spm_orthviews
return;
Khader M Hasan, PhD
Associate Professor of Radiology
MSE 168, Tel 713 500 7690 (FAX 713 500 7684)
University of Texas Health Science Center at Houston
Medical School
Diagnostic and Interventional Imaging
Magnetic Resonance Imaging Research Division
Diffusion Tensor Imaging Lab, Tel 713 500 7683
http://www.uth.tmc.edu/radiology/faculty/khader-m-hasan/index.html
________________________________________
From: SPM (Statistical Parametric Mapping) [[log in to unmask]] On Behalf Of Haobo Zhang [[log in to unmask]]
Sent: Sunday, April 08, 2012 3:02 AM
To: [log in to unmask]
Subject: [SPM] T values for all voxels within a suprathreshold cluster?
Dear all,
Is there a method to obtain the coordinates and T values for all
voxels within a cluster that passes a significance level? As you know,
SPM statistical tool only shows T values and coordinates of peak
voxels within a suprathreshold cluster (3 or even less voxels). I
wonder if there is anyone who can help me on that?
Many thanks!!
Best regards,
Haobo
--
Dr. Haobo Zhang
School of Psychiatry, Faculty of Medicine
University of New South Wales
Sydney, Australia
|