vistalab / vistasoft

VISTASOFT is the main software repository of the VISTA lab at Stanford University.
http://vistalab.stanford.edu
148 stars 141 forks source link

Align T1 to EPI space #222

Closed soanduong closed 7 years ago

soanduong commented 7 years ago

Hi mrVista experts,

I would like to extract apart of T1 that corresponds to an EPI space.

I used rxAlign to manually align a T1 to an EPI image, thereby getting an alignment matrix.

Would you please let me know is there any way to extract the part of T1 corresponding to EPI image.

Thank you very much and sorry for my dummy question.

Best, Duong

JWinawer commented 7 years ago

Hi Duong,

There are different goals you might have in extracting 'a part of T1 that corresponds to an EPI space.' Because the T1 is not likely to have the same size voxels or orientation as the EPI (or inplane), you will have to interpolate.

If you want the part of the T1 that matches the inplane, with the same dimensionality as the inplane, you can do so using some tools from rxAlign. Here is an example using sample data. (You need the remote data toolbox on your path for this to work):

% Go to a sample directory
nifti_path = mrtInstallSampleData('functional','mrBOLD_01');
cd(nifti_path);

% Get the alignment
mrGlobals();
rxAlign();
rx = rxRefresh();

% Number of slices in inplane
nSlices = rx.rxDims(3);

% Interpolate 3D volume to inplane dimensions
for ii = 1:nSlices
    interpVol(:,:,ii) = rxInterpSlice(rx, ii);
end

% Visualize 3D volume
figure, 
nrows = ceil(sqrt(nSlices));
ncols = ceil(nSlices/nrows);
colormap gray
for ii = 1:nSlices
   subplot(nrows,ncols, ii)
   imagesc(interpVol(:,:,ii));
   axis image off

end

There are other things you might do, as well, such as reslicing the T1 and saving it as a nifti, matched to the bounding box of the EPIs (or inplane). This is a bit harder but would be useful. I be thinking about this for other reasons in the next month or two, as we want to start using the standard nifti transforms to relate inplanes and EPIs to the T1. But not yet...

If the above solution fails for you, please re-open the issue.