Suma
Suma
CircumSUMA:
Create standard-mesh version of surface models
Align surface with experimental data
Using @SUMA_AlignToExperiment
Map experimental volumetric data to surface
Using AFNI and SUMA (interactively or with command line program)
Time series analysis on datasets defined over surface domain
Smoothing, statistics, clustering, group analysis.
The Simpler and Lesser Process
• For display (mostly) of Talairach or MNI data:
Use the Talairach (http://afni.nimh.nih.gov/pub/dist/tgz/suma_TT_N27.tgz ) or MNI
(http://afni.nimh.nih.gov/pub/dist/tgz/suma_MNI_N27.tgz ) surfaces created from the
N27 brain dataset using FreeSurfer.
Ready to use, no surface creation or alignment needed (but
match to your subject’s anatomy will not be very good)
A: Preparing surface models
for SUMA
High-Res. Create Surface
Anatomical Models
MRI data (FreeSurfer,
Caret, etc.)
@SUMA_Make_Spec_*
Hands-On
Basic SUMA viewer functions
• Prying & Z rotating the hemispheres:
Mouse ctrl+button-1: Moving the mouse horizontally while
button 1 is pressed and ctrl is down will pry hemispheres apart
for better visualization. The prying behavior is different for
spherical and flattened surfaces. Better try it than read about it.
Ctrl+button 1 doubleclick: Undo prying.
Mouse shift+button-1: Rotate surfaces about screen’s Z-axis.
This option is useful for positioning flat surfaces when displayed
one at at time. In most other circumstances it leads to confusion.
Shift+button 1 doubleclick: Undo Z rotation
Hands-On
Basic SUMA viewer functions
• Translating the surface:
Mouse button-2: keep it down while moving the mouse to
translate surface along screen X and Y axes or any
combinations of the two.
Also try Shift+arrow keys.
• Zooming in/out:
Both buttons 1&2 or Shift+button 2: while pressing buttons,
move mouse down or up to zoom in and out, respectively.
Also try keyboard buttons 'Z' and 'z' for zooming in and out,
respectively.
Hands-On
Basic SUMA viewer functions
• Picking a Node or Facet:
Mouse button 3: press over a location on a surface to pick the
closest facet and node to the location of the pointer.
The closest node is highlighted with a blue sphere
The closest facet is highlighted with a gray triangle
Note the information written to the shell regarding the properties
of the picked Node and Facet.
When connected to AFNI (after having pressed ‘t’), watch the
AFNI crosshair jump to the corresponding location in the volume.
Conversely, position the crosshair in AFNI (left click) at a position
close to the surface and watch the crosshair relocate in SUMA.
• You can swap button 1 & 3’s functions using the environment
variable: SUMA_SwapButtons_1_3
Hands-On
Basic SUMA viewer functions
• Cardinal views (along coordinate directions):
ctrl + Left/Right: Views along LR axis
ctrl + Up/Down: Views along SI axis
ctrl + shift + Up/down: Views along AP axis
• Resetting the view point:
Press Home (fn+left arrow macs) to get back to the original
vantage point.
• Using momentum feature:
Press ‘m’ to toggle momentum on. Click the left mouse button
and release the button as you are dragging the mouse.
• Lots more:
Function keys modify various aspects of the display
Those may be usurped by OS X, see Keyboard setup
ctrl+h opens a help window for all interactive options.
Hands-On
Recording your beautiful SUMA images
• Using ‘r’ in SUMA to record the current scene (a single image).
• Using ‘r’ on the colorbar creates an image of the colorbar.
• Using ‘R’ to record continuously the rendered scene, as you change it.
• Images are captured by an AFNI-esque image viewer.
Identical consecutive images are rejected
Images caused by window expose events are ignored
Images can be saved in all ways allowed by AFNI, including MPEG and
animated GIF movies
If you let the recorder run continuously with very large images, you might
quickly run out of memory on your computer!
• Using ‘ctrl+r’ in SUMA to record current image directly to disk (see ‘ctrl+h’ for
details)
• You can save/load viewer setting used to create a figure
Use FileSave View and FileLoad View
Hands-On
world AFNI SUMA world
• AFNI and SUMA are independent programs and communicate using
NIML formatted data elements (a subset of XML)
Via shared memory or TCP/IP network sockets
Both AFNI and SUMA can also communicate with other programs
• Blemishes include:
Only one AFNI can be listening for connections
Inflated, Spherical
Pial
Occipital
cut
Overlay of
anatomically
correct Pial and
SmoothWm Flattened,
surfaces over Occipital
anatomical cut
volume
Viewing the group of surfaces
• Switch Viewing States:
'.' (period) switches to next viewing state (pial then inflated, …)
',' (comma) switches to previous viewing state
Navigate on any of the surfaces and watch AFNI’s crosshair
track surface
SPACE toggles between current state and Mapping
Reference state
• Viewing multiple states concurrently:
ctrl+n opens a new SUMA controller (up to 6 allowed, more
possible but ridiculous)
switch states in any of the viewers
all viewers are still connected to AFNI (if any are)
Hands-On
Viewing the group of surfaces
• Controlling link between viewers:
Open SUMA controller with ctrl+u or View->SUMA Controller
SUMA controller crosshair locking options:
‘-’: no locking
‘i’: node index locking (i.e., topology based)
‘c’: node coordinate locking (i.e., geometry based)
SUMA controller view point locking
‘v’: depress toggle button to link view point across viewers.
Surface rotation and translation in one viewer is reflected
in all linked viewers
Hands-On
Standardizing Surfaces For Group Analysis
• Now that surfaces have been checked for quality, we will
transform them for group analysis
• This step is the equivalent of standard-space normalization for
volume-based analysis.
• In volume-based analysis:
– goal is to have the same voxel spatial location correspond to
the same anatomical location in all subjects
• In surface-based analysis
– goal is to have the same node index correspond to the same
anatomical location in all subjects
Group analysis
• Group analysis requires data defined over a
spatial domain common to all subjects
Talairach space for volume-based analysis
With low order registration
Yellow strip
is one sulcus
being matched
Problem is that
surfaces from
different subjects
are not
topologically
isomorphic
(different meshes).
One Solution:
Data from each
subject are mapped
onto the icosahedral n1
surface for group
analysis
Cumbersome and
unnecessary second
interpolation
n2 n3
Our Way
Instead of interpolating
data values to the
icosahedral nodes,
interpolate using the
coordinates of the
original surface’s node.
Cross-subject surface
based analysis is thus
reduced to node-based
analysis
Compare surfaces: Original and Standard
Standard meshes for 6 subjects
• 6 standard-mesh
surface models from
different subjects.
@SUMA_AlignToExperiment
SurfVol_Alnd_Exp
(SurfVol Aligned to
ExpVol Apply
ExpVol W/ Alignment Xform) Alignment
Experiment Volume Xform
Func. 1
AFNI Cortical Surface
Func. 2 Aligned to
Experiment data
Func. N
B: Aligning Surface w/ Experiment Data
• Functional data are assumed to be in register with experiment’s
anatomical
Align Anatomical to EPI using: align_epi_anat.py.
• Surface Volume is aligned to experiment’s anatomical volume
with rigid-body or affine transformation
The script @SUMA_AlignToExperiment simplifies this step
and rarely fails. If it does, you could try manual registration
with 3dTagalign
Brain coverage and image types should be comparable, not
necessarily identical
• Functional data are not interpolated
B: Aligning Surface w/ Experiment Data
• Demo: (close previous SUMA and AFNI sessions)
cd suma_demo/afni
DemoSubj_spgrax+orig (experiment’s high-res. anatomical scan)
DemoSubj_EccExpavir+orig & DemoSubj_EccExpavir.DEL+orig (EPI
timeseries and function.)
To perform the alignment we ran the SUMA package script:
@SUMA_AlignToExperiment \
-exp_anat DemoSubj_spgrsa+orig \
-surf_anat ../SurfData/SUMA/DemoSubj_SurfVol+orig
This script uses 3dvolreg or 3dAllineate to align the experiment’s
anatomical volume to the Surface Volume.
The script takes care of resampling (with 3dresample) the experiment’s
anatomical volume to match the Surface Volume if need be.
The output volume is named with the prefix of the Surface Volume with
the suffix _Alnd_Exp (read “Aligned to Experiment”).
Use –wd option if exp_anat has been non-rigidly aligned to the epi
Hands-On
B: Aligning Surface w/ Experiment Data
• Launch AFNI to check that volumes aligned well:
afni –niml &
Switch Underlay to DemoSubj_SurfVol_Alnd_Exp+orig
Switch Overlay to DemoSubj_spgrsa+orig
Visually check the alignment:
For example, with pointer in slice viewing window:
press 'o' on the keyboard to turn off the overlay
press 'u' repeatedly to toggle between displaying the two volumes
Launch SUMA to check alignment of surface with volumes
suma –spec ../SurfData/SUMA/std.DemoSubj_lh.spec \
–sv DemoSubj_SurfVol_Alnd_Exp+orig &
or execute the script: tcsh run_suma
Press ‘t’ to talk to AFNI
You should see a surface overlaid onto DemoSubj_SurfVol_Alnd_Exp+orig
Alignment should be proper, otherwise you have a problem.
Hands-On
C: Mapping FMRI Data Onto Surface
A
SurfVol Create SUMA
Surface
Models
B
Align To
Experiment
Alignment
Xform
Apply
Alignment
ExpVol
Xform
Func. 1 C
AFNI
Func. 2 Mapping
Engine
Func. N
Mapping Options
• Surface/volume Intersection • Shell/volume Intersection
Mapping options
(Pial surface)
• Surface/volume Intersection
One voxel per node
• Shell/volume Intersection
Multiple voxels possible per
node
Mapping Habits
• When mapping data from volume to surface domains
If mapping assigns multiple voxels to one node
• Demo (continued):
In SUMA, press ‘ctrl+s’ to open Object Controller.
Use ViewObject Controller if you were born after 1981.
Hands-On
• Demo (continued):
Graphing Time Series
Press “Load Dset” and read in “v2s.lh.TS.niml.dset”
Hands-On
• Demo (continued):
Colorizing results interactively
Press “Load Dset” and read in “v2s.lh.DEL.niml.dset”
SUMA will colorize the loaded Dset (create a color plane for Dset) and
display it on the top of pre-existing color planes.
We begin by describing the right side block “Dset Mapping” which is
used to colorize a Dset. Many of the options mimic those in AFNI’s
“Define OverLay” controls.
Many features are not mentioned here. See online docs. and BHelp.
From the Dset Mapping block (right side of interface)
Select column Corr. Coef. for Threshold (T)
Press ‘v’ button to apply thresholding
Use scale to set the threshold. Nodes whose cross correlation value
does not pass the threshold will not get colored
Note p (uncorrected), and q values (FDR) below the slider
FDR values are per-hemisphere
Note:
For simplicity, we mapped a statistical dataset onto the surface. This
resulted in statistical parameters being averaged without being normalized
A better approach would be to map the time series, and then perform the
statistical computation. See script ./run_3dVol2Surf for examples.
Hands-On
Dset Mapping block
• Demo (continued):
• Mapping Parameters Table:
Used for setting the clipping ranges.
Clipping is only done for color mapping. Actual data values do not
change.
Column Min:
Minimum clip value. Clips values (v) in the Dset less than
Maximum clip value. Clips values (v) in the Dset larger than
Intensity clipping range. Values in the intensity data that are less
than Min are colored by the first (bottom) color of the colormap.
Values larger than Max are mapped to the top color.
Left click on the I locks ranges from automatic resetting when you
Hands-On
• Demo (continued):
Dset Mapping block
• Col:
Switch between color mapping modes.
Int: Interpolate linearly between colors in colormap
NN : Use the nearest color in the colormap.
Dir: Use intensity values as indices into the colormap. In Dir mode,
the intensity clipping range is of no use.
• Cmp:
Switch between available color maps. If the number of colormaps is
too large for the menu button, right click over the 'Cmp' label and a
chooser with a slider bar will appear.
Alternately, as with many of SUMA’s menus, detach the menu by
selecting the dashed line at the top of the menu list. Once detached,
the menu window can be resized so you can access all elements in
very long lists.
More help is available via ctrl+h while mouse is over the colormap
Bias: This is mostly for fun — shifts node coordinates by the data value
Hands-On
Dset Mapping block
• Demo (continued):
• The Colormap:
The colormap is actually a display surface in disguise and shares
some of the functions of SUMA’s viewers:
Keyboard Controls while mouse cursor is over colormap:
r : record image of colormap
Ctrl+h : a help message for the Dset Mapping block
z : Zoom in on colormap
Maximum zoom shows 2 colors in the map
Z : Zoom out on colormap
Minimum zoom shows all colors in the map
Up/Down arrows : rotate colormap up/down.
Home : Reset zoom and translation parameters
Mouse Controls
None yet, some maybe coming someday
Hands-On
Dset Mapping block
• Demo (continued):
• |T| :
Toggle Absolute thresholding.
OFF: Hide node color for nodes ‘n’ that have:
• shw 0 :
Toggle color hiding of nodes with intensity = 0
ON : 0 intensities are mapped to the colormap as any other values.
OFF: 0 intensities are hidden, a là AFNI
Hands-On
Dset Mapping block
• Demo (continued):
• Interactive Clustering:
Left click on ‘Clst’ to activate/deactivate. Cluster table is output to shell. Clicking on a node shows
Default is in mm (units of the surface coords). Negative values specify distance in number of
Default area units are in mm2. Negative numbers indicate masking by node number rather
than area.
Right click in “Node” columns to have crosshairs jump to that node’s location.
You might have to move the surface around to see where the crosshairs have jumped
Hands-On
• Demo (continued):
Xhair Info block
• Xhr:
Crosshair coordinates on this controller's surface. Entering new coordinates
makes the crosshair jump to that location (like 'ctrl+j').
Use 'alt+l' (that’s a lower-case ‘ell’) to center crosshairs in your viewer.
• Node:
Node index of node in focus on this controller's surface. Nodes in focus are
highlighted by the blue sphere in the crosshair. Entering a new node's index
will put that node in focus and send the crosshair to its location (like 'j').
• Node Values Table:
Data Values at node in focus
Column Intens: Intensity (I) value
Column Thresh: Threshold (T) value
Column Bright: Brightness modulation (B)
Row Val: Data Values at node in focus
• Node Label Table:
Row Lbl:
Labels available at the node in focus. Labels include FreeSurfer’s
parcellations, intensity, threshold, and brightness values, cluster
membership, etc. You’re better off reading the label from the viewer.
Hands-On
Dset Controls block
• Demo (Continued):
• Dset Info Table:
Row Lbl: Label of Dset.
Row Par: Parent surface of Dset.
• Ord:
Order of Dset's colorplane. Dset with highest number is on top of the
stack. Separate stacks exits for foreground (fg:) and background
planes (bg:).
• Opa:
Opacity of Dset's colorplane. Opaque planes have an opacity of 1,
transparent planes have an opacity of 0. Opacities are used when
mixing planes within the same stack foreground (fg:) or background
(bg:).
Opacity values are not applied to the first plane in a group.
Consequently, if you have just one plane to work with, opacity value
is meaningless.
Color mixing can be done in two ways, use F7 to toggle between
mixing modes.
Hands-On
Dset Controls block
• Demo (Continued):
• Dim:
Dimming factor to apply to colormap before mapping the intensity (I)
data. The colormap, if displayed on the right, is not visibly affected by
Dim but the colors mapped onto the surface are.
For RGB Dsets (.col files), Dim is applied to the RGB colors directly.
• Dsp:
How to display node color values. Options include pseudocoloring,
contouring (at discrete color levels), both, or none.
• 1: (for 1 only)
If ON, view only the selected Dset’s colors. No mixing of colors in the
foreground stack is done.
If OFF, mix the color planes in the foreground stack.
This option makes it easy to view one Dset’s colors at a time without
having to worry about color mixing, opacity, and stacking order.
Needless to say, options such as ‘Ord:’ and ‘Opa:’ in this panel are of
Hands-On
little use when this button is ON.
Color overlay planes
• Colorized Dsets are organized into layered color planes
2 commonly used planes are:
Surface Convexity (usually in gray scale)
AFNI Function (usually in color)
Planes are assigned to two groups
Background planes (like Convexity)
Foreground planes (like AFNI Function)
Many other planes can be added to either group.
• Color planes of the same group are mixed together:
Planes are stacked based on their order and opacity.
Opacity of 1st plane in a group does not affect color mixing.
There are 2 modes for mixing colors. See F7 key in SUMA.
Hands-On
Playing with color plane order
• Demo (continue from inflated view with function)
You could put lh.1D.col below the function
Switch Dset to get a list of available planes
Prefixes fg: and bg: denote plane’s group membership
Select lh.1D.col and lower its order with the Ord: button
Select FuncAfni_0 and play with its opacity
Note: You can’t make a plane change its group membership, yet.
You can’t delete a loaded color plane yet, but you can hide it.
Turn ‘1’ ON if you just want to see the selected plane.
The one whose label is shown in the object controller
• Test!
Find a way to flip between the mapping from AFNI and the mapping done
with 3dVol2Surf before.
Appreciate the differences between the two mappings.
Hands-On
Drawing surface-based ROIs
• Demo
‘Ctrl+d’ or ToolsDraw ROI to open ROI drawing tool
When in Draw ROI mode (cursor turns into target circles)
The pick (usually third) mouse button is used for drawing
Picking is done by combining shift key and pick button
If pen mode is selected (cursor turns into a pen)
Drawing and picking (with shift) are done with the 1st mouse button
and rotations are done with the third button
When you draw for the first time, a new “drawn ROI” is created.
Note the Parent: field in the ROI frame gets filled when you draw
Hands-On
Drawing surface-based ROIs
• Demo
Move the mouse to a new location and click again to draw a line
from the location of the first click to a new one.
Or click while dragging the mouse to create a smoother line.
Both drawing methods might fail if you are drawing over very
rough terrain.
When that happens, you continue from where the drawing
stopped.
Drawing in 3D looks easy but it isn’t.
Use Undo and Redo when you get your drawings messed up.
To close a loop you can press ‘Join’ button or double click
Hands-On
Drawing surface-based ROIs
• Demo (Continued)
To fill a closed loop, click inside the loop.
Note: If you have patterns that make a figure 8 jealous you might
have to do multiple fills.
Press Finish when you are done drawing and have set the drawing
label and value to your liking.
Now you can draw another ROI, and another and another.
Drawing can be started/continued on any of the related surfaces
When you hit ‘Join’, the loop is closed using the surface where the
ROI was created
Switch ROI to switch between ROIs and delete/modify them.
Load to load ROIs from file
Save to save ROIs to file
1D or NIML = Format of ROI file
This or All = which ROI to save into the file
Hands-On
Surface ROI Volume ROI
• ROIs files should be transformed to dataset files (Dset).
A dataset file has an equal number of values for each node
You can draw two ROIs, such that some nodes belong to
more than one ROI (i.e., they have more than one value)
• The program ROI2dataset is used to change ROIs to datasets
• Execute: tcsh run_ROI2dataset
ROI2dataset -label_dset lh.OccROIs.niml.dset \
-input lh.OccROIs.niml.roi
Hands-On
Surface ROI Volume ROI
• lh.OccROIs.1D.dset (created on the previous slide) can be transformed into a
volume ROI with 3dSurf2Vol
• Execute: source run_3dSurf2Vol
3dSurf2Vol -spec../SurfData/SUMA/DemoSubj_lh.spec \
-surf_A lh.smoothwm.asc \
-surf_B lh.pial.asc \
-sv DemoSubj_SurfVol_Alnd_Exp+orig \
-grid_parent DemoSubj_SurfVol_Alnd_Exp+orig \
-map_func max \
-f_steps 10 \
-f_p1_mm -0.5 -f_pn_fr 0.5 \
-sdata lh.OccROIs.niml.dset \
-prefix lh.OccROIs
Hands-On
Surface ROI Utilities
• SurfPatch
• Takes ROIs on a surface and form a new surface using the ROI nodes
only
• Compute volume of a patch/ROI if you have two bounding surfaces
• SurfMeasures
• Produce surface derived measurements that are node based such as the
volume attributed to a node, etc.
• SurfaceMetrics
• Also produce surface derived measurements that are node based
• ConvertSurface
• Surface format and coordinate transformations including projections
Hands-On
Surface ROI Volume ROI
check your own lh.OccROIs+orig in AFNI
Hands-On
Smoothing data on surface models
• Data smoothing (along the surface) is done with SurfSmooth
The difficulty in smoothing lies in calculating geodesic distances between
node pairs.
Smoothing can be performed by solving the diffusion equation on the
surface. However effect of the kernel is is somewhat poorly estimated.
Number of iterations needed is a wild guess with numerical accuracy
issues. Better smooth until a certain smoothness is reached.
SurfSmooth can estimate smoothness
until desired smoothness is reached
or until additional smoothness is achieved
• Demo (close SUMA and afni)
Execute: tcsh run_SurfSmooth_data
The script will use the output of 3dVol2Surf in run_3dVol2Surf to map
timeseries data onto the surfaces
SUMA is then launched and the script waits for you to setup the
recorder ON with ‘R’
Hit Enter twice (in the shell) to launch the smoothing program
Watch the smoothing progress with each iteration. You can play the
Hands-On whole sequence at the end.
Look At Your Data!
Solution:
Increase Niter
Smoothing geometry of surface
• Surface geometry smoothing can also be done with SurfSmooth
The difficulty in geometry smoothing is in preventing the surface
from shrinking in size.
SurfSmooth uses the smoothing algorithm by (Taubin G. 2000)
Hands-On
Talairach or MNI data display, for panache
• Without creating individualized surfaces, you can display data on a Talairach-ed or
MNI-ed surface model.
The surface models were created with FreeSurfer from the N27 dataset. (Holmes,
CJ et al. JCAT 1998)
Surfaces were created from AFNI’s TT_N27+tlrc and MNI_caez_N27+tlrc, for
Talairach and MNI versions, respectively.
• Demo: (close previous SUMA and AFNI sessions)
If you need suma_TT_N27/ download and unpack:
http://afni.nimh.nih.gov/pub/dist/tgz/suma_TT_N27.tgz
tar xvzf suma_TT_N27.tgz
cd AFNI_data6/group_results
Hands-On
Processing Pipelines
• afni_proc.py
With a couple of extra options (-spec and –sv), afni_proc.py can
process single-subject data in the surface domain.
This includes surface-based smoothing and regresion analysis.
See example 8 in afni_proc.py -help
All voxel wise programs will work with surface-based data
Level-II (group) analysis programs are applicable to surface-based
results.
3dcalc, 3dROIstats, 3dMEMA, 3dLME, 3dMVM, etc.
• @RetinoProc
Process retinotopic data, see @RetinoProc –help for detail including
test data
Hands-On
Demos/Autmaginations
• @DO.examples
• @DriveSuma
• @RetinoProc
• @Install_TSrestMovieDemo
• @Install_AfniRetinoDemo
• @Install_InstaCorr_Demo
• http://afni.nimh.nih.gov/sscc/staff/ziad/Misc_Download/Beauteous/
ChunmaoWang.lh_lat_inflated.mpg
Hands-On
Auxiliary programs
• To see a list of all programs in SUMA:
suma –progs
the next
• ConvertSurface
Converts surfaces between the different formats that SUMA
can read:
FreeSurfer
SureFit
Simple ASCII matrix format
PLY format
GIFTI (XML-based) format
Converts surface coordinates to Talairach space
• ConvexHull
Finds the convex hull of a volume or a set of points
Auxiliary programs
• CreateIcosahedron (by B. Argall)
Creates Icosahedral meshes of varying node counts
• inspec
Outputs information about a spec file
• IsoSurface
Creates an isosurface from a volumetric dataset
• MakeColorMap
Creates colormaps for use with AFNI
• quickspec
Creates a spec file for one or a set of surfaces (quick and
dirty)
• ROI2dataset
Transforms ROI files into surface datasets
Auxiliary programs
• ScaleToMap
Transforms a set of node values to node colors based on chosen
color map
• SurfaceMetrics
Outputs other information about the surface such as the edge list,
• SurfPatch
Creates surface patches from a set of nodes.
• SurfQual
Locates topological errors in spherical surfaces.
Getting Helped
• suma –help for SUMA’s command line usage
• E-mail to [email protected]
FATCAT: Functional And Tractographic Connectivity Analysis Toolbox (Taylor & Saad, 2013)
Critics:
Mike Beauchamp
Pat Bellgowan