Duke-UNC Brain Imaging and Analysis Center
BIAC Forums | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password   Forgot your Password?
 All Forums
 Support Forums
 Analysis Software Support
 SPM display issue
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

evan.gordon
BIAC Alum

12 Posts

Posted - Dec 16 2004 :  3:20:39 PM  Show Profile  Reply with Quote
I am using SPM2 to run some contrasts, and I've found that when I try to display my results, SPM significantly shifts the activation map forward and down (anterior and inferior) with respect to its glass-brain template outline. The image file itself is fine--it's unshifted when I display it in showsrs--but SPM cannot seem to display it in the right place. I originally thought this was an issue with the origin coordinates in the SPM header, but that is not the case. Has anyone else run into this problem before?

petty
BIAC Staff

USA
453 Posts

Posted - Dec 16 2004 :  4:09:45 PM  Show Profile  Reply with Quote
if you specifically define the origin for these subjects it will fix the problem. also, this is just an spm display issue. the images are still aligned to your anatomical, if you display them using showsrs2 they will match up.
Go to Top of Page

josh.bizzell
BIAC Staff

USA
118 Posts

Posted - Dec 16 2004 :  4:45:23 PM  Show Profile  Reply with Quote
You can use the following Matlab script to check the alignment of your normalized images with the SPM glass brain. You'll need to set the filename of your image, the threshold of the "brain-only" voxels, and the percentage of voxels to plot (the lower the percentage, the faster the code will run, but the image will be less dense).

I have found that many times, the shape of the normalized brain is fine, but the placement of the origin is a little off, which results in a shifted image.


%SHOWMIP Show a SPM figure

% File name of the image to display
fname = 'D:\bizzell\SPM2test\Analysis\06143\snraV0001b.hdr';
% Voxels above this threshhold are considered "brain"
threshhold = 250;
% Percentage of brain voxels to plot on "glass brain"
P = 50;

vol = readmr(fname);

% Set up the transformation matrix and dimensions
M = zeros(4,4);
DIM = [];
M(4,4) = 1;
for i = 1:3
  DIM(i) = vol.info.dimensions(i).size;
  M(i,i) = vol.info.dimensions(i).spacing;
  if isnan(M(i,i)), error('Voxel dimension spacing undefined.'); end
  M(i,4) = -M(i,i) * vol.info.dimensions(i).origin;
  if isnan(M(i,4)) | M(i,4)==0
    M(i,4) = -M(i,i) * round(DIM(i)/2);
  end
end

% Calculate XYZ and Z matrices
idx = find(vol.data > threshhold);
idx = idx(1:round(100/P):length(idx));

XYZ = zeros(3,length(idx));
for i=1:length(idx)
  XYZ(3,i) = floor(idx(i)/(DIM(1)*DIM(2)));
  XYZ(2,i) = floor((idx(i) - (XYZ(3,i))*(DIM(1)*DIM(2)))/DIM(1));
  XYZ(1,i) = (idx(i) - XYZ(3,i)*(DIM(1)*DIM(2))) - XYZ(2,i)*DIM(1);
end
XYZ(3,:) = XYZ(3,:) + 1;
XYZ(2,:) = XYZ(2,:) + 1;

XYZ = M(1:3,:)*[XYZ; ones(1,size(XYZ,2))];
%Z = ones(1,size(XYZ,2));
Z = rand(1,size(XYZ,2))*50;

F = figure;
colormap(gray);
spm_mip(Z,XYZ,M,DIM)


-Josh
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
BIAC Forums © 2000-2010 Brain Imaging and Analysis Center Go To Top Of Page
This page was generated in 0.36 seconds. Snitz Forums 2000