Up to TkMeditGuide

Back to [:../TkMeditScripting: TkMeditScripting]

Continue to [:../TkMeditFileNameSubstitution: TkMeditFileNameSubstitution]

Scripting

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

Most of TkMedit'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, TkMedit.tcl, to see how most of the functionality is used. Following is a list of Tcl commands defined by TkMedit. You can use these commands in your own scripts and call them with the -tcl command line option to execute them on startup. TkMedit can run in a kind of batch mode in this fashion, altho 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 TkMedit 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 TkMedit.

Index

[#AverageSurfaceVertexPositions AverageSurfaceVertexPositions]

Commands

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

Anchor(AverageSurfaceVertexPositions) AverageSurfaceVertexPositions numberOfAverages

Anchor() ClearSelection

Anchor() ClearUndoVolume

Anchor() DebugPrint string

Anchor() ExportChangedSegmentationVolume volume [destinationDirectory]

Anchor() FlipVolume xAxis yAxis zAxis

Anchor(GetSubjectDir) GetSubjectDir volume

Anchor(GetSubjectName) GetSubjectName volume

Anchor(GotoMainVertex) GotoMainVertex vertexNumber

Anchor(GotoOriginalVertex) GotoOriginalVertex vertexNumber

Anchor(GotoPialVertex) GotoPialVertex vertexNumber

Anchor(GraphSelectedRegion) GraphSelectedRegion

Anchor(ImportSurfaceAnnotationToSegmentation) ImportSurfaceAnnotationToSegmentation surface annotationFileName colorTableFileName

Anchor(LoadAuxVolume) LoadAuxVolume volumeFileName

Loads volumeFileName as the Aux volume.

Anchor(LoadDTIVolumes) LoadDTIVolumes vectorVolumeFileName intensityVolumeFileName redAxis greenAxis blueAxis

Anchor(LoadFunctionalOverlay) LoadFunctionalOverlay volumeFileName registrationType [registrationFileName]

Anchor(LoadFunctionalTimeCourse) LoadFunctionalTimeCourse volumeFileName registrationType [registrationFileName]

Anchor(LoadGCA) LoadGCA volumeFileName transformFileName

Anchor(LoadGCARenormalization) LoadGCARenormalization renormalizationVolumeFileName

Anchor(LoadHeadPts) LoadHeadPts headPointsFileName transformFileName

Loads a head points array from headPointsFileName using the transform in transformFileName.

Anchor(LoadLabel) LoadLabel labelFileName

Anchor(LoadMainSurface) LoadMainSurface surface surfaceFileName

Anchor(LoadOriginalSurface) LoadOriginalSurface surface surfaceFileName

Anchor(LoadPialSurface) LoadPialSurface surface surfaceFileName

Anchor(LoadSegmentationVolume) LoadSegmentationVolume volume volumeFileName colorTableFileName

Anchor(LoadSurfaceAnnotation) LoadSurfaceAnnotation surface annotationFileName

Anchor(LoadVolumeDisplayTransform) LoadVolumeDisplayTransform volume transformFileName

Anchor(LoadVolume) LoadVolume volumeFileName

Anchor(NewControlPoint) NewControlPoint

Anchor(NewSegmentationVolume) NewSegmentationVolume volume fromAnatomicalVolume colorTableFileName

Anchor(Overlay_RestoreRegistration) Overlay_RestoreRegistration

Anchor(Overlay_SaveRegistration) Overlay_SaveRegistration

Anchor(Overlay_SetCondition) Overlay_SetCondition condition

Anchor(Overlay) Overlay_SetDisplayFlag flag value

0

Truncate Negative Values

1

Truncate Positive Values

2

Reverse Phase

3

Offset Values

4

Ignore Threshold

5

Grayscale Overlay

6

Opaque Overlay

Anchor(Overlay_SetRegistrationToIdentity) Overlay_SetRegistrationToIdentity

Anchor(Overlay_SetThreshold) Overlay_SetThreshold min mid slope

Anchor(Overlay_SetTimePoint) Overlay_SetTimePoint timePoint

Anchor(Overlay_SetVolumeSampleType) Overlay_SetVolumeSampleType sampleType

Anchor(QuitMedit) QuitMedit

Anchor(ReadCursor)

Anchor(ReadVoxelLabels) ReadVoxelLabels voxelLabelVolume1FileName voxelLabelVolume2FileName

Anchor(RecomputeSegmentation) RecomputeSegmentation volume

Anchor(RedrawAll) RedrawAll

Anchor(RedrawScreen) RedrawScreen

Anchor(RestoreHeadPts) RestoreHeadPts

Anchor(RestorePreviousSegmentation) RestorePreviousSegmentation volume

Anchor(RestoreVolumeFromSnapshot) RestoreVolumeFromSnapshot

Anchor(RotateHeadPts) RotateHeadPts degrees axis

Anchor(RotateOverlayRegistration) RotateOverlayRegistration degrees axis

Anchor(RotateVolume) RotateVolume axis degrees

Anchor(SaveGCA) SaveGCA volumeFileName

Anchor(SaveLabel) SaveLabel labelFileName

Anchor(SaveTIFF) SaveTIFF imageFileName

Anchor(SaveSegmentationVolume) SaveSegmentationVolume volume [destinationDirectory]

Anchor(SaveVolume) SaveVolume volume

Anchor(SaveVolumeAs) SaveVolumeAs volume destinationDirectory

Anchor(ScaleOverlayRegistration) ScaleOverlayRegistration distance axis

Anchor(SelectVoxelsByFuncValuecompareType) SelectVoxelsByFuncValue compareType

0

Greater than or equal to, or less than or equal to: If the value is positive, this will select all voxels whose value are greater than or equal to the value, and if negative, less than or equal to.

1

Equal to: Values must be equal

2

Greater than or equal to threshold minimum: This will select all voxels whose values are above the threshold minimum

Anchor(SendCursor) SendCursor

Anchor(SetBrushInfo) SetBrushInfo brush low high new

Anchor(SetBrushInfoToDefaults) SetBrushInfoToDefaults

Anchor(SetBrushShape) SetBrushShape radius shape 3D

Anchor(SetBrushTarget) SetBrushTarget target

Anchor(SetCursor) SetCursor coordinateSpace x y z

Anchor(SetCursorColor) SetCursorColor r g b

Anchor(SetCursorShape) SetCursorShape shape

Anchor(SetCursorToCenterOfSelection) SetCursorToCenterOfSelection

Anchor(SetDTIAlpha) SetDTIAlpha alpha

Anchor(SetDisplayConfig) SetDisplayConfig numberOfColumns numberOfRows linkPolicy

0

None: Normal link policy; cursor actions in other panes don't affect each other.

1

Cursor: Changing the cursor in one pane will set the cursor in other panes. Zoom levels are linked. Orientation changes are linked. When the display is set to this configuration, all panes are set to different orientations around the cursor.

2

Slice: Changing the slice number in one view will change all other views by the same amount. Cursor changes are not linked. Zoom levels are linked. Orientation changes are linked. When the display is first set to this configuration, all panes are set to the same orientation but to different slices.

Anchor(SetDisplayFlag) SetDisplayFlag flag value

1

Aux Volume

2

Anatomical Volume

3

Cursor

4

Main Surface

5

Original Surface

6

Pial Surface

7

Interpolate Surface Vertices

8

Surface Vertices

9

Control Points

10

Selection

11

Functional Overlay

12

Functional Color Scale Bar

13

Mask to Functional Overlay

14

Histogram Percent Change

15

Segmentation Volume Overlay

16

Aux Segmentation Volume

17

Segmentation Label Volume Count

18

DTI Overlay

20

Focus Frame

21

Undoable Voxels

22

Axes

23

Maximum Intensity Porjection

24

Head Points

25

Verbose GCA Dump

Anchor(SetFloodSelectParams) SetFloodSelectParams 3D sourceVolume fuzziness distance

Anchor(SetFuncOverlayAlpha) SetFuncOverlayAlpha alpha

Anchor(SetGCADisplayStatus) SetGCADisplayStatus displayIntermediateResults

Anchor(SetLinkedCursorFlag) SetLinkedCursorFlag linked

Anchor(SetOrientation) SetOrientation orientation

Anchor(SetSegBrushInfo) SetSegBrushInfo newValue 3D sourceVolume fuzziness distance

Sets the parameters for the Edit Segmentation tool, both brush and fill parameters. newValue should be a valid index in the currently loaded color table. 3D should be 0 or 1. sourceVolume should be 0 for the Main anatomical volume, 1 for the Aux anatomical volume, 2 for the Main segmentation volume, and 3 for the Aux segmentation volume. fuzziness and distance should be floating point numbers.

Anchor(SetSegmentationAlpha) SetSegmentationAlpha alpha

Sets the opacity alpha for the segmentation overlay. alpha should be a floating point number between 0 and 1.

Anchor(SetSelectedHeadPointLabel) SetSelectedHeadPointLabel label

Sets the label for the currently selected head point. label should be a string.

Anchor(SetSlice) SetSlice sliceNumber

Sets the slice number in the currently selected display pane for the anatomical volume. Note that this may trigger updates in other panes due to cursor linking. sliceNumber should be within the valid range of volume index coordinates.

Anchor(SetSurfaceDistanceAtCursor) SetSurfaceDistanceAtCursor

Copies the current surface distance value into the Main surface vertex nearest the cursor.

Anchor(SetSurfaceLineColor) SetSurfaceLineColor surface set r g b

Sets the surface line color. surface should be 0 for the Main surface, and 1 for the Aux surface. set should be 0 for Main, 1 for Original, and 2 for Pial. r, g, and b should be floating numbers from 0 to 1.

Anchor(SetSurfaceLineWidth) SetSurfaceLineWidth surface set width

Sets the surface line width. surface should be 0 for the Main surface, and 1 for the Aux surface. set should be 0 for Main, 1 for Original, and 2 for Pial. width should be an integer.

Anchor(SetTool) SetTool tool

Sets the currently active tool. tool should be 0 for Navigate, 1 for Select Voxels, 2 for Edit Voxels, 3 for Edit Segmentation, or 4 for Edit Control Points.

Anchor(SetVolumeBrightnessContrast) SetVolumeBrightnessContrast volume brightness contrast

Sets the brightness and contrast values for a volume. volume should be 0 for the Main volume, and 1 for the Aux volume. brightness should be a floating point number from 0 to 1 (0 is brighter than 1) and contrast should be a floating point number from 0 to 30.

Anchor(SetVolumeColorScale) SetVolumeColorScale volume brightness contrast min max

Sets the color (grayscale, really) scale for a volume. volume should be 0 for the Main volume, and 1 for the Aux volume. brightness should be a floating point number from 0 to 1 (0 is brighter than 1) and contrast should be a floating point number from 0 to 30. min and max define the values for black and white and should be valid numbers in the voxel value range.

Anchor(SetVolumeMinMax) SetVolumeMinMax volume min max

Sets the color (grayscale, really) scale for a volume. volume should be 0 for the Main volume, and 1 for the Aux volume. min and max define the values for black and white and should be valid numbers in the voxel value range.

Anchor(SetVolumeResampleMethod) SetVolumeResampleMethod volume method

Sets the resampling method for an anatomical volume. volume should be 0 for the Main volume, and 1 for the Aux volume. method should be 0 for RAS and 1 for slice.

Anchor(SetVolumeSampleTypevolume) SetVolumeSampleTypevolume sampleType

Sets the sampling method for an anatomical volume. volume should be 0 for the Main volume, and 1 for the Aux volume. sampleType should be 0 for nearest neighbor, 1 for trilinear, and 2 for sinc.

Anchor(SetZoomCenter) SetZoomCenter x y z

Sets the zoom center of the current display pane, changing the visible area without setting the cursor. x, y, and z should be integers in the anatomical index space.

Anchor(SetZoomLevel) SetZoomLevel level

Sets the zoom level of the current display pane. level should be an integer from 1 to 128.

Anchor(ShowNearestInterpolatedMainVertex) ShowNearestInterpolatedMainVertex

Sets the cursor to the point of the nearest interpolated vertex on the Main surface configuration.

Anchor(ShowNearestInterpolatedOriginalVertex) ShowNearestInterpolatedOriginalVertex

Sets the cursor to the point of the nearest interpolated vertex on the Original surface configuration.

Anchor(ShowNearestInterpolatedPialVertex) ShowNearestInterpolatedPialVertex

Sets the cursor to the point of the nearest interpolated vertex on the Pial surface configuration.

Anchor(ShowNearestMainVertex) ShowNearestMainVertex

Sets the cursor to the point of the vertex on the Main surface configuration.

Anchor(ShowNearestOriginalVertex) ShowNearestOriginalVertex

Sets the cursor to the point of the vertex on the Original surface configuration.

Anchor(ShowNearestPialVertex) ShowNearestPialVertex

Sets the cursor to the point of the vertex on the Pial surface configuration.

Anchor(SmartCutAtCursor) SmartCutAtCursor

Performs a smart cut operation at the current cursor location.

Anchor(SmoothFunctionalOverlay) SmoothFunctionalOverlay sigma

Smooths the functional overlay volume with given sigma. sigma should be a floating point number.

Anchor(SnapshotVolume) SnapshotVolume

Saves the state of the Main anatomical volume so it can be restored later.

Anchor(ThresholdVolume) ThresholdVolume thresholdValue direction newValue

Performs a thresholding operation on the Main anatomical volume. thresholdValue is the value above or below which all values will be set to newValue, and both must be valid anatomical values. direction should be 0 for below, or 1 for above.

Anchor(TimeCourse) TimeCourse_PrintSelectionRangeToFile fileName

Prints information about the averaged time course values over all time points for the selected voxels to a text file fileName.

Anchor(TimeCourse) TimeCourse_SetDisplayFlagflag flag value

Sets a display flag for the functional time course. value should be 0 or 1. flag should be one of the following, corresponding to an item in the View, Configure Time Course... dialog box:

7 Open Graph Window 8 Offset Values 9 Show Prestim Offset

Anchor(TimeCourse) TimeCourse_SetNumPreStimPoints numPoints

Sets the number of pre-stim time points in the time course volume to numPoints.

Anchor(TimeCourse) TimeCourse_SetTimeResolution resolution

Sets the time resolution of the time course volume to resolution.

Anchor(TranslateHeadPts) TranslateHeadPts distance axis

Translates the head points orientation by distance units over the x, y, or z axis. axis can be x, y, or z.

Anchor(UndoLastEdit) UndoLastEdit

Performs and undo.

Anchor(UnloadAllSurfaces) UnloadAllSurfaces

Unloads the Main and Aux surface.

Anchor(UnloadGCA) UnloadGCA

Unloads the GCA volume.

Anchor(UnloadSurface) UnloadSurface surface

Unloads a surface. surface should be 0 for the Main surface, or 1 for the Aux surface.

Anchor(UnloadVolume) UnloadVolume volume

Unloads an anatomical volume. volume should be 0 for the Main volume, or 1 for the Aux volume.

Anchor(UnloadVolumeDisplayTransformvolume) UnloadVolumeDisplayTransformvolume

Unloads an anatomical volume display transform. volume should be 0 for the Main volume's transform, or 1 for the Aux volume's transform.

Anchor(WriteControlPointFile) WriteControlPointFile

Writes the control points to the control.dat file. This is done automatically when adding a new point, but not when removing a point.

Anchor(WriteHeadPointsFile) WriteHeadPointsFile

Writes the head points file. This overwrites the previous file.

Anchor(WriteHeadPointsTransform) WriteHeadPointsTransform

Writes the head points transform file. This overwrites the previous file.

Anchor(WriteSurfaceValues) WriteSurfaceValues surface valueFileName

Writes the a surface's vertex values to a value file valueFileName. surface should be 0 for the Main surface, or 1 for the Aux surface.