Scripting
Commands
Note that many commands take IDs, such as layerID, collectionID, viewID, toolID, frameID, etc. These IDs are generated when the objects they refer to are created. As input, they must refer to valid objects. If they don't you'll receive an error. All IDs are integers.
Anchor(PrintAllCommands) PrintAllCommands
- Print all registered commands.
Anchor(GetLayerIDList) GetLayerIDList
- Returns a list of all layerIDs.
Anchor(SetNumberOfViewMarkers) SetNumberOfViewMarkers numMarkers
- Sets the number of view markers.
Anchor(GetNumberOfViewMarkers) GetNumberOfViewMarkers
- Returns the number of view markers.
Anchor(ExportMarkersToControlPoints) ExportMarkersToControlPoints collectionID fileName
- Writes the markers to a control.dat file using a volume collection to transform them.
Anchor(ImportMarkersFromControlPoints) ImportMarkersFromControlPoints collectionID fileName
- Imports markers from a control.dat file using a volume collection to transform them..
Anchor(SetViewRASCursor) SetViewRASCursor x y z
Sets the cursor in RAS coords. x, y, and z are floating point numbers.
Anchor(GetViewRASCursor) GetViewRASCursor
- Returns the cursor in RAS coords in a list of x y z coords.
Anchor(GetROIIDList) GetROIIDList
- Return a list of all ROIs.
Anchor(GetColorLUTIDList) GetColorLUTIDList
- Return a list of all colorLUTIDs.
Anchor(MakeNewColorLUT) MakeNewColorLUT
- Creates a new color LUT and returns its ID.
Anchor(GetTransformIDList) GetTransformIDList
- Return a list of all transformIDs.
Anchor(MakeNewTransform) MakeNewTransform
- Creates a new transform and returns its ID.
Anchor(MakeLayer) MakeLayer layerType
Makes a new layer of the given type and returns the layerID. layerID should be a recognized layer type such as:
2DMRI |
A layer for drawing a volume |
2DMRIS |
A layer for showing a surface intersected on a plane |
Note that there are easier functions to use to load data, such as LoadVolume and LoadSurface. This is a low level function that creates a layer but does not associate any data with it nor add it to any views.
Anchor(DeleteLayer) DeleteLayer layerID
- Deletes a layer. Does not delete any data collections associated with it.
Anchor(GetDataCollectionIDList) GetDataCollectionIDList
- Return a list of all collectionIDs.
Anchor(MakeDataCollection) MakeDataCollection collectionType
Make a new data collection of the given type and return the collectionID. collectionID should be a recognized collection type such as:
Volume |
A 3D volume for display in a 2DMRI layer. |
Surface |
A 3D surface for display in a 2DMRIS layer. |
Note that there are easier functions to use to load data, such as LoadVolume and LoadSurface. This is a low level function that creates a data collection but does not load any actual data nor create a layer.
Anchor(DeleteDataCollection) DeleteDataCollection collectionID
- Delete a data collection.
Anchor(WritePathFile) WritePathFile fileName
- Write paths to a file.
Anchor(ReadPathFile) ReadPathFile fileName
- Read paths from a file.
Anchor(ClearSegVolReport) ClearSegVolReport
- Clears all info in the segmentation volume report.
Anchor(SetSegVolReportSegmentation) SetSegVolReportSegmentation segID
- Set the segmentation volume in the segmentation volume report.
Anchor(AddSegVolReportIntensityVolume) AddSegVolReportIntensityVolume volID
- Add an intensity volume to the segmentation volume report.
Anchor(SetROIForSegVolReport) SetROIForSegVolReport volID roiID
- Set the volume and ROI to use in the segmentation volume report.
Anchor(DontUseROIInSegVolReport) DontUseROIInSegVolReport
- Don't use an ROI in the segmentation volume report.
Anchor(SetSegVolReportLUT) SetSegVolReportLUT lutID
- Set the LUT in the segmentation volume report.
Anchor(AddSegmentationToSegVolReport) AddSegmentationToSegVolReport structure
- Add a segmentation to the segmentation volume report.
Anchor(MakeSegVolReport) MakeSegVolReport fnReport
- Make the segmentation volume report.
Anchor(MakeSegVolIntensityReport) MakeSegVolIntensityReport fnReport
- Make the intensity report from the segmentation volume report.
Anchor(SetToolMode) SetToolMode toolID mode
Sets the current mode of a tool. mode should be one of the following:
navigation |
The navigation tool |
plane |
The plane tool |
marker |
The marker tool |
voxelEditing |
The voxel editing tool |
voxelFilling |
The voxel filling tool |
roiEditing |
The ROI editing tool |
roiFilling |
The ROI filling tool |
straightPath |
The straight path tool |
edgePath |
The edge path tool |
Anchor(GetToolMode) GetToolMode toolID
Gets the current mode of a tool. The returned string will be one of the tool modes supplied to SetToolMode.
Anchor(SetToolTargetLayer) SetToolTargetLayer toolID layerID
- Sets the target layer of a tool.
Anchor(GetToolTargetLayer) GetToolTargetLayer toolID
- Gets the target layer of a tool. Returns a layerID.
Anchor(SetToolNewVoxelValue) SetToolNewVoxelValue toolID value
Sets the new voxel value of a tool. value is a float.
Anchor(GetToolNewVoxelValue) GetToolNewVoxelValue toolID
- Gets the new voxel value of a tool.
Anchor(SetToolEraseVoxelValue) SetToolEraseVoxelValue toolID value
- Sets the erase voxel value of a tool.
Anchor(GetToolEraseVoxelValue) GetToolEraseVoxelValue toolID
- Gets the erase voxel value of a tool.
Anchor(SetToolOnlyBrushZero) SetToolOnlyBrushZero toolID onlyZero
- Specify whether the brush should only affect zero values..
Anchor(GetToolOnlyBrushZero) GetToolOnlyBrushZero toolID
- Returns whether or not a brush is only affecting zero values.
Anchor(SetToolBrushRadius) SetToolBrushRadius toolID radius
Sets the current brush radius of a tool. radius should be a floating point number.
Anchor(GetToolBrushRadius) GetToolBrushRadius toolID
- Gets the current brush radius of a tool.
Anchor(SetToolBrushShape) SetToolBrushShape toolID shape
Sets the current brush shape of a tool. shape should be voxel, square or circle.
Anchor(GetToolBrushShape) GetToolBrushShape toolID
Returns the current brush shape of a tool as a string: voxel, square or circle.
Anchor(SetToolBrush3D) SetToolBrush3D toolID 3D
Sets the current brush 3D of a tool. 3D is either 1 or 0.
Anchor(GetToolBrush3D) GetToolBrush3D toolID
- Returns the current brush 3D of a tool.
Anchor(SetToolFloodStopAtPaths) SetToolFloodStopAtPaths toolID stop
Specify whether a tool flood should stop at paths. stop is either 1 or 0.
Anchor(GetToolFloodStopAtPaths) GetToolFloodStopAtPaths toolID
- Returns whether or not a tool flood will stop at paths.
Anchor(SetToolFloodStopAtROIs) SetToolFloodStopAtROIs toolID stop
Specify whether a tool flood should stop at ROIs. stop is either 1 or 0.
Anchor(GetToolFloodStopAtROIs) GetToolFloodStopAtROIs toolID
- Returns whether or not a tool flood will stop at ROIs.
Anchor(SetToolFloodFuzziness) SetToolFloodFuzziness toolID fuzziness
Specify a tool flood's fuzziness. fuzziness is a floating point number.
Anchor(GetToolFloodFuzziness) GetToolFloodFuzziness toolID
- Returns a tool flood's fuzziness.
Anchor(SetToolFloodMaxDistance) SetToolFloodMaxDistance toolID distance
Specify a tool flood's max distance. distance is a floating point number.
Anchor(GetToolFloodMaxDistance) GetToolFloodMaxDistance toolID
- Returns a tool flood's max distance.
Anchor(SetToolFlood3D) SetToolFlood3D toolID 3D
Sets the current flood 3D of a tool. 3D is either 1 or 0.
Anchor(GetToolFlood3D) GetToolFlood3D toolID
- Gets the current flood 3D of a tool.
Anchor(SetToolFloodSourceCollection) SetToolFloodSourceCollection toolID collectionID
- Sets the current flood source collection of a tool.
Anchor(SetToolFloodFuzzinessType) SetToolFloodFuzzinessType toolID type
Sets the tool's fuzziness type. type should be seed or gradient.
Anchor(GetToolFloodFuzzinessType) GetToolFloodFuzzinessType toolID
Returns the tool's fuzziness type: seed or gradient.
Anchor(GetToolFloodSourceCollection) GetToolFloodSourceCollection toolID
- Gets the current flood source collection of a tool.
Anchor(SetToolOnlyFloodZero) SetToolOnlyFloodZero toolID onlyZero
Specify whether the flood should only affect zero values. onlyZero is 1 or 0.
Anchor(GetToolOnlyFloodZero) GetToolOnlyFloodZero toolID
- Returns whether or not a flood is only affecting zero values.
Anchor(SetToolEdgePathStraightBias) SetToolEdgePathStraightBias toolID bias
Sets the bias for straight paths for the edge path tool. bias is a floating point number from 0 to 1.
Anchor(GetToolEdgePathStraightBias) GetToolEdgePathStraightBias toolID
- Returns the bias for straight paths for the edge path tool.
Anchor(SetToolEdgePathEdgeBias) SetToolEdgePathEdgeBias toolID bias
Sets the bias for edges for the edge path tool. bias is a floating point number from 0 to 1.
Anchor(GetToolEdgePathEdgeBias) GetToolEdgePathEdgeBias toolID
- Returns the bias for edges for the edge path tool.
Anchor(SetFrameViewConfiguration) SetFrameViewConfiguration frameID configuration
Sets a frame's view configuration. Supported configurations, where each number is the number of columns in a row: c1 c22 c44 c13.
Anchor(GetViewIDFromFrameColRow) GetViewIDFromFrameColRow frameID col row
Return the viewID from a view at a certain location. col and row must be valid integers for the current view configuration.
Anchor(GetSelectedViewID) GetSelectedViewID frameID
- Return the viewID of the selected view.
Anchor(SetSelectedViewID) SetSelectedViewID frameID viewID
- Sets the select view in a frame.
Anchor(GetNumberOfRowsInFrame) GetNumberOfRowsInFrame frameID
- Return the number of rows in a frame.
Anchor(GetNumberOfColsAtRowInFrame) GetNumberOfColsAtRowInFrame frameID row
Return the number of columns in arow. row is an integer.
Anchor(GetViewIDAtFrameLocation) GetViewIDAtFrameLocation frameID windowX windowY
Return the view ID at a window location. windowX and windowY should be integers.
Anchor(GetColumnOfViewInFrame) GetColumnOfViewInFrame frameID viewID
- Return the column of the view ID in a frame.
Anchor(GetRowOfViewInFrame) GetRowOfViewInFrame frameID viewID
- Return the row of the view ID in a frame.
Anchor(RedrawFrame) RedrawFrame frameID
- Tells a frame to redraw without waiting for the next update event. Should be used in scripts to force a redraw before taking a screenshot.
Anchor(CopyViewLayersToAllViewsInFrame) CopyViewLayersToAllViewsInFrame frameID viewID
- Copies the layer settings in a view to all other views in a frame.
Anchor(GetToolIDForFrame) GetToolIDForFrame frameID
- Returns the ID of the tool for this frame.
Anchor(CycleCurrentViewInFrame) CycleCurrentViewInFrame frameID
- Selects the next view in a frame.
Anchor(CaptureFrameToFile) CaptureFrameToFile frameID fileName
- Make a screen capture of the frame.
Anchor(SetTransformLabel) SetTransformLabel transformID label
Set the label for a transform. label should be a string.
Anchor(GetTransformLabel) GetTransformLabel transformID
- Returns the label for a transform.
Anchor(SetTransformValues) SetTransformValues transformID listOfValues
Sets the values of a transform. listOfValues should be a list of 16 values in column order.
Anchor(GetTransformValues) GetTransformValues transformID
- Returns a list of transform values in column order.
Anchor(LoadTransformFromLTAFile) LoadTransformFromLTAFile transformID LTAFileName
- Loads an LTA from a file into an existing transform.
Anchor(InvertTransform) InvertTransform transformID
- Inverts a transform.
Anchor(TreatTransformAsRegistration) TreatTransformAsRegistration transformID sourceVolumeID destVolumeID
Treats a transform as a tkregistration between two volumes, getting the necessary geometry information from them to register them.. sourceVolumeID and destVolumeID are collectionIDs.
Anchor(TreatTransformAsNative) TreatTransformAsNative transformID
- If a transform was set to be treated as a registration, this restores it to normal.
Anchor(IsTransformRegistration) IsTransformRegistration transformID
- Returns whether or not a transform is being treated as a registration.
Anchor(GetTransformRegistrationSource) GetTransformRegistrationSource transformID
- Returns the id of the source volume if the transform is being treated as a registration.
Anchor(GetTransformRegistrationDest) GetTransformRegistrationDest transformID
- Returns the id of the dest volume if the transform is being treated as a registration.
Anchor(SetViewInPlane) SetViewInPlane viewID inPlane
Sets the in plane in a view. inPlane should be one of the following: x y z
Anchor(GetViewInPlane) GetViewInPlane viewID
- Returns the in plane in a view.
Anchor(SetViewZoomLevel) SetViewZoomLevel viewID zoomLevel
Sets the zoom level in a view. zoomLevel should be a floating point number. 1 is normal zoom, 0-1 is zoomed out, and 1+ is zoomed in.
Anchor(GetViewZoomLevel) GetViewZoomLevel viewID
- Returns the zoom level in a view.
Anchor(SetViewRASCenter) SetViewRASCenter viewID x y z
Sets the view center. x, y, and z should be floating point numbers in world RAS coordinates.
Anchor(GetViewRASCenter) GetViewRASCenter viewID
- Returns the view center as a list of x, y, and z RAS coordinates.
Anchor(SetLayerInViewAtLevel) SetLayerInViewAtLevel viewID layerID level
Sets the layer in a view at a given draw level. Higher draw levels will draw later. level should be an integer from 0 - 9.
Anchor(GetLayerInViewAtLevel) GetLayerInViewAtLevel viewID level
Returns the layer in a view at a given draw level. level should be an integer from 0 - 9.
Anchor(RemoveAllLayersFromView) RemoveAllLayersFromView viewID
- Remove all layers from a view.
Anchor(RemoveLayerFromViewAtLevel) RemoveLayerFromViewAtLevel viewID level
Remove a layer from a view. level should be an integer from 0 - 9.
Anchor(SetLevelVisibilityInView) SetLevelVisibilityInView viewID level visibility
Sets the visibility for a level in a view. level should be an integer from 0 - 9. visibility should be 1 or 0.
Anchor(GetLevelVisibilityInView) GetLevelVisibilityInView viewID level
Returns the visibility for a level in a view. level should be an integer from 0 - 9.
Anchor(SetLevelReportInfoInView) SetLevelReportInfoInView viewID level reportInfo
Sets the flag for reporting info for a level in a view. level should be an integer from 0 - 9. reportInfo should be 1 or 0.
Anchor(GetLevelReportInfoInView) GetLevelReportInfoInView viewID level
Returns whether a level in a view is reporting info. level should be an integer from 0 - 9.
Anchor(SetViewStateToLayerBounds) SetViewStateToLayerBounds viewID layerID
- Sets the view so that the layer's data completely fills the view.
Anchor(GetFirstUnusedDrawLevelInView) GetFirstUnusedDrawLevelInView viewID
- Returns the first unused draw level.
Anchor(SetViewLinkedStatus) SetViewLinkedStatus viewID linked
- Set the linked status for a view.
Anchor(GetViewLinkedStatus) GetViewLinkedStatus viewID
- Returns the linked status for a view.
Anchor(SetViewLockOnCursor) SetViewLockOnCursor viewID lock
Set a view to keep its view locked on the cursor. lock should be 1 or 0.
Anchor(GetViewLockOnCursor) GetViewLockOnCursor viewID
- Returns whether or not a view is locked on the cursor.
Anchor(SetViewTransform) SetViewTransform viewID transformID
- Set the view to world transform for a view.
Anchor(GetViewTransform) GetViewTransform viewID
- Returns the transformID of a view's view to world transform.
Anchor(SetViewFlipLeftRightYZ) SetViewFlipLeftRightYZ viewID flip
Set the left-right flip flag for a view. flip should be 1 or 0.
Anchor(GetViewFlipLeftRightYZ) GetViewFlipLeftRightYZ viewID
- Returns the left-right flip flag for a view.
Anchor(SetViewThroughPlaneIncrement) SetViewThroughPlaneIncrement viewID throughPlane increment
Set the amount that using the through plane movement keys will increment or decrement the through plane RAS value. throughPlane should be x, y, or z. increments should be a floating point number.
Anchor(GetViewThroughPlaneIncrement) GetViewThroughPlaneIncrement viewID throughPlane
Returns the through plane movement increment for throughPlane. throughPlane should be x, y, or z.
Anchor(GetVolumeHistogramInView) GetVolumeHistogramInView viewID volID roiID numBins
Returns a histogram of the volume that's visible in a view. Returns the format: {minBinValue binIncrement {binCount0 binCount1 .. binCountN}} where binCountN is numBins-1. volID is a collectionID. numBins is an integer.
Anchor(BeginValueRangeFillInView) BeginValueRangeFillInView viewID sourceVolID roiID destVolID
Begins a series of value range fills using the value ranges in sourceVolID to set values in destVolID. sourceVolID and destVolID are collectionIDs.
Anchor(DoOneValueRangeFillInView) DoOneValueRangeFillInView viewID beginValueRange endValueRange fillValue
Adds a single range to a series of value range fills. Must be between a call to BeginValueRangeFillInView and EndValueRangeFillInView. beginValueRange, endValueRange, and fillValueRange should be values appropriate for the volume you are editing.
Anchor(EndValueRangeFillInView) EndValueRangeFillInView viewID
Performs the series of value range fills specified by DoOneValueRangeFill.
Anchor(ConvertWindowToViewRAS) ConvertWindowToViewRAS viewID windowX windowY
Returns the RAS coordinates of the input window coordinate. windowX and windowY should be integers.
Anchor(SetColorLUTLabel) SetColorLUTLabel lutID label
Set the label for a color LUT. labe should be a string.
Anchor(GetColorLUTLabel) GetColorLUTLabel lutID
- Returns the label for a color LUT.
Anchor(SetColorLUTFileName) SetColorLUTFileName lutID fileName
- Set the LUT file name for a colorLUT.
Anchor(GetColorLUTFileName) GetColorLUTFileName lutID
- Returns the LUT file name for a transform.
Anchor(GetColorLUTNumberOfEntries) GetColorLUTNumberOfEntries lutID
- Returns the number of entries in an LUT.
Anchor(GetColorLUTEntryLabel) GetColorLUTEntryLabel lutID entry
Returns the label for an entry in an LUT. entry should be an integer index into the LUT.
Anchor(GetColorLUTEntryRGB) GetColorLUTEntryRGB lutID entry
Returns the rgb values (0-255) for an entry in an LUT. entry should be an integer index into the LUT.
Anchor(IsColorLUTEntryValid) IsColorLUTEntryValid lutID entry
Returns whether or not an entry is valid. Can be invalid if it's out of range or was missing from the LUT. entry should be an integer index into the LUT.
Anchor(GetSubjectName) GetSubjectName
- Returns the subject name if one was set.
Anchor(GetSubjectDir) GetSubjectDir
- Returns the path to the subject's data if the subject name was set.
Anchor(NewVolume) NewVolume templateID createLayer frameIDToAdd
Creates a new volume based on an existing one. templateID is a collectionID for the volume to use as a template. createLayer should be 1 or 0 and specifies whether an appropriate layer will be created, and if so, frameIDToAdd should specify which frame to add the layer to in all views. createLayer should probably be 1 and frameIDToAdd should be a call to GetMainFrameID.
Anchor(LoadVolume) LoadVolume fileName createLayer frameIDToAdd
Loads a volume from fileName. createLayer should be 1 or 0 and specifies whether an appropriate layer will be created, and if so, frameIDToAdd should specify which frame to add the layer to in all views. createLayer should probably be 1 and frameIDToAdd should be a call to GetMainFrameID.
Anchor(LoadSurface) LoadSurface fileName createLayer frameIDToAdd
Loads a surface from fileName. createLayer should be 1 or 0 and specifies whether an appropriate layer will be created, and if so, frameIDToAdd should specify which frame to add the layer to in all views. createLayer should probably be 1 and frameIDToAdd should be a call to GetMainFrameID.
Anchor(LoadTransform) LoadTransform fileName
- Loads a transform.
Anchor(SaveSceneScript) SaveSceneScript fileName
- Makes a script that can be used to reproduce the current view configuration.
Anchor(GetMainFrameID) GetMainFrameID
- Returns the ID number of the main frame. This should be used whenever a frame ID is required.
Anchor(UpdateFrame) UpdateFrame frameID
- Forces a redraw of the given frame.
Anchor(SetCursorFromSurfaceVertexIndex) SetCursorFromSurfaceVertexIndex layerID vertexNumber
Sets the cursor to a vertex in a surface. The layer should be one displaying a surface, and vertexNumber should be a valid vertx index in the layer's surface.
Anchor(SetCursorFromEditDatFile) SetCursorFromEditDatFile
- Reads a cursor from a subject's edit.dat file if it exists and the subject name has been set.
Anchor(WriteCursorToEditDatFile) WriteCursorToEditDatFile
- Writes the cursor location to a subject's edit.dat file if it exists and the subject name has been set.
Anchor(SetCursorFromVolumeIndexCoords) SetCursorFromVolumeIndexCoords collectionID x y z
Converts the given MRI index coordinate to RAS and sets the cursor from that, converting in the volume referenced by collectionID. x, y, and z should be integers.