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
 ROI Solutions
 Basic (?) Question
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

tonev
Junior Member

USA
26 Posts

Posted - May 15 2003 :  2:35:33 PM  Show Profile  Reply with Quote
Hi All--I'd like to begin drawing ROIs for my data but I'd like to tackle this issue before I start. The anatomical image that I'd like to use to draw the ROI was acquired using parameters very differnt from the functional data. Specifically:

Anatomical slices were acquired coronally. The resolution of each slice is 256 x 256 and there are 124 slices. The voxel size is .9735 x .9735 x 1.5 mm.

The functional slices were acquired axially. The resolution of each slice is 64 x 64 and there are 33 slices. The voxel size is 3.75 x 3.75 x 4.2 mm.

So as you can see, there is no simple one-to-one mapping of functional onto anatomical data. Beyond this, there is a definite shift in head orientation between the anatomical and functional acquisitions (though there is little head motion within each session).

Sorry if this question is a bit basic...it just seems that wherever I go to look at ROI drawing techniques, this step is skipped. I assume the answer will involve reslicing, reorienting, realigning, or coregistering, but I'm not sure which.

Cheers,

Simon

Simon T. Tonev, Ph.D.
Department of Psychiatry and Behavioral Sciences
Duke University Medical Center
Durham, NC

mack
BIAC Alum

USA
19 Posts

Posted - May 15 2003 :  9:53:47 PM  Show Profile  Visit mack's Homepage  Reply with Quote
When doing ROI analyses, it is almost always in your best interest to make sure the functional slice thickness is an integer multiple of the structural slice thickness. If the thicknesses aren't even multiples of each other, you get in to some very tricky interpolation issues (plus since this isn't commonly done, it would be difficult to find people to help you out when questions arise). Interpolating to account for fractional voxel coverage has some inherant issues that are maginified when dealing with structures near the edge of the brain or structures with a large surface area to volume ratio (especially small structures).

Another note: Make absolutely sure that you have structural images that match your functional images unless you have a good reason to do otherwise and have thought out the implications (both in terms of interpolation, and skills needed to deal with your data). If for some reason I was told I had to take 1.5 mm straight axial structural images to comply with a standard protocol, and I had to take 4 mm oblique functional images, I would find it a worthwhile investment of scanner time to take either 4 mm or 2 mm structural slices that were oblique at the same angle. If one were to take 66 2 mm T1 Fast SPGR with a 256x256 matrix and no IR Prep, I'd be willing to bet it could easily be done in less than 4 minutes (probably something like 3:10 or so for the acquisition part).

Just my two cents, but it comes from someone who has spent quite a few hours dealing with my own decisions about image acquisition (and the frustrations that go with a couple poor choices).

-Beau
Go to Top of Page

tonev
Junior Member

USA
26 Posts

Posted - May 16 2003 :  10:06:23 AM  Show Profile  Reply with Quote
Ok. I was holding back. We did actually acquire another structural series and it has the same slice prescription as the functionals (axial, 33 slices). I guess that I was just tempted to use the other structural series because it was more detailed and might be better for drawing ROIs. However, given the problems that you've suggested, I think I'll get over it.

That said, the problem still remains of getting the 33-slice structrual and functionals to occupy the same position and orientation in space. Let's assume again that whereas there was little movement within each series, there were changes (position and/or orientation) between them.

My naive assumption would be to simply reorient the images to the same position in SPM. However, this is likely not precise enough. In addition, as you know, the reorient function in SPM only alters the .mat file, not the images themselves and so any changes made are viewable in SPM but not other programs such as showsrs or MRIcro. Is this where SPM's realign and/or coregistration functions come into play, or does BIAC have some in-house tools to solve the problem?

Simon

Simon T. Tonev, Ph.D.
Department of Psychiatry and Behavioral Sciences
Duke University Medical Center
Durham, NC
Go to Top of Page

mbudde
Starting Member

USA
9 Posts

