Automation Example - ObliqueImage

 

This is an example for ObliqueSlice.

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

' ObliqueImageModule.bas

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

' It then changes all the properties of the obliqueimage.

'

'                                    -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 an image file

  CommandApi.Construct ("Import")

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

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

  CommandApi.Do()

 

 'Create a oblique image and attach it to the data

  CommandApi.Construct ("CreateModule")

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

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

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

  CommandApi.Do()

 

 'Change the obliqueslice component

  CommandApi.Construct("ModifyModule")

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

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

  CommandApi.Do()

 

 'Change the obliqueslice resolution

 '0, 1, 2, 3 for coarse, medium, fine, or very fine

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

  CommandApi.Do()

 

 'Turn on/off the obliqueslice interpolation

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

  CommandApi.Do()

 

 'Turn on/off the obliqueslice lighting

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

  CommandApi.Do()

 

 'Change the obliqueslice opacity

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

  CommandApi.Do()

 

 'Change the obliqueslice mapping value

 'Changes the Mapping Method

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

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

  CommandApi.Do()

 

 'Change the obliqueslice map width

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

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

  CommandApi.Do()

 

 'Change the obliqueslice map center

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

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

  CommandApi.Do()

 

 'Change the obliqueslice color map

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

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

  CommandApi.Do()

 

 'Display the ObliqueSlice legend

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

  CommandApi.Do()

 

 'Change the legend orientation

 '0 is for horizontal, 1 is for vertical

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

  CommandApi.Do()

 

 'Change the legend X position

 'Ranges from 0-1

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

  CommandApi.Do()

 

 'Change the legend Y position

 'Ranges from 0-1

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

  CommandApi.Do()

 

 'Change the legend width

 'Ranges from 0-200

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

  CommandApi.Do()

 

 'Change the legend length

 'Ranges from 0-1024

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

  CommandApi.Do()

 

 'Change the legend title

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

  CommandApi.Do()

 

 'Change the legend title font size

 'Ranges from 4-72

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

  CommandApi.Do()

 

 'Change the number of labels displayed in a legend

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

  CommandApi.Do()

 

 'Change the legend to use custom labels

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

  CommandApi.Do()

 

 'Set the custom labels for the legend

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

  CommandApi.Do()

 

 'Set the height for the legend labels

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

  CommandApi.Do()

 

 'Set the label format type for the legend

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

  CommandApi.Do()

 

 'Set the number of digits to display on the labels

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

  CommandApi.Do()

 

 'Set the legend label prefix

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

  CommandApi.Do()

 

 'Set the legend label postfix

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

  CommandApi.Do()

 

 'Set the legend font

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

  CommandApi.Do()

 

 'Turn on or off antialiasing for the legend

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

  CommandApi.Do()

 

 'Set the line and text color for the legend

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

  CommandApi.Do()

 

 'Set the background color for the legend

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

  CommandApi.Do()

 

 'Turn on or off the display of the legend background

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

  CommandApi.Do()

 

 'Change the cutting plane orientation

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

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

  CommandApi.Do()

 

 'Change the X Normal Direction For the cutting plane

 'Only available if ObliqueSlicePlaneOrientation is set to 3

  CommandApi.Option ("ObliqueSlicePlaneXNormal", "30")

  CommandApi.Do()

 

 'Change the Y Normal Direction For the cutting plane

 'Only available if ObliqueSlicePlaneOrientation is set to 3

  CommandApi.Option ("ObliqueSlicePlaneYNormal", "30")

  CommandApi.Do()

 

 'Change the Z Normal Direction For the cutting plane

 'Only available if ObliqueSlicePlaneOrientation is set to 3

  CommandApi.Option ("ObliqueSlicePlaneZNormal", "60")

  CommandApi.Do()

 

 'Change the offset of the cutting plane from the center of the lattice

  CommandApi.Option ("ObliqueSlicePlaneOffset", "-7.5")

  CommandApi.Do()

 

 'Display the cutting plane dragger

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

  CommandApi.Do()

 

End Sub

 

 

See Also

Automation Model

ObliqueSlice