This is very similar to the first example; it just uses volumes instead of surfaces. This script loads an intensity volume as a background image and then successively loads a series of segmentation overlays, taking a screen shot of each one. This assumes all files are in the local directory.

set err [catch {

    # Load an LUT file for the segementation to use. Get its ID. Set
    # its label to something good.
    set lutID [MakeNewColorLUT]
    SetColorLUTFileName $lutID [file join $env(FREESURFER_HOME) jeans_labels.txt]
    SetColorLUTLabel $lutID "Hires LUT"
    # Load base level. The LoadVolume commmand makes a new layer in
    # it, and automatically adds it to the current view at the first
    # available draw level, 0. Give it a label.
    set fnBaseVolume intensity_target.mgz    
    set baseLayerID [LoadVolume $fnBaseVolume 1 [GetMainFrameID]]
    SetLayerLabel $baseLayerID "Base volume"

    # Load the first segmentation volume, making a layer for it and
    # adding to the next available draw level, 1. Save the layer
    # ID. Also get the data collection ID as we will use that later to
    # change the volume data to which the collection is pointing.
    set nVol 0
    set fnSegVol [format "hires_a256nl_%03d.mgz" $nVol]
    set layerID [LoadVolume $fnSegVol 1 [GetMainFrameID]]
    set colID [Get2DMRILayerVolumeCollection $layerID]

    # Set up the layer as a segmentation volume: lut color map, draw
    # zero values clear, and assign the LUT we got earlier. Give it a
    # label.
    Set2DMRILayerColorMapMethod $layerID lut
    Set2DMRILayerDrawZeroClear $layerID true
    Set2DMRILayerColorLUT $layerID $lutID
    SetLayerLabel $layerID "Segmentation Overlay"

    # Set a location in the view.
    SetViewRASCenter 0 28 22 -40
    SetViewZoomLevel 0 2

    # For each volume...
    for { set nVol 0 } { $nVol <= 84 } { incr nVol } {
        # Generate a volume file name using our base name and the number.
        set fnSegVol [format "hires_a256nl_%03d.mgz" $nVol]

        # Set the volume file name in the collection to this new
        # volume and tell the collection to load the volume.
        SetVolumeCollectionFileName $colID $fnSegVol
        SetStatusBarText "Loading $fnSegVol..."
        LoadVolumeFromFileName $colID

        # Force a window update.
        UpdateFrame [GetMainFrameID]

        # Take a screen shot.
        set fnCapture [format "capture-%04d.tiff" $nVol]
        CaptureFrameToFile [GetMainFrameID] $fnCapture

} sResult]

# Check for errors.
if { 0 != $err } { 
    ::tkcon_tcl_puts "Script failed: $sResult"
} else { 
    ::tkcon_tcl_puts "Script complete."