Posted - May 16 2003 :  12:47:09 PM  Show Profile  Visit mbudde's Homepage  Reply with Quote
In my experience, I found it best to take very high resolution images rather than simply a multiple of the functionals, for a few reasons.

There is no guarantee that the subject hasn't moved between the function run and the anatomical. It would be great if this were not true and the slice prescriptions were identical, but in reality, it's not the case. Thus, the 2 images should be coregistered anyway to account for this and will need to be interpolated. The better the resolution of the images, the better the interpolation will be.

Once the images are coregistered, it is easy enough to reslice the anatomical to the same slice orientation as the functionals. Again, the higher the resolution, the better the result will be. As for the .mat file in SPM coregistration, it should be simple enough to apply the .mat file to the raw anatomical data and rewrite it. (I'm workin' on it. stupid matrix algebra...)

So, in my opinion, resolution is more important than slice orientation. If the difference is small, than it's a wash. Simon, I think in your case, if we can take the high resolution anatomical and slice it to 2x or 3x the functional thickness, you'll be in better shape than using just the anatomical with 4.2mm thickness. On that note, it's far easier to reslice the anatomical before drawing ROIs, as reslicing the ROI maps is a pretty big mess.

-matt


Go to Top of Page

mack
BIAC Alum

USA
19 Posts

Posted - May 16 2003 :  12:53:36 PM  Show Profile  Visit mack's Homepage  Reply with Quote
The reorient function in SPM is not supposed to be used for matching two series to each other. Coregister accomplishes this, but note that when you coregister and reslice (apply the .mat transformation to the image) your functionals will be the size and resolution of your anatomicals. A quick calculation shows your functionals would be 60 times larger and possibly occupy too much memory to be completely loaded in on a machine with 32-bit architecture. Many of the BIAC tools tend to completely load in a time series.

One way this problem is approached is to manually overlay the functionals on the anatomicals and rotate the anatomical into the proper orientation to meet the functionals. The tool to perform these affline transformations is xmr which has a fairly comprehensive help file in MATLAB to which you should refer.

You can overlay functionals on an anatomical using standard tools like showsrs2 making the anatomical the base, and the functional an overlay that is partially transparent (hue-contrast colormaps like jet work well for the overlay). Also sobel edge detection will create an edge mask of of the functional that you can overlay on the anatomical. You use the edge function to do this. Here's an example for a functional named bold and an anatomical named anat:

» scaled=xmr(bold(:,:,:),0,0,0,4,4,1,0,0,0); %scale up bold
» scaled(find(scaled<300)) =0; %remove voxels darker than 300
» for i=1:64, funcEd(:,:,i)=double(edge(scaled(:,:,i),50,'sobel')); end %find edge and name it funcEd
» Ranat=xmr(anat,-5,-4,0,1,1,1,0,0,0); %rotate anat and name in Ranat


That's probably the easiest solution I can think of.

