This is an example for LatticeFilter.
'********************************************************************************************
' lattice filter.BAS
' This script creates a test lattice.
' It adds a filter and changes the properties of the filter.
'
' -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
'********************************************************************************************
' FilterModule.bas
' This script creates a function lattice.
' It adds a filter and changes the properties of the filter.
'
' -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()
'Create a function lattice
CommandApi.Construct ("CreateModule")
CommandApi.Option("Type", "FunctionLattice")
CommandApi.Option ("AutoConnect", "False")
CommandApi.Do()
'Change the equations for the function lattice
CommandApi.Construct ("ModifyModule")
CommandApi.Option ("Module", "FunctionLattice")
CommandApi.Option ("FunctionLatticeOutComps", "20")
CommandApi.Do()
CommandApi.Option ("FunctionLatticeExprComp1", "(x-.5)*(x-.5) + (y-.5)*(y-.5) + (z-.5)*(z-.5)")
CommandApi.Do()
CommandApi.Option ("FunctionLatticeExprComp2", "(x-.5) + (y-.5)*(y-.5) + (z-.5)*(z-.5)")
CommandApi.Do()
CommandApi.Option ("FunctionLatticeExprComp3", "(x-.5) + (y-.5) + (z-.5)*(z-.5)")
CommandApi.Do()
CommandApi.Option ("FunctionLatticeExprComp4", "(x-.5) + (y-.5) + (z-.5)")
CommandApi.Do()
CommandApi.Option ("FunctionLatticeExprComp5", "(x+.5)*(x+.5) + (y+.5)*(y+.5) + (z+.5)*(z+.5)")
CommandApi.Do()
CommandApi.Option ("FunctionLatticeExprComp6", "(x+.5) + (y+.5)*(y+.5) + (z+.5)*(z+.5)")
CommandApi.Do()
CommandApi.Option ("FunctionLatticeExprComp7", "(x+.5) + (y+.5) + (z+.5)")
CommandApi.Do()
CommandApi.Option ("FunctionLatticeExprComp8", "(x+.5)*(x-.5) + (y+.5)*(y-.5) + (z+.5)*(z-.5)")
CommandApi.Do()
CommandApi.Option ("FunctionLatticeExprComp9", "x*(x+.5)*(x-.5) + (y+.5)*(y-.5) + (z+.5)*(z-.5)")
CommandApi.Do()
CommandApi.Option ("FunctionLatticeExprComp10", "x*(x-.5)*(x-.5) + y*(y-.5)*(y-.5) + (z-.5)*(z-.5)")
CommandApi.Do()
CommandApi.Option ("FunctionLatticeExprComp11", "x*(x-.5)*(x-.5) + y*(y-.5)*(y-.5) + z*(z-.5)*(z-.5)")
CommandApi.Do()
CommandApi.Option ("FunctionLatticeExprComp12", "y*(x-.5)*(x-.5) + (y-.5)*(y-.5) + (z-.5)*(z-.5)")
CommandApi.Do()
CommandApi.Option ("FunctionLatticeExprComp13", "(x-.5)*(x-.5) + x*(y-.5)*(y-.5) + (z-.5)*(z-.5)")
CommandApi.Do()
CommandApi.Option ("FunctionLatticeExprComp14", "(x-.5)*(x-.5) + (y-.5)*(y-.5) + x*y*(z-.5)*(z-.5)")
CommandApi.Do()
CommandApi.Option ("FunctionLatticeExprComp15", "(x + y + z)")
CommandApi.Do()
CommandApi.Option ("FunctionLatticeExprComp16", "(x*x) + (y*y) + (z*z)")
CommandApi.Do()
CommandApi.Option ("FunctionLatticeExprComp17", "(x*2) + (2*y) + (2*z)")
CommandApi.Do()
CommandApi.Option ("FunctionLatticeExprComp18", "(x*2) + (2*y) + (2*z)")
CommandApi.Do()
CommandApi.Option ("FunctionLatticeExprComp19", "(x-2) + (2-y) + (2-z)")
CommandApi.Do()
CommandApi.Option ("FunctionLatticeExprComp20", "(x+2) + (2*y) + (2+z)")
CommandApi.Do()
'Add a filter to the test lattice
CommandApi.Construct ("CreateModule")
CommandApi.Option ("Type", "Filter")
CommandApi.Option ("AutoConnect", "True")
CommandApi.Option ("SourceModule", "FunctionLattice")
CommandApi.Do()
'Set the type of filter to apply to the lattice
'Value is 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28
'for 0=Average (Rectangular), 1=Average (Spherical), 2=Bounding, 3=Brightness & Contrast, 4=Central Moment,
'5=Coeffiecient of Variation, 6=Distance, 7=Distance (inverse), 8=Distance 'Inf Norm', 9=Gamma Correction, 10=Gauss,
'11=Histogram Equalization, 12=Interquartile Range, 13=Laplacian Edge Detect, 14=Maximum (dilation), 15=Mean Removal,
'16=Median, 17=Median Difference, 18=Minimum (erosion), 19=Prewitt, 20=Quartile (lower), 21=Quartile (upper), 22=Range,
'23=Rank, 24=Sobel Max, 25=Sobel Norm, 26=Standard Deviation, 27=Threshold Averaging, 28=Threshold Crossing,
'29=Unsharp Mask, 30=Zero Crossing
CommandApi.Construct ("ModifyModule")
CommandApi.Option ("Module", "Filter")
CommandApi.Option ("LatticeFilterFilter", "29")
CommandApi.Do()
'Set the orientation of filter to apply to the lattice
'Value is 0, 1, 2, 3
'for XY Planes, XZ Planes, YZ Planes, 3D
CommandApi.Option ("LatticeFilterOrientation", "2")
CommandApi.Do()
'Set the edge handling for the filter to apply to the lattice
'Value is 0, 1, 2, 3, 4, 5
'for Blank, Ignore, Replicate, Mirror, Cyclic Wrap, Fill
CommandApi.Option ("LatticeFilterEdge", "5")
CommandApi.Do()
'Set the edge fill value for the filter to apply to the lattice
'Only available when LatticeFilterEdge is set to 5
CommandApi.Option ("LatticeFilterEdgeValue", "0.5")
CommandApi.Do()
'Set the blank handling for the filter to apply to the lattice
'Value is 0, 1, 2, 3
'for Expanded, Leave Alone, Ignore, Fill
CommandApi.Option ("LatticeFilterBlank", "3")
CommandApi.Do()
'Set the blank fill value for the filter to apply to the lattice
'Only available when LatticeFilterBlank is set to 3
CommandApi.Option ("LatticeFilterBlankValue", "7")
CommandApi.Do()
'Set the kernal size of the filter to apply to the lattice
'Only available when LatticeFilterType is 0, 1, 4, 5, 6, 7, 8, 10, 12, 13,
'14, 15, 16, 17, 18, 20, 21, 22, 23, 26, 27, 28, 29, 30
CommandApi.Option ("LatticeFilterKernelSize", "5")
CommandApi.Do()
'Set the first filter parameters
'This is only available for LatticeFilterType = 2, 3, 4, 9, 10, 27, 28, 29
'For LatticeFilterType = 2, this is Lower Bound
'For LatticeFilterType = 3, this is Brightness
'For LatticeFilterType = 4, this is Power
'For LatticeFilterType = 9, this is Gamma
'For LatticeFilterType = 10, this is Alpha
'For LatticeFilterType = 27, this is Threshold
'For LatticeFilterType = 28, this is Threshold
'For LatticeFilterType = 29, this is Alpha
CommandApi.Option ("LatticeFilterParam0", "1.5")
CommandApi.Do()
'Set the second filter parameters
'This is only available for LatticeFilterType = 2, 3, 29
'For LatticeFilterType = 2, this is Upper Bound
'For LatticeFilterType = 3, this is Contrast
'For LatticeFilterType = 29, this is c
CommandApi.Option ("LatticeFilterParam1", "0.513")
CommandApi.Do()
'Turn on/off the filter for component 1
CommandApi.Option ("LatticeFilterComp1", "True")
CommandApi.Do()
'Turn on/off the filter for component 2
CommandApi.Option ("LatticeFilterComp2", "True")
CommandApi.Do()
'Turn on/off the filter for component 3
CommandApi.Option ("LatticeFilterComp3", "True")
CommandApi.Do()
'Turn on/off the filter for component 4
CommandApi.Option ("LatticeFilterComp4", "True")
CommandApi.Do()
'Turn on/off the filter for component 5
CommandApi.Option ("LatticeFilterComp5", "True")
CommandApi.Do()
'Turn on/off the filter for component 6
CommandApi.Option ("LatticeFilterComp6", "True")
CommandApi.Do()
'Turn on/off the filter for component 7
CommandApi.Option ("LatticeFilterComp7", "True")
CommandApi.Do()
'Turn on/off the filter for component 8
CommandApi.Option ("LatticeFilterComp8", "True")
CommandApi.Do()
'Turn on/off the filter for component 9
CommandApi.Option ("LatticeFilterComp9", "True")
CommandApi.Do()
'Turn on/off the filter for component 10
CommandApi.Option ("LatticeFilterComp10", "True")
CommandApi.Do()
'Turn on/off the filter for component 11
CommandApi.Option ("LatticeFilterComp11", "True")
CommandApi.Do()
'Turn on/off the filter for component 12
CommandApi.Option ("LatticeFilterComp12", "True")
CommandApi.Do()
'Turn on/off the filter for component 13
CommandApi.Option ("LatticeFilterComp13", "True")
CommandApi.Do()
'Turn on/off the filter for component 14
CommandApi.Option ("LatticeFilterComp14", "True")
CommandApi.Do()
'Turn on/off the filter for component 15
CommandApi.Option ("LatticeFilterComp15", "True")
CommandApi.Do()
'Turn on/off the filter for component 16
CommandApi.Option ("LatticeFilterComp16", "True")
CommandApi.Do()
'Turn on/off the filter for component 17
CommandApi.Option ("LatticeFilterComp17", "True")
CommandApi.Do()
'Turn on/off the filter for component 18
CommandApi.Option ("LatticeFilterComp18", "True")
CommandApi.Do()
'Turn on/off the filter for component 19
CommandApi.Option ("LatticeFilterComp19", "True")
CommandApi.Do()
'Turn on/off the filter for component 20
CommandApi.Option ("LatticeFilterComp20", "True")
CommandApi.Do()
End Sub
See Also