Skip to content

t_alignInplaneToVolume

Jonathan Winawer edited this page Jul 21, 2016 · 1 revision
<title>t_alignInplaneToVolume</title><style type="text/css"> html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,font,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td{margin:0;padding:0;border:0;outline:0;font-size:100%;vertical-align:baseline;background:transparent}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:'';content:none}:focus{outine:0}ins{text-decoration:none}del{text-decoration:line-through}table{border-collapse:collapse;border-spacing:0}

html { min-height:100%; margin-bottom:1px; } html body { height:100%; margin:0px; font-family:Arial, Helvetica, sans-serif; font-size:10px; color:#000; line-height:140%; background:#fff none; overflow-y:scroll; } html body td { vertical-align:top; text-align:left; }

h1 { padding:0px; margin:0px 0px 25px; font-family:Arial, Helvetica, sans-serif; font-size:1.5em; color:#d55000; line-height:100%; font-weight:normal; } h2 { padding:0px; margin:0px 0px 8px; font-family:Arial, Helvetica, sans-serif; font-size:1.2em; color:#000; font-weight:bold; line-height:140%; border-bottom:1px solid #d6d4d4; display:block; } h3 { padding:0px; margin:0px 0px 5px; font-family:Arial, Helvetica, sans-serif; font-size:1.1em; color:#000; font-weight:bold; line-height:140%; }

a { color:#005fce; text-decoration:none; } a:hover { color:#005fce; text-decoration:underline; } a:visited { color:#004aa0; text-decoration:none; }

p { padding:0px; margin:0px 0px 20px; } img { padding:0px; margin:0px 0px 20px; border:none; } p img, pre img, tt img, li img, h1 img, h2 img { margin-bottom:0px; }

ul { padding:0px; margin:0px 0px 20px 23px; list-style:square; } ul li { padding:0px; margin:0px 0px 7px 0px; } ul li ul { padding:5px 0px 0px; margin:0px 0px 7px 23px; } ul li ol li { list-style:decimal; } ol { padding:0px; margin:0px 0px 20px 0px; list-style:decimal; } ol li { padding:0px; margin:0px 0px 7px 23px; list-style-type:decimal; } ol li ol { padding:5px 0px 0px; margin:0px 0px 7px 0px; } ol li ol li { list-style-type:lower-alpha; } ol li ul { padding-top:7px; } ol li ul li { list-style:square; }

.content { font-size:1.2em; line-height:140%; padding: 20px; }

pre, code { font-size:12px; } tt { font-size: 1.2em; } pre { margin:0px 0px 20px; } pre.codeinput { padding:10px; border:1px solid #d3d3d3; background:#f7f7f7; } pre.codeoutput { padding:10px 11px; margin:0px 0px 20px; color:#4c4c4c; } pre.error { color:red; }

@media print { pre.codeinput, pre.codeoutput { word-wrap:break-word; width:100%; } }

span.keyword { color:#0000FF } span.comment { color:#228B22 } span.string { color:#A020F0 } span.untermstring { color:#B20000 } span.syscmd { color:#B28C00 }

.footer { width:auto; padding:10px 0px; margin:25px 0px 0px; border-top:1px dotted #878787; font-size:0.8em; line-height:140%; font-style:italic; color:#878787; text-align:left; float:none; } .footer p { margin:0px; } .footer a { color:#878787; } .footer a:hover { color:#878787; text-decoration:underline; } .footer a:visited { color:#878787; }

table th { padding:7px 5px; text-align:left; vertical-align:middle; border: 1px solid #d6d4d4; font-weight:bold; } table td { padding:7px 5px; text-align:left; vertical-align:top; border:1px solid #d6d4d4; }

</style>

t_alignInplaneToVolume

Illustrates how to align the inplane volume from an fMRI session to the 3D volume anatomy using sample data set erniePRF

Dependencies: Remote Data Toolbox

This tutorial is part of a sequence. Run t_initAnatomyFromFreesurfer t_initVistaSession prior to running this tutorial.

Summary

- Specify alignment matrix linking inplane anatomy to volume anatomy - Save mrSESSION with alignment matrix

Tested 07/21/2016 - MATLAB r2015a, Mac OS 10.11.6

See also: t_initAnatomyFromFreesurfer t_initVistaSession

Winawer lab (NYU)

Contents

Download ernie raw MRI data

% Remember where we are
curdir = pwd();

Organize functional data

% Create a new directory in 'scratch' for the tutorial
erniePathTemp      = fullfile(vistaRootPath, 'local', 'scratch', 'erniePRF');

% Navigate and create a directory cd(erniePathTemp)

Align inplane to t1 and install Gray/white segmentation

% NOTE: THIS IS A PLACE HOLDER. WE WILL REPLACE THIS WITH CODE THAT SHOWS
% HOW THE ALIGNMENT IS COMPUTED. FOR NOW WE JUST PROVIDE THE ALIGNMENT
% MATRIX.

% navigate and open vistasession erniePathTemp = fullfile(vistaRootPath, 'local', 'scratch', 'erniePRF'); cd(erniePathTemp) vw = initHiddenInplane(); % to use the GUI: vw = mrVista;

% aligment matrix (obtained in separate script) alignMtrx = ... 1.0e+02 * ... [... -0.009184260815436 -0.000512038859394 0.007845296072164 2.490305591031722 0.003943260519177 -0.000392116999562 0.018362671991761 1.307013835970514 -0.000316306420987 0.009979180755162 0.001124081482535 0.526943057809918 0 0 0 0.010000000000000];

mrSESSION = sessionSet(mrSESSION, 'alignment', alignMtrx); saveSession();

[niftiCheckQto] NIFTI header origin is at or outside the image volume.
[niftiCheckQto] Origin to the image center [80.000,104.000,12.000] pix.

Visualize

% open a 3D volume view
vol = open3ViewWindow('volume');

% Define an ROI that is the entire functional slab vw = newROI(vw, 'inplane', true); dataSize = viewGet(vw, 'anat size'); [x, y, z] = ind2sub(dataSize, 1:prod(dataSize)); vw = viewSet(vw, 'ROI coords', [x; y; z]);

% Project this ROI to the volume so that we can see the slice selection % within the volume vol = ip2volCurROI(vw ,vol); vol = refreshScreen(vol, 0);

Initializing Volume view
freq_dim not set correctly in NIFTI header.
phase_dim not set correctly in NIFTI header.
[mrLoad]: mr.voxelSize has length<4: concatenating a "1" to it
[mrLoad]: mr.dims has length<4: concatenating a "1" to it
freq_dim not set correctly in NIFTI header.
phase_dim not set correctly in NIFTI header.
Attaching menus
Attaching buttons
Attaching popup menus
Attaching sliders
Done initializing Volume view
Could not find /Users/jonathanwinawer/matlab/git/vistasoft/local/scratch/erniePRF/Volume/userPrefs.mat
freq_dim not set correctly in NIFTI header.
phase_dim not set correctly in NIFTI header.
[mrLoad]: mr.voxelSize has length<4: concatenating a "1" to it
[mrLoad]: mr.dims has length<4: concatenating a "1" to it

Clean up

mrvCleanWorkspace cd(curdir)


Published with MATLAB® R2015a

<!--
SOURCE BEGIN

%% t_alignInplaneToVolume % % Illustrates how to align the inplane volume from an fMRI session to the % 3D volume anatomy using sample data set % % Dependencies: % Remote Data Toolbox % % This tutorial is part of a sequence. Run % t_initAnatomyFromFreesurfer % t_initVistaSession % prior to running this tutorial. % % Summary % % - Specify alignment matrix linking inplane anatomy to volume anatomy % - Save mrSESSION with alignment matrix % % Tested 07/21/2016 - MATLAB r2015a, Mac OS 10.11.6 % % See also: t_initAnatomyFromFreesurfer t_initVistaSession % % Winawer lab (NYU)

%% Download ernie raw MRI data

% Remember where we are curdir = pwd();

%% Organize functional data

% Create a new directory in 'scratch' for the tutorial erniePathTemp = fullfile(vistaRootPath, 'local', 'scratch', 'erniePRF');

% Navigate and create a directory cd(erniePathTemp)

%% Align inplane to t1 and install Gray/white segmentation

% NOTE: THIS IS A PLACE HOLDER. WE WILL REPLACE THIS WITH CODE THAT SHOWS % HOW THE ALIGNMENT IS COMPUTED. FOR NOW WE JUST PROVIDE THE ALIGNMENT % MATRIX.

% navigate and open vistasession erniePathTemp = fullfile(vistaRootPath, 'local', 'scratch', 'erniePRF'); cd(erniePathTemp) vw = initHiddenInplane(); % to use the GUI: vw = mrVista;

% aligment matrix (obtained in separate script) alignMtrx = ... 1.0e+02 * ... [... -0.009184260815436 -0.000512038859394 0.007845296072164 2.490305591031722 0.003943260519177 -0.000392116999562 0.018362671991761 1.307013835970514 -0.000316306420987 0.009979180755162 0.001124081482535 0.526943057809918 0 0 0 0.010000000000000];

mrSESSION = sessionSet(mrSESSION, 'alignment', alignMtrx); saveSession();

%% Visualize

% open a 3D volume view vol = open3ViewWindow('volume');

% Define an ROI that is the entire functional slab vw = newROI(vw, 'inplane', true); dataSize = viewGet(vw, 'anat size'); [x, y, z] = ind2sub(dataSize, 1:prod(dataSize)); vw = viewSet(vw, 'ROI coords', [x; y; z]);

% Project this ROI to the volume so that we can see the slice selection % within the volume vol = ip2volCurROI(vw ,vol); vol = refreshScreen(vol, 0);

%% Clean up % mrvCleanWorkspace % cd(curdir)

SOURCE END

-->

Clone this wiki locally