Automation Example - OrthoImage

 

This is an example for Orthoslice.

'********************************************************************************************

' OrthoImage module.BAS

' This script loads a file and adds a OrthoImage module.

' It then changes all the properties of the OrthoImage.

'

'                                    -by SKP 4/2010

'

'********************************************************************************************

Sub Main

 'Declares VoxlerApp as an object

  Dim VoxlerApp As Object

 

 'Creates an instance of the Voxler application object

 'and assigns it to the variable named "VoxlerApp"

  Set VoxlerApp = CreateObject("Voxler.Application")

 

 'Make Voxler visible

  VoxlerApp.Visible = True

 

 'Access CommandApi

  Set CommandApi = VoxlerApp.CommandApi

 

'********************************************************************************************

' OrthoImageModule.bas

' This script loads a file and adds a OrthoImage module.

' It then changes all the properties of the OrthoImage.

'

'                                    -by SKP 4/2010

'

'********************************************************************************************

Sub Main

 

 'Declares VoxlerApp as an object

  Dim VoxlerApp As Object

 

 'Creates an instance of the Voxler application object

 'and assigns it to the variable named "VoxlerApp"

  Set VoxlerApp = CreateObject("Voxler.Application")

 

 'Make Voxler visible

  VoxlerApp.Visible = True

 

 'Access CommandApi

  Set CommandApi = VoxlerApp.CommandApi

 

 'Create a new Voxler document

  CommandApi.Construct ("New")

  CommandApi.DoOnce()

 

 'Import a file

  CommandApi.Construct ("Import")

  CommandApi.Option ("Path", VoxlerApp.Path+"\Samples\Jaw.vdat")

  CommandApi.Option ("Filter", "vdat")

  CommandApi.Do()

 

 'Create a OrthoImage and attach it to the data

  CommandApi.Construct ("CreateModule")

  CommandApi.Option ("Type", "OrthoImage")

  CommandApi.Option ("AutoConnect", "True")

  CommandApi.Option ("SourceModule", "Jaw.vdat")

  CommandApi.Do()

 

 'Change the OrthoImage component

  CommandApi.Construct("ModifyModule")

  CommandApi.Option("Module","OrthoImage")

  CommandApi.Option("OrthoSliceComponent", "1")

  CommandApi.Do()

 

 'Change the OrthoImage orientation

 '0, 1, 2 for XY Plane (Axial), XZ Plane (Coronal), or YZ Plane (Sagittal)

  CommandApi.Option("OrthoSliceOrientation", "2")

  CommandApi.Do()

 

 'Change the slice number being shown

  CommandApi.Option("OrthoSliceSlice", "32")

  CommandApi.Do()

 

 'Turn on/off the orthoslice lighting

  CommandApi.Option("OrthoSliceLighting", "True")

  CommandApi.Do()

 

 'Adjust the orthoslice quality

 'Value between 0 and 1

  CommandApi.Option("OrthoSliceQuality", "0.7")

  CommandApi.Do()

 

 'Change the orthoslice opacity

  CommandApi.Option("OrthoSliceOpacity", "0.4")

  CommandApi.Do()

 

 'Change the OrthoSlice mapping value

 'Changes the Mapping Method

 'Values are 0 or 1, 0=Linear, 1=Colormap

  CommandApi.Option("OrthoSliceMapping", "0")

  CommandApi.Do()

 

 'Change the orthoslice map width

 'Only available when the OrthoSliceMapping method is 0 (Linear)

  CommandApi.Option("OrthoSliceMapwidth", "12")

  CommandApi.Do()

 

 'Change the orthoslice map center

 'Only available when the OrthoSliceMapping method is 0 (Linear)

  CommandApi.Option("OrthoSliceMapcenter", "12")

  CommandApi.Do()

 

  Wait(2)

 

 'Change the OrthoSlice mapping value

 'Changes the Mapping Method

 'Values are 0 or 1, 0=Linear, 1=Colormap

  CommandApi.Option("OrthoSliceMapping", "1")

  CommandApi.Do()

 

 'Change the orthoslice color map

 'Only available when the OrthoSliceMapping method is 1 (Colormap)

  CommandApi.Option("OrthoSliceColormap", "Rainbow")

  CommandApi.Do()

 

 'Display the OrthoSlice legend

  CommandApi.Option ("OrthoSliceLegendEnable", "True")

  CommandApi.Do()

 

 'Change the legend orientation

 '0 is for horizontal, 1 is for vertical

  CommandApi.Option ("OrthoSliceLegendOrientation", "0")

  CommandApi.Do()

 

 'Change the legend X position

 'Ranges from 0-1

  CommandApi.Option ("OrthoSliceLegendXPos", "0.3")

  CommandApi.Do()

 

 'Change the legend Y position

 'Ranges from 0-1

  CommandApi.Option ("OrthoSliceLegendYPos", "0.9")

  CommandApi.Do()

 

 'Change the legend width

 'Ranges from 0-200

  CommandApi.Option ("OrthoSliceLegendWidth", "20")

  CommandApi.Do()

 

 'Change the legend length

 'Ranges from 0-1024

  CommandApi.Option ("OrthoSliceLegendLength", "400")

  CommandApi.Do()

 

 'Change the legend title

  CommandApi.Option ("OrthoSliceLegendTitle", "Legend Title")

  CommandApi.Do()

 

 'Change the legend title font size

 'Ranges from 4-72

  CommandApi.Option ("OrthoSliceLegendTitleHeight", "20")

  CommandApi.Do()

 

 'Change the number of labels displayed in a legend

  CommandApi.Option ("OrthoSliceLegendNumLabels", "3")

  CommandApi.Do()

 

 'Change the legend to use custom labels

  CommandApi.Option ("OrthoSliceLegendUseCustomLabels", "True")

  CommandApi.Do()

 

 'Set the custom labels for the legend

  CommandApi.Option ("OrthoSliceLegendCustomLabels", "1.7:low, 49:medium, 100:intermediate, 180:elevated, 220:high")

  CommandApi.Do()

 

 'Set the height for the legend labels

  CommandApi.Option ("OrthoSliceLegendLabelHeight", "8")

  CommandApi.Do()

 

 'Set the label format type for the legend

  CommandApi.Option ("OrthoSliceLabelFormatType", "0")

  CommandApi.Do()

 

 'Set the number of digits to display on the labels

  CommandApi.Option ("OrthoSliceLabelFormatNumDigits", "2")

  CommandApi.Do()

 

 'Set the legend label prefix

  CommandApi.Option ("OrthoSliceLabelFormatPrefix", "pre-")

  CommandApi.Do()

 

 'Set the legend label postfix

  CommandApi.Option ("OrthoSliceLabelFormatPostfix", "-post")

  CommandApi.Do()

 

 'Set the legend font

  CommandApi.Option ("OrthoSliceLegendFont", "Arial")

  CommandApi.Do()

 

 'Turn on or off antialiasing for the legend

  CommandApi.Option ("OrthoSliceLegendAntialias", "True")

  CommandApi.Do()

 

 'Set the line and text color for the legend

  CommandApi.Option ("OrthoSliceLegendFGColor", "Blue")

  CommandApi.Do()

 

 'Set the background color for the legend

  CommandApi.Option ("OrthoSliceLegendBGColor", "10% Gray")

  CommandApi.Do()

 

 'Turn on or off the display of the legend background

  CommandApi.Option ("OrthoSliceLegendShowBackground", "True")

  CommandApi.Do()

 

End Sub

 

 

See Also

Automation Model

Orthoslice