Up to TkSurferGuide

Back to TkSurferScriptingReference

Continue to TkSurferReference

Scripting

This section assumes you are familiar with Tcl and how to write basic scripts.

Most of TkSurfer's functions have Tcl bindings. As you have probably noticed, the interface is just a Tk/Tix window. You can look at the interface script, tksurfer.tcl, to see how most of the functionality is used. Following is a list of Tcl commands defined by TkSurfer. You can use these commands in your own scripts and call them with the -tcl command line option to execute them on startup. TkSurfer can run in a kind of batch mode in this fashion, although it still requires X and has to be able to open its main window.

You can also enter these script commands from the shell that TkSurfer was launched in. You can use the Tcl source command to load a script file from the Tcl shell as well.

This list is provided for reference. If you can figure out something that works, great, but it is not officially a feature of TkSurfer.

Variables

These variables are used to turn on and off certain display characteristics. The way to set a flag is:

set gaLinkedVars(VARIABLENAME) VALUE
SendLinkedVarGroup GROUP

Here is a table listing the variables, valid values, group names, and functionality.

Variable Name

Valid Values

Group

GUI Location

Description

vertexset

0-4

view

View->Surface Configuration

Use to set the current visible surface configuration. Use 0 for Main, 1 for Inflated, 2 for White, 3 for Pial, and 4 for Original.

currentvaluefield

0-8

view

View->Overlay Layer

Sets the current overlay layer. Should be followed with a call to SetOverlayField.

labelstyle

0-1

label

View->Label Style

Sets the label drawing style. Use 0 for filled and 1 for outline.

redrawlockflag

0,1

redrawlock

View->Auto-redraw

Sets the auto-redraw flag.

curvflag

0,1

view

View->Curvature

Controls curvature display.

overlayflag

0,1

view

View->Overlay

Controls overlay layer display.

drawlabelflag

0,1

label

View->Labels

Controls label display.

labels_before_overlay_flag

0,1

label

View->Labels under Overlay

Controls whether labels are drwn under the overlay.

scalebarflag

0,1

view

View->Scale Bar

Controls scale bar display.

colscalebarflag

0,1

view

View->Color Scale Bar

Controls the overlay color scale bar display.

verticesflag

0,1

view

View->Wireframe Overlay

Controls the wireframe display.

drawcursorflag

0,1

view

View->Cursor

Controls the cursor display.

light0

0-1 (floating)

scene

View->Configure->Lighting

Sets the first light value.

light1

0-1 (floating)

scene

View->Configure->Lighting

Sets the second light value.

light2

0-1 (floating)

scene

View->Configure->Lighting

Sets the third light value.

light3

0-1 (floating)

scene

View->Configure->Lighting

Sets the fourth light value.

offset

0-1 (floating)

scene

View->Configure->Lighting

Sets the ambient light value.

fthresh

floating

overlay

View->Configure->Overlay

Sets the overlay threshold minimum.

fmid

floating

overlay

View->Configure->Overlay

Sets the overlay threshold midpoint.

fslope

floating

overlay

View->Configure->Overlay

Sets the overlay threshold slope.

falpha

0-1 (floating)

overlay

View->Configure->Overlay

Sets the overlay alpha value.

ftimepoint

integer

overlay

View->Configure->Overlay

Sets the time point in the current overlay layer.

fcondition

integer

overlay

View->Configure->Overlay

Sets the condition in the current overlay layer.

colscale

0-8

overlay

View->Configure->Overlay

Sets the overlay color scale type. Use 0 for Color Wheel, 1 for Heat, 4 for Two Cond G/R, 6 for Blue Red, 7 for Green Red, 8 for RYGB Wheel

truncphaseflag

0,1

overlay

View->Configure->Overlay

Sets the overlay Truncate flag.

invphaseflag

0,1

overlay

View->Configure->Overlay

Sets the overlay Inverse flag.

complexvalflag

0,1

overlay

View->Configure->Overlay

Sets the Complex flag.

ignorezeroesinhistogramflag

0,1

overlay

View->Configure->Overlay

Sets the Ignore Zeroes in Histogram flag

cmid

floating

curvature

View->Configure->Curvature

Sets the midpoint value for the curvature display.

forcegraycurvatureflag

0,1

curvature

View->Configure->Curvature

Controls the binary gray curvature display.

Commands

Functions arguments are listed by their name followed by their arguments. Arguments in square brackets are optional.

align_sphere

clear_all_vertex_marks

clear_curvature

clear_ripflags

clear_vertex_marks

close_marked_vertices

compute_curvature

curv_to_val

cut_line closed

cut_plane

dilate_ripped

do_lighting_model light0 light1 light2 light3 offset

draw_cursor vertexNumber on

dump_vertex vertexNumber

f_to_t

find_orig_vertex_coordinates

fix_nonzero_vals

flip_normals axes

func_clear_selection

func_graph_timecourse_selection

func_load_timecourse fileName registrationType registrationFileName

registrationFileName is necessary only of registrationType is file.

func_load_timecourse_offset fileName registrationType registrationFileName

registrationFileName is necessary only of registrationType is file.

func_print_timecourse_selection fileName

func_select_label

func_select_marked_vertices

invert_face faceNumber

fill_flood_from_cursor dontCrossPath dontCrossLabel dontFillUnlabeled dontCrossCuravature dontCrossThreshold multipleSeeds action argument

0

No action, just mark filled vertices. argument is ignored.

1

Make the filled vertices a new label. argument is ignored.

2

Add the filled vertices to an existing label. argument should be the index of the label to add vertices to.

3

Remove the filled vertices from an existing label. argument should be the index of the label to remove from.

get_marked_vnos

get_selected_path_vnos

invert_surface

invert_vertex vertexNumber

label_to_stat overlayField

labl_dilate label

labl_erode label

labl_export_annotation fileName

labl_import_annotation fileName

labl_load fileName

labl_load_color_table fileName

labl_mark_vertices label

labl_new_from_marked_vertices

labl_print_list

labl_print_table

labl_remove label

labl_remove_all

labl_save label fileName

labl_save_all prefix

labl_select label

labl_select_label_by_vno vertexNumber

labl_set_color label red green blue

labl_set_info label name structureIndex visibility

labl_set_name_from_table label

left_click x y

make_lateral_view

mark_annotation vertexNumber

mark_contiguous_vertices_over_thresh

mark_contiguous_vertices_with_similar_curvature

mark_face faceNumber

mark_faces vertexNumber

mark_vertex vertexNumber on

mask_label labelFileName

move_window x y

path_new_path_from_marked_vertices

path_remove_selected_path

path_select path

plot_curv closed

print_nearest_vertex_to_talairach_point x y z *

read_annotations fileName

read_binary_curv

read_binary_decimation

read_binary_dipoles

read_binary_patch

read_binary_sulc

read_binary_surf

read_binary_values

read_binary_values_frame

read_canon_vertex_coordinates fileName

read_curv_to_val fileName

read_fieldsign

read_fsmask

read_imag_vals fileName

read_labeled_vertices

read_orig_vertex_coordinates

read_pial_vertex_coordinates

read_really_matrix

read_surface_vertex_set field fileName

0

Main vertices

1

Inflated vertices

2

White vertices

3

Pial vertices

4

Orig vertices

read_view_matrix

read_white_vertex_coordinates

really_center_brain

really_rotate_brain_x degrees

really_rotate_brain_y degrees

really_rotate_brain_z degrees

really_translate_brain rightLeftDistance anteriorPosteriorDistance superiorInferiorDistance

redraw

resend_to_subject

resize_brain

resize_window size

restore_ripflags mode

restore_initial_position

restore_zero_position

rip_all_vertices_except_contiguous_upripped

rotate_brain_x degrees

rotate_brain_y degrees

rotate_brain_z degrees

save_rgb

save_rgb_cmp_frame

save_tiff fileName

scale_brain zoomFactor

sclv_copy_all_view_settings_from_current_field

sclv_copy_view_settings_from_current_field field

sclv_copy_view_settings_from_field tofield toField

sclv_get_normalized_color_for_value value

sclv_load_label_value_file fileName field

sclv_read_bfile_values

sclv_read_binary_values

sclv_read_binary_values_frame fileName field

sclv_read_from_dotw fileName field

field

Vertex field name

Description

0

val

Overlay layer 0

1

val2

Overlay layer 1

2

valbak

Overlay layer 2

3

val2bak

Overlay layer 3

4

stat

Overlay layer 4

5

imag_val

Overlay layer 5

6

mean

Overlay layer 6

7

mean_imag

Overlay layer 7

8

std_error

Overlay layer 8

sclv_read_from_volume field fileName registrationType [registrationFileName]

0

Get registration from a file, and specify file in regitrationFileName

1

Look for a file named register.dat in the same directory as the volume.

2

Calculate an identity registration using the orig volume (must be present in subject's mri directory.

sclv_send_histogram field

sclv_send_current_field_info

sclv_set_current_field field

sclv_set_current_threshold_from_percentile min mid max

sclv_set_current_threshold_using_fdr rate markedOnly

sclv_set_current_timepoint timePoint condition

sclv_set_overlay_alpha alpha

sclv_smooth numberOfSteps field

sclv_write_dotw field

select_orig_vertex_coordinates

select_talairach_point x y z

select_vertex_by_vno vertexNumber

send_current_labels

send_spherical_point subjectName canonicalFileName origFileName

send_to_subject subjectName

curv_to_val

al_point with standard file names for canonicalFileName and origFileName.

set_current_vertex_set field

show_flat_regions surfaceFileName threshold

show_surf vertexSet

shrink numberOfSteps

smooth_curv numberOfSteps

stat_to_val

swap_vertex_fields field field

field

Vertex field name

Description

0

curv

Curvature display

1

curvbak

Backup curvature (not displayed

2

val

Overlay layer 0

3

imag_val

Overlay layer 5

4

val2

Overlay layer 1

5

valbak

Overlay layer 2

6

val2bak

Overlay layer 3

7

stat

Overlay layer 4

transform_brain

translate_brain_x distance

translate_brain_y distance

translate_brain_z distance

undo_last_action

val_to_curv

val_to_mark

val_to_stat

write_binary_curv

write_binary_dipoles

write_binary_patch

write_binary_sulc

write_binary_surface

write_fieldsign

write_fsmask

write_labeled_vertices

write_really_matrix

write_view_matrix

write_vrml mode

Index

Viewing Operations

align_sphere do_lighting_model draw_cursor left_click make_lateral_view move_window redraw rotate_brain_x rotate_brain_y rotate_brain_z scale_brain send_current_labels show_flat_regions translate_brain_x translate_brain_y translate_brain_z read_really_matrix read_view_matrix really_center_brain really_rotate_brain_x really_rotate_brain_y really_rotate_brain_z really_scale_brain really_translate_brain resize_brain resize_window restore_zero_position restore_initial_position transform_brain write_view_matrix write_really_matrix

I/O

func_load_timecourse func_load_timecourse_offset labl_export_annotation labl_import_annotation labl_load labl_load_color_table labl_save labl_save_all read_annotations read_binary_curv read_binary_decimation read_binary_dipoles read_binary_sulc read_binary_surf read_binary_values read_binary_values_frame read_binary_patch read_canon_vertex_coordinates read_curv_to_val read_fieldsign read_fsmask read_imag_vals read_labeled_vertices read_orig_vertex_coordinates read_pial_vertex_coordinates read_surface_vertex_set read_white_vertex_coordinates sclv_load_label_value_file sclv_read_bfile_values sclv_read_binary_values sclv_read_binary_values_frame sclv_read_from_dotw sclv_read_from_volume sclv_write_dotw write_binary_curv write_binary_dipoles write_binary_patch write_binary_surface write_binary_sulc write_fieldsign write_fsmask write_labeled_vertices write_vrml

Curvature Operations

clear_curvature compute_curvature curv_to_val fill_flood_from_cursor mark_contiguous_vertices_with_similar_curvature smooth_curv val_to_curv

Overlay Operations

curv_to_val f_to_t fill_flood_from_cursor label_to_stat mark_contiguous_vertices_over_thresh sclv_copy_all_view_settings_from_current_field sclv_copy_view_settings_from_current_field sclv_copy_view_settings_from_field sclv_get_normalized_color_for_value sclv_load_label_value_file sclv_read_bfile_values sclv_read_binary_values sclv_read_binary_values_frame sclv_read_from_dotw sclv_read_from_volume sclv_send_current_field_info sclv_send_histogram sclv_set_current_field sclv_set_current_threshold_from_percentile sclv_set_current_threshold_using_fdr sclv_set_current_timepoint sclv_set_overlay_alpha sclv_smooth sclv_write_dotw stat_to_val swap_val_val2 val_to_curv val_to_stat

Vertex Operations

fill_flood_from_cursor find_orig_vertex_coordinates fix_nonzero_vals flip_normals invert_face invert_surface invert_vertex read_canon_vertex_coordinates read_orig_vertex_coordinates read_pial_vertex_coordinates read_surface_vertex_set read_white_vertex_coordinates set_current_vertex_set show_surf shrink swap_vertex_fields

Cursor Operations

draw_cursor resend_to_subject select_orig_vertex_coordinates select_talairach_point select_vertex_by_vno send_spherical_point send_to_subject

Ripping and Cutting Operations

clear_ripflags cut_line cut_plane dilate_ripped restore_ripflags rip_all_vertices_except_contiguous_upripped undo_last_action

Reporting Information

dump_vertex get_selected_path_vnos labl_print_list labl_print_table plot_curv

Screen Shots

save_rgb save_rgb_cmp_frame save_tiff

Marking Operations

clear_all_vertex_marks clear_vertex_marks close_marked_vertices get_selected_path_vnos labl_mark_vertices labl_new_from_marked_vertices mark_annotation mark_contiguous_vertices_over_thresh mark_contiguous_vertices_with_similar_curvature mark_face mark_faces mark_vertex rip_all_vertices_except_contiguous_upripped val_to_mark

Label Operations

label_to_stat labl_dilate labl_erode labl_export_annotation labl_import_annotation labl_load labl_load_color_table labl_mark_vertices labl_new_from_marked_vertices labl_print_list labl_print_table labl_remove labl_remove_all labl_save labl_save_all labl_select labl_set_color labl_set_info labl_set_name_from_table labl_select_label_by_vno mask_label send_current_labels

Time Courses

func_clear_selection func_graph_timecourse_selection func_load_timecourse func_load_timecourse_offset func_print_timecourse_selection func_select_label func_select_marked_vertices

Paths

path_new_path_from_marked_vertices path_remove_selected_path path_select

Unsupported Functions

These commands are legacy functions that aren't documented well enough to be dependable. Because some older scripts still use them, they are documented here for completion. Use of them is not suggested nor supported.

Commands

add_subject_to_average_curvim subjectName morphSubdirectory

clear_all_vertex_cursor

compute_angles

compute_CMF

compute_cortical_thickness

compute_fieldsign

compute_pval_fwd pvalThreshold

compute_pval_inv

compute_select_fwd maximumDistance

maximumDistance is a floating point number in millimeters.

compute_timecourses

curv_shrink_to_fill numberOfSteps

curv_to_curvim

curvim_to_second_surface

curvim_to_surface

deconvolve_weights weightFileName scaleFileName

draw_all_cursor

draw_all_vertex_cursor

draw_curvature_line

draw_fundus

draw_radius

draw_theta

draw_vector fileName

ellipsoid_morph numberOfSteps rightLeftDistance anteriorPosteriorDistance superiorInferiorDistance

ellipsoid_project rightLeftDistance anteriorPosteriorDistance superiorInferiorDistance

ellipsoid_shrink numberOfSteps radius

ellipsoid_shrink_bug numberOfSteps radius length

f_to_p DOFnumerator DOFdenominator

flatten

fill_second_surface

filter_recs

load_gcsa fileName

load_vals_from_sol tmid dt condition

load_var_from_sol condition

make_lateral_view_second

normalize_area

normalize_binary_curv

normalize_inverse

normalize_second_binary_curv

normalize_time_courses type

open_window

orient_sphere

plot_all_time_courses

plot_marked fileName

put_retinotopy_stats_in_vals

read_and_color_labeled_vertices red green blue

read_and_smooth_parcellation parcellationFileName colorTableFileName soapBubbleIterations modeFilterIterations

read_annotated_image

read_curv_images

read_disc subjectName

read_iop fileName dipoleFileNumber

read_ncov fileName

read_parcellation parcellationFileName colorTableFileName

read_plot_list fileName

read_rec fileName

read_second_binary_curv

read_second_binary_surf

read_soltimecourse fileName

read_stds conditionNumber

read_surf fileName

read_vertex_list fileName

really_align_brain

really_center_second_brain

redraw_second

remove_triangle_links

restore_surf

save_surf

sclv_read_from_dotw_frame

second_surface_curv_to_curvim

shift_values

smooth_curvim numberOfSteps

smooth_curvim_sparse numberOfSteps

sphere_shrink numberOfSteps radius

smooth_fs numberOfSteps

smooth_val numberOfSteps

smooth_val_sparse numberOfSteps

sol_plot timePoint plotType

subsample_dist spacing

subsample_orient spacing

swap_buffers

swap_curv

swap_stat_val

swap_val_val2

swap_values

t_to_p DOF

to_double_buffer

to_single_buffer

twocond condition condition

write_binary_areas

write_binary_decimation

write_binary_values

write_curv_images

write_decimation

write_dipoles

write_fill_images

write_subsample

Index

add_subject_to_average_curvim clear_all_vertex_cursor compute_angles compute_CMF compute_cortical_thickness compute_fieldsign compute_pval_fwd compute_pval_inv compute_select_fwd compute_timecourses curv_shrink_to_fill curv_to_curvim curvim_to_second_surface curvim_to_surface deconvolve_weights draw_all_cursor draw_all_vertex_cursor draw_curvature_line draw_fundus draw_radius draw_theta draw_vector ellipsoid_morph ellipsoid_project ellipsoid_shrink ellipsoid_shrink_bug f_to_p flatten fill_second_surface filter_recs load_gcsa load_vals_from_sol load_var_from_sol make_lateral_view_second normalize_area normalize_binary_curv normalize_inverse normalize_second_binary_curv normalize_time_courses open_window orient_sphere plot_all_time_courses plot_marked put_retinotopy_stats_in_vals read_and_color_labeled_vertices read_and_smooth_parcellation read_annotated_image read_curv_images read_disc read_iop read_ncov read_parcellation read_plot_list read_rec read_second_binary_surf read_second_binary_curv read_soltimecourse read_stds read_surf read_vertex_list really_align_brain really_center_second_brain redraw_second remove_triangle_links restore_surf save_surf sclv_read_from_dotw_frame second_surface_curv_to_curvim shift_values smooth_curvim smooth_curvim_sparse sphere_shrink smooth_fs smooth_val smooth_val_sparse sol_plot subsample_dist subsample_orient swap_buffers swap_curv swap_stat_val swap_stat_val2 swap_values t_to_p to_single_buffer to_double_buffer twocond write_binary_areas write_binary_decimation write_binary_values write_curv_images write_decimation write_dipoles write_fill_images write_subsample

Notes

TkSurferGuide/TkSurferScripting/TkSurferScriptingReference (last edited 2010-04-26 18:50:48 by KrishSubramaniam)