Up to TkSurferGuide |
Back to [:.../TkSurferIntroToScripting: TkSurferScripting] |
Continue to [:TkSurferGuide/TkSurferReference: 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.
Commands
Functions arguments are listed by their name followed by their arguments. Arguments in square brackets are optional.
Anchor(swap_buffers) swap_buffers
Desc.
Anchor(to_single_buffer) to_single_buffer
Desc.
Anchor(to_double_buffer) to_double_buffer
Desc.
Anchor(open_window) open_window
Desc.
Anchor(help) help
Desc.
Anchor(redraw) redraw
Desc.
Anchor(redraw_second) redraw_second
Desc.
Anchor(shrink) shrink numberOfSteps
Desc.
Anchor(area_shrink) area_shrink numberOfSteps
Desc.
Anchor(sphere_shrink) sphere_shrink numberOfSteps radius
Desc. radius is in millimeters.
Anchor(ellipsoid_project) ellipsoid_project rightLeftDistance anteriorPosteriorDistance superiorInferiorDistance
Desc. All distances are in radius.
Anchor(ellipsoid_morph) ellipsoid_morph numberOfSteps rightLeftDistance anteriorPosteriorDistance superiorInferiorDistance
Desc. All distances are in radius.
Anchor(ellipsoid_shrink) ellipsoid_shrink numberOfSteps radius
Desc. radius is in millimeters.
Anchor(ellipsoid_shrink_bug) ellipsoid_shrink_bug numberOfSteps radius length
Desc. radius and length is in millimeters.
Anchor(curv_shrink_to_fill) curv_shrink_to_fill numberOfSteps
Desc.
Anchor(smooth_curvim) smooth_curvim numberOfSteps
Desc.
Anchor(smooth_curv) smooth_curv numberOfSteps
Desc.
Anchor(smooth_val) smooth_val numberOfSteps
Desc.
Anchor(smooth_val_sparse) smooth_val_sparse numberOfSteps
Desc.
Anchor(smooth_curvim_sparse) smooth_curvim_sparse numberOfSteps
Desc.
Anchor(smooth_fs) smooth_fs numberOfSteps
Desc.
Anchor(add_subject_to_average_curvim) add_subject_to_average_curvim subjectName morphSubjectDirectory
Desc.
Anchor(read_curv_images) read_curv_images
Desc.
Anchor(read_stds) read_stds conditionNumber
Desc.
Anchor(read_second_binary_surf) read_second_binary_surf
Desc. Reads the file name from targsurf.
Anchor(read_second_binary_curv) read_second_binary_curv
Desc. Reads the file name from targcurv.
Anchor(normalize_second_binary_curv) normalize_second_binary_curv
Desc.
Anchor(curv_to_curvim) curv_to_curvim
Desc.
Anchor(second_surface_curv_to_curvim) second_surface_curv_to_curvim
Desc.
Anchor(curvim_to_second_surface) curvim_to_second_surface
Desc.
Anchor(swap_curv) swap_curv
Desc.
Anchor(curvim_to_surface) curvim_to_surface
Desc.
Anchor(read_binary_surf) read_binary_surf
Desc. Reads the file name from insurf.
Anchor(read_surf) read_surf fileName
Desc.
Anchor(save_surf) save_surf
Desc.
Anchor(restore_surf) restore_surf
Desc.
Anchor(show_surf) show_surf vertexSet
Desc. vertexSet is white, pial, or inflate.
Anchor(read_binary_curv) read_binary_curv
Desc. Reads the file name from curv.
Anchor(read_binary_sulc) read_binary_sulc
Desc. Reads the file name from sulc.
Anchor(read_binary_values) read_binary_values
Desc. Will read the value file from val.
Anchor(read_binary_values_frame) read_binary_values_frame
Desc. Will read the value file from val.
Anchor(read_annotated_image) read_annotated_image
Desc. Will read the file from annot.
Anchor(read_annotations) read_annotations fileName
Desc. fileName is an annotation file name, usually ending in .annot.
Anchor(read_binary_patch) read_binary_patch
Desc. Will read the file name from patch.
Anchor(read_fieldsign) read_fieldsign
Desc. Will read the file name from fs.
Anchor(read_fsmask) read_fsmask
Desc. Will read the file name from fm.
Anchor(write_binary_areas) write_binary_areas
Desc. Will read the file name from area.
Anchor(write_binary_surface) write_binary_surface
Desc. Will read the file name from outsurf.
Anchor(write_binary_curv) write_binary_curv
Desc. Will read the file name from curv.
Anchor(write_binary_sulc) write_binary_sulc
Desc. Will read the file name from sulc.
Anchor(write_binary_values) write_binary_values
Desc. Will read the file name from val.
Anchor(write_binary_patch) write_binary_patch
Desc. Will read the file name from patch.
Anchor(write_labeled_vertices) write_labeled_vertices
Desc. Will read the file name from label.
Anchor(read_labeled_vertices) read_labeled_vertices
Desc. Will read the file name from label.
Anchor(read_and_color_labeled_vertices) read_and_color_labeled_vertices red green blue
Desc. The colors are integers from 0-254.
Anchor(write_fieldsign) write_fieldsign
Desc. Will read the file name from fs.
Anchor(write_fsmask) write_fsmask
Desc. Will read the file name from fm.
Anchor(write_vrml) write_vrml mode
Desc. Will read the file name from vrmlsurf. mode is 0 for pts, 1 for gray, and 2 for curv.
Anchor(write_binary_dipoles) write_binary_dipoles
Desc. Will read the file name from dip.
Anchor(write_binary_decimation) write_binary_decimation
Desc. Will read the file name from dec.
Anchor(write_dipoles) write_dipoles
Desc. Will read the file name from dip.
Anchor(write_decimation) write_decimation
Desc. Will read the file name from dec.
Anchor(write_curv_images) write_curv_images
Desc. Will read the file name from targcurvim.
Anchor(write_fill_images) write_fill_images
Desc.
Anchor(fill_second_surface) fill_second_surface
Desc.
Anchor(subsample_dist) subsample_dist spacing
Desc. spacing is an integer.
Anchor(subsample_orient) subsample_orient spacing
Desc. spacing is an integer.
Anchor(write_subsample) write_subsample
Desc. Will read the file name from fs.
Anchor(compute_curvature) compute_curvature
Desc.
Anchor(compute_CMF) compute_CMF
Desc.
Anchor(compute_cortical_thickness) compute_cortical_thickness
Desc.
Anchor(clear_curvature) clear_curvature
Desc.
Anchor(clear_ripflags) clear_ripflags
Desc.
Anchor(restore_ripflags) restore_ripflags mode
Desc. This will swap a set field vertex rip fields, and then rip the surface. If mode is 1, will swap the oripflag and ripflag fields. If mode is 2, will set the oripflag field from the ripflag field and the ripflag field from the origripflag field. After the rip, all vertices will be unmarked.
Anchor(dilate_ripped) dilate_ripped
Desc.
Anchor(twocond) twocond condition condition
Desc. Both conditions are integers.
Anchor(cut_line) cut_line closed
Desc. closed should be 0 for an open line, and 1 for a closed line.
Anchor(plot_curv) plot_curv closed
Desc. Draws a curve between marked vertices, and generates a summary file of all vertices on that curve, including values of all the overlay layers and the distance form the first point. closed should be 0 for an open curve, and 1 for a closed curve. The file is called surfer_curv.dat.
Anchor(draw_fundus) draw_fundus
Desc.
Anchor(plot_marked) plot_marked fileName
Desc. Generates a summary file of data from all marked vertices in fileName.
Anchor(put_retinotopy_stats_in_vals) put_retinotopy_stats_in_vals
Desc. Calculates retinotopy values at each vertex and stores them in the first overlay layer.
Anchor(draw_vector) draw_vector fileName
Desc. Reads an x/y vector from fileName and draws it to the screen.
Anchor(cut_plane) cut_plane
Desc. Cuts a plane based on four marked vertices: three to define the plane, and one to indicate which area to not cut.
Anchor(flatten) flatten
Desc. Reads the file name from subjtmpdir.
Anchor(normalize_binary_curv) normalize_binary_curv
Desc.
Anchor(normalize_area) normalize_area
Desc.
Anchor(shift_values) shift_values
Desc.
Anchor(swap_values) swap_values
Desc.
Anchor(swap_stat_val) swap_stat_val
Desc.
Anchor(swap_val_val2) swap_val_val2
Desc.
Anchor(compute_angles) compute_angles
Desc.
Anchor(compute_fieldsign) compute_fieldsign
Desc.
Anchor(draw_radius) draw_radius
Desc.
Anchor(draw_theta) draw_theta
Desc.
Anchor(save_rgb) save_rgb
Desc. Reads the file name from rgb.
Anchor(save_rgb_cmp_frame) save_rgb_cmp_frame
Desc. Reads the file name from rgb. Write an rgb frame file to be composed into a movie later.
Anchor(rotate_brain_x) rotate_brain_x degrees
Desc. `rotate_brain_y degrees Anchor(rotate_brain_z) rotate_brain_z degrees
Desc. degrees is a floating point number.
Anchor(translate_brain_x) translate_brain_x distance
Desc. `translate_brain_y distance Anchor(translate_brain_z) translate_brain_z distance
Desc. distance is in millimeter.
Anchor(scale_brain) scale_brain amount
Desc. amount is a floating point number.
Anchor(resize_window) resize_window size
Desc. size is an integer. The new window size will be sqaure with size x sizedimensions.
Anchor(move_window) move_window x y
Desc. x and y are integers.
Anchor(do_lighting_model) do_lighting_model light0 light1 light2 light3 offset
Desc. light0 through light3 are light levels from different positions and offset is overal ambient light. All values are floating points from 01.
Anchor(restore_zero_position) restore_zero_position
Desc.
Anchor(restore_initial_position) restore_initial_position
Desc.
Anchor(make_lateral_view) make_lateral_view
Desc.
Anchor(make_lateral_view_second) make_lateral_view_second
Desc.
Anchor(read_view_matrix) read_view_matrix
Desc. Reads the file name from subjtmpdir.
Anchor(write_view_matrix) write_view_matrix
Desc. Reads the file name from subjtmpdir.
Anchor(read_really_matrix) read_really_matrix
Desc. Reads the file name from subjtmpdir.
Anchor(write_really_matrix) write_really_matrix
Desc. Reads the file name from subjtmpdir.
Anchor(really_translate_brain) really_translate_brain rightLeftDistance anteriorPosteriorDistance superiorInferiorDistance
Desc. All distances are in millimeters and can be floating point.
Anchor(really_scale_brain) really_scale_brain rightLeftFactor anteriorPosteriorFactor superiorInferiorFactor
Desc. All factors are floating point numbers.
Anchor(really_rotate_brain_x) really_rotate_brain_x degrees
Desc. `really_rotate_brain_y degrees Anchor(really_rotate_brain_z) really_rotate_brain_z degrees
Desc. Rotates the brain on the lh/rh axis. degrees is a floating point number.
Anchor(align_sphere) align_sphere
Desc.
Anchor(really_center_brain) really_center_brain
Desc.
Anchor(really_center_second_brain) really_center_second_brain
Desc.
Anchor(really_align_brain) really_align_brain
Desc.
Anchor(read_binary_decimation) read_binary_decimation
Desc. Reads the file name from dec.
Anchor(read_binary_dipoles) read_binary_dipoles
Desc. Reads the file name from dip.
Anchor(load_vals_from_sol) load_vals_from_sol tmid dt condition
Desc. tmid is the midpoint, dt is the delta to go on either side, and condition is the condition to use.
Anchor(load_var_from_sol) load_var_from_sol condition
Desc.
Anchor(compute_timecourses) compute_timecourses
Desc.
Anchor(filter_recs) filter_recs
Desc.
Anchor(read_rec) read_rec fileName
Desc.
Anchor(read_iop) read_iop fileName dipoleFileNumber
Desc.
Anchor(read_ncov) read_ncov fileName
Desc.
Anchor(normalize_time_courses) normalize_time_courses type
Desc. type should be 0 to set all values to 1, 1 for normalizing for baseline noise covariance, 2 for normalizing for white noise, 3 for normalizing by read noise covariance matrix, and 4 for unity gain.
Anchor(compute_timecourses) compute_timecourses
Desc.
Anchor(compute_pval_fwd) compute_pval_fwd pvalThreshold
Desc. pvalThreshold is a floating point number.
Anchor(compute_select_fwd) compute_select_fwd maximumDistance
Desc. maximumDistance is a floating point number in millimeters.
Anchor(compute_pval_inv) compute_pval_inv
Desc.
Anchor(normalize_inverse) normalize_inverse
Desc.
Anchor(find_orig_vertex_coordinates) find_orig_vertex_coordinates
Desc.
Anchor(select_orig_vertex_coordinates) select_orig_vertex_coordinates
Desc.
Anchor(select_talairach_point) select_talairach_point x y z
Desc. x y and z are floating point talairach values.
Anchor(read_white_vertex_coordinates) read_white_vertex_coordinates
Desc.
Anchor(read_pial_vertex_coordinates) read_pial_vertex_coordinates
Desc.
Anchor(read_orig_vertex_coordinates) read_orig_vertex_coordinates
Desc. Reads the file name from origcoords.
Anchor(read_canon_vertex_coordinates) read_canon_vertex_coordinates fileName
Desc.
Anchor(send_spherical_point) send_spherical_point subjectName canonicalFileName origFileName
Desc. subjectName is the subject for whom to write the cursor fiel. canonicalFileName is the file from which to read the canonical vetex positions. origFileName is the file from which to read the original vetex positions. Those filenames are relative to the subjectName. This will write to the edit.dat cursor file.
Anchor(send_to_subject) send_to_subject subjectName
Desc. Calls send_spherical_point with standard file names for canonicalFileName and origFileName.
Anchor(resend_to_subject) resend_to_subject
Desc. Calls send_to_subject with the sam subject name used in the previous send_to_subject call.
Anchor(invert_surface) invert_surface
Desc. Inverts the vertex normals for all unripped vertices in the surface, but not the faces.
Anchor(fix_nonzero_vals) fix_nonzero_vals
Desc. Sets the fixedval value for each vertex to 1 if the overlay value for that vertex is not 0, and to 0 if the value is 0.
Anchor(invert_vertex) invert_vertex vertexNumber
Desc. Inverts the vertex normal at the numbered vertex.
Anchor(invert_face) invert_face faceNumber
Desc. Inverts the face normal at the numbered face.
Anchor(mark_annotation) mark_annotation vertexNumber
Desc. Will mark all vertices with the same annotation value as the annotation value at the specified vertex.
Anchor(mark_faces) mark_faces vertexNumber
Desc. Marks all vertices in the face to which the specified vertex belongs.
Anchor(mark_face) mark_face faceNumber
Desc. Mark the specified face.
Anchor(dump_vertex) dump_vertex vertexNumber
Desc. Prints information about the specified vertex.
Anchor(val_to_mark) val_to_mark
Desc. Will mark all vertices with overlay values greater than the overlay threshold.
Anchor(resize_brain) resize_brain
Desc. Scales the brain according to the surface area to total area ration.
Anchor(transform_brain) transform_brain
Desc. Recenters the brain.
Anchor(show_flat_regions) show_flat_regions surfaceFileName threshold
Desc. Reads vertex positions from surfaceFileName. For every vertex normal with a component longer than threshold, will set the overlay value at that vertex to the value of that component, otherwise sets the value to 0. threshold is a floating point number.
Anchor(val_to_stat) val_to_stat
Desc. Copies the values of the overlay value field to the stat field.
Anchor(stat_to_val) stat_to_val
Desc. Copies the values of the stat field to the overlay value field.
Anchor(read_soltimecourse) read_soltimecourse fileName
Desc.
Anchor(read_imag_vals) read_imag_vals fileName
Desc. Reads imaginary values from fileName.
Anchor(sol_plot) sol_plot timePoint plotType
Desc. Uses the dlat value in computing the range.
Anchor(remove_triangle_links) remove_triangle_links
Desc.
Anchor(f_to_t) f_to_t
Desc. Squares and takes the absolute value for every overlay value field in the vertices.
Anchor(label_to_stat) label_to_stat overlayField
Desc. Creates a new overlay layer with the values in the current label in overlay field overlayField.
Anchor(t_to_p) t_to_p DOF
Desc.
Anchor(f_to_p) f_to_p DOFnumerator DOFdenominator
Desc.
Anchor(val_to_curv) val_to_curv
Desc. Copies the first overlay values into the curvature values.
Anchor(curv_to_val) curv_to_val
Desc. Copies the curvature values into the first overlay values.
Anchor(read_curv_to_val) read_curv_to_val fileName
Desc.
Anchor(read_and_smooth_parcellation) read_and_smooth_parcellation parcellationFileName colorTableFileName soapBubbleIterations modeFilterIterations
Desc. Reads a parcellation from parcellationFileName using colorTableFileName and performs soap bubble and mode filter on the values.
Anchor(read_parcellation) read_parcellation parcellationFileName colorTableFileName
Desc.
Anchor(deconvolve_weights) deconvolve_weights weightFileName scaleFileName
Desc.
Anchor(read_disc) read_disc subjectName
Desc.
Anchor(mask_label) mask_label labelFileName
Desc.
Anchor(orient_sphere) orient_sphere
Desc.
Anchor(dump_faces) dump_faces vertexNumber
Desc. Prints information about all faces connected to the specified vertex.
Anchor(load_gcsa) load_gcsa fileName
Desc.
Anchor(left_click) left_click x y
Desc. Simulates a click at the given window position.
Anchor(plot_all_time_courses) plot_all_time_courses
Desc.
Anchor(read_plot_list) read_plot_list fileName
Desc.
Anchor(read_vertex_list) read_vertex_list fileName
Desc.
Anchor(draw_cursor) draw_cursor vertexNumber on
Desc. Draws the specified vertex in blue if on, or in the background color if not on.
Anchor(mark_vertex) mark_vertex vertexNumber on
Desc. Marks or unmarks a specified vertex.
Anchor(draw_all_cursor) draw_all_cursor
Desc.
Anchor(draw_all_vertex_cursor) draw_all_vertex_cursor
Desc.
Anchor(clear_all_vertex_cursor) clear_all_vertex_cursor
Desc.
Anchor(send_current_labels) send_current_labels
Desc.
Anchor(select_vertex_by_vno) select_vertex_by_vno vertexNumber
Desc.
Anchor(swap_vertex_fields) swap_vertex_fields field field
Desc.
Anchor(clear_vertex_marks) clear_vertex_marks
Desc.
Anchor(clear_all_vertex_marks) clear_all_vertex_marks
Desc.
Anchor(close_marked_vertices) close_marked_vertices
Desc.
Anchor(undo_last_action) undo_last_action
Desc.
Anchor(sclv_read_from_dotw) sclv_read_from_dotw fileName field
Desc.
Anchor(sclv_read_binary_values) sclv_read_binary_values
Desc.
Anchor(sclv_read_from_dotw_frame) sclv_read_from_dotw_frame
Desc.
Anchor(sclv_read_binary_values_frame) sclv_read_binary_values_frame fileName field
Desc.
Anchor(sclv_read_from_volume) sclv_read_from_volume
Desc.
Anchor(sclv_read_bfile_values) sclv_read_bfile_values
Desc.
Anchor(sclv_write_dotw) sclv_write_dotw field
Desc. Reads the file name val.
Anchor(sclv_load_label_value_file) sclv_load_label_value_file fileName field
Desc.
Anchor(sclv_smooth) sclv_smooth numberOfSteps field
Desc.
Anchor(sclv_set_overlay_alpha) sclv_set_overlay_alpha alpha
Desc.
Anchor(sclv_set_current_field) sclv_set_current_field field
Desc.
Anchor(sclv_set_current_timepoint) sclv_set_current_timepoint timePoint condition
Desc.
Anchor(sclv_copy_view_settings_from_current_field) sclv_copy_view_settings_from_current_field toField fromField
Desc.
Anchor(sclv_copy_all_view_settings_from_current_field) sclv_copy_all_view_settings_from_current_field toField
Desc.
Anchor(sclv_copy_view_settings_from_field) sclv_copy_view_settings_from_field toField
Desc.
Anchor(sclv_set_current_threshold_from_percentile) sclv_set_current_threshold_from_percentile threshold midPoint slope
Desc.
Anchor(sclv_set_current_threshold_using_fdr) sclv_set_current_threshold_using_fdr rate markedOnly
Desc.
Anchor(sclv_send_histogram) sclv_send_histogram field
Desc.
Anchor(sclv_send_current_field_info) sclv_send_current_field_info
Desc.
Anchor(sclv_get_normalized_color_for_value) sclv_get_normalized_color_for_value value
Desc.
Anchor(read_surface_vertex_set) read_surface_vertex_set field vertexSet
Desc.
Anchor(set_current_vertex_set) set_current_vertex_set
Desc.
Anchor(func_load_timecourse) func_load_timecourse fileName registrationType registrationFileName
Desc. registrationFileName is necessary only of registrationType is file.
Anchor(func_load_timecourse_offset) func_load_timecourse_offset fileName registrationType registrationFileName
Desc. registrationFileName is necessary only of registrationType is file.
Anchor(func_select_marked_vertices) func_select_marked_vertices
Desc.
Anchor(func_select_label) func_select_label
Desc.
Anchor(func_clear_selection) func_clear_selection
Desc.
Anchor(func_graph_timecourse_selection) func_graph_timecourse_selection
Desc.
Anchor(func_print_timecourse_selection) func_print_timecourse_selection fileName
Desc.
Anchor(labl_load_color_table) labl_load_color_table fileName
Desc.
Anchor(labl_load) labl_load fileName
Desc.
Anchor(labl_save) labl_save label fileName
Desc.
Anchor(labl_save_all) labl_save_all prefix
Desc.
Anchor(labl_import_annotation) labl_import_annotation fileName
Desc.
Anchor(labl_export_annotation) labl_export_annotation fileName
Desc.
Anchor(labl_new_from_marked_vertices) labl_new_from_marked_vertices
Desc.
Anchor(labl_mark_vertices) labl_mark_vertices index
Desc.
Anchor(labl_select) labl_select index
Desc.
Anchor(labl_set_name_from_table) labl_set_name_from_table index
Desc.
Anchor(labl_set_info) labl_set_info index name structureIndex visibility
Desc.
Anchor(labl_set_color) labl_set_color index red green blue
Desc.
Anchor(labl_remove) labl_remove index
Desc.
Anchor(labl_remove_all) labl_remove_all
Desc.
Anchor(labl_erode) labl_erode index
Desc.
Anchor(labl_dilate) labl_dilate index
Desc.
Anchor(labl_select_label_by_vno) labl_select_label_by_vno vertexNumber
Desc.
Anchor(labl_print_list) labl_print_list
Desc.
Anchor(labl_print_table) labl_print_table
Desc.
Anchor(path_select) path_select index
Desc.
Anchor(path_new_path_from_marked_vertices) path_new_path_from_marked_vertices
Desc.
Anchor(path_remove_selected_path) path_remove_selected_path
Desc.
Anchor(fill_flood_from_cursor) fill_flood_from_cursor dontCrossPath dontCrossLabel dontFillUnlabeled dontCrossCuravature dontCrossThreshold multipleSeeds action argument
Desc.
Anchor(draw_curvature_line) draw_curvature_line
Desc.
Anchor(get_marked_vnos) get_marked_vnos
Desc.
Anchor(get_selected_path_vnos) get_selected_path_vnos
Desc.
Anchor(save_tiff) save_tiff fileName
Desc.
Anchor(flip_normals) flip_normals axes
Desc. axes is a string containing x, y, or z, or any combination.
Anchor(mark_contiguous_vertices_over_thresh) mark_contiguous_vertices_over_thresh
Desc.
Anchor(mark_contiguous_vertices_with_similar_curvature) mark_contiguous_vertices_with_similar_curvature
Desc.
Anchor(rip_all_vertices_except_contiguous_upripped) rip_all_vertices_except_contiguous_upripped
Desc.