(you also might want to grab 66 functional slices with half the slice thickness if you're not drawing ROI's on in-plane images too, it won't take too long if you do an FSPGR w/o IR Prep)

-Beau
Go to Top of Page

mack
BIAC Alum

USA
19 Posts

Posted - May 16 2003 :  4:13:37 PM  Show Profile  Visit mack's Homepage  Reply with Quote
Matt,
I think your point is a good one, the only thing to remember is inverse spiral images produce VERY poor coregistrations using SPM. So I'd say your technique would be good for the epi_rt or epi_duke sequences, but for inverse spiral images (or any other images that segment poorly for that metter), I'd make sure to collect coplanar slices.
-Beau
Go to Top of Page

josh.bizzell
BIAC Staff

USA
118 Posts

Posted - May 21 2003 :  3:33:28 PM  Show Profile  Reply with Quote
Matt,
I found a piece of Matlab code written by John Ashburner and Jason Steffener that will take the .mat file generated by SPM and reslice the image based on that transformation matrix. There was a slight bug in the code that I fixed so that the slices would line up properly. Also, I added the option for the user to input what type of interpolation to use during reslicing. Note: When using any interpolation technique other than nearest-neighbor, the first slice of the resulting image will be blank.
Please let me know if you have any questions or suggestions.
-Josh
bizzell@biac.duke.edu

Here is the code:

function mod_reorient(PP,hold) 
% Re-orient images using .mat file
% FORMAT mod_reorient(V,hold);
% V      -  is a memory mapped image volume; if not specified, spm 
%           user interface opens for user to select image file.  
% hold   -  sets the interpolation method for the resampling, (default=-9)
%           0          Zero-order hold (nearest neighbour).
%           1          First-order hold (trilinear interpolation).
%           2->127     Higher order Lagrange (polynomial) interpolation using
%                      different holds (second-order upwards).
%          -127 - -1   Different orders of sinc interpolation.
%
%_______________________________________________________________________
%
% The function reslices the input images. 
% Output images (with the prefix "r") are written in the transverse 
% orientation (using information from the ".mat" files). 
%_______________________________________________________________________ 

% John Ashburner %E%
%
%modified by Jason Steffener
%Modification involves reslicing images in their native 
%voxel size and dimensions.
%Note this program now resets the origin back to the center
%of the image.
%This now interpolates using a 9x9x9 sinc window
% 
% Modified by Josh Bizzell for BIAC, 2003-May-21
% Added HOLD input argument.
% Changed so slices match up with original image.

if nargin<1, 
  PP = spm_get(Inf,'*.img','Select file to reorient'); 
  hold = -9;
end; 
if nargin<2, 
  if iscellstr(PP) | isstr(PP), hold = -9; 
  elseif isint(PP)
    hold = PP;
    PP = spm_get(Inf,'*.img','Select file to reorient');
  end
end
VV = spm_vol(PP);
for V=VV', 
  mn=V.dim(1:3)/(-2);
  vox = spm_imatrix(V.mat); 
  vox = vox(7:9);
  mat = spm_matrix([0 0 0 0 0 0 vox])*spm_matrix([mn]); 
  dim=V.dim(1:3);
  VO = V; 
  [lpath,name,ext] = fileparts(V.fname); 
  VO.fname = fullfile(lpath,['r' name ext]); 
  VO.dim(1:3) = dim(1:3); 
  VO.mat = mat;
  spm_progress_bar('Init',dim(3),'reslicing...','planes completed'); 
  VO = spm_create_image(VO); 
  for i=1:dim(3), 
    M = inv(spm_matrix([0 0 -i])*inv(VO.mat)*V.mat); 
    img = spm_slice_vol(V,M,dim(1:2),hold); %The -9 represents sinc
    spm_write_plane(VO,img,i);              %interpolation with a 
    spm_progress_bar('Set',i)               %9x9x9 window.	
  end; 
  spm_progress_bar('Clear'); 
end;
return;


Edited by - josh.bizzell on May 28 2003 1:21:18 PM
Go to Top of Page

tonev
Junior Member

USA
26 Posts

Posted - May 28 2003 :  11:39:45 AM  Show Profile  Reply with Quote
Josh--Your program fixes the problem of Ashburner's original reorient program in that it maintains the native voxel size (rather than transforming to 1x1x1). However, it seems to translate my brain upward causing me to lose the top few slices.

Simon

Simon T. Tonev, Ph.D.
Department of Psychiatry and Behavioral Sciences
Duke University Medical Center
Durham, NC
Go to Top of Page

josh.bizzell
BIAC Staff

USA
118 Posts

Posted - May 28 2003 :  1:20:41 PM  Show Profile  Reply with Quote
Simon,
Yes, I've come across this problem too. Try changing line 59 to the following (I'll edit it above):
M = inv(spm_matrix([0 0 -i])*inv(VO.mat)*V.mat);

The reason I changed it to -(i-1) was that when I rotated a test image 90 degrees using SPM (Yaw=1.57 and the "Reorient images" button), and then used the mod_reorient function, the slices were shifted up by one. Maybe this is a result of the "Reorient images" function and the mod_reorient was giving the correct result, (I'm not sure).
-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.34 seconds. Snitz Forums 2000