Description This function creates an empty 2D grid and adds it as a slice to the specified ARN.
Syntax idx = ARNCreateSlice2DGrid( arn, adim, amin, amax, bdim, bmin, bmax, dtype, isActive )
Parameters idx (Long) Returned value indicating the index of the newly added slice in the ARN.
adim As Long Number of pixels along the A axis of the grid.
amin As Double Minimum physical extent of the grid in the A axis.
amax As Double Maximum physical extent of the grid in the A axis.
bdim As Long Number of pixels along the B axis of the grid.
bmin As Double Minimum physical extent of the grid in the B axis.
bmax As Double Maximum physical extent of the grid in the B axis.
dtype As String String specifier for the data type being represented in the grid. Allowed strings are "Double", "Complex", "Vector", "Complex3D", and "Int".
isActive As Boolean Indicates whether the newly added slice should become the active slice (True) or not (False).
Example The example below forms an empty 2D grid slice using the slice at index 0 as a template for the grid dimensions and size. Then, the empty data grid is populated with an array of random values.
Sub Main
Dim msarn As Long msarn = ARNFindName( "Irradiance Results - 5 iterations" ) ARNSetActiveSlice( msarn, 0 )
'Copy grid specifications from current active slice Dim dtype As String Dim adim As Long, amin As Double, amax As Double Dim bdim As Long, bmin As Double, bmax As Double adim = ARNGetAAxisDim( msarn ) bdim = ARNGetBAxisDim( msarn ) ARNGetAAxisRange( msarn, amin, amax ) ARNGetBAxisRange( msarn, bmin, bmax ) dtype = ARNGetDataType( msarn )
'Add the empty slice to the multi-slice ARN and make it active Dim idx As Long idx = ARNCreateSlice2DGrid( msarn, adim, amin, amax, bdim, bmin, bmax, dtype, True )
'Set other header items of interest ARNSetTitle( msarn, "Random Data" ) ARNSetDataUnits( msarn, "Noise" ) ARNSetAAxisParams( msarn, "X Axis", "mm", "Spatial" ) ARNSetBAxisParams( msarn, "X Axis", "mm", "Spatial" )
'Create a grid of random values and apply to the slice Dim data() As Double, curA As Long, curB As Long ReDim data(adim-1, bdim-1) For curA = 0 To adim-1 For curB = 0 To bdim-1 data(curA,curB) = Rnd() Next Next ARNSetDataAsDoubleArray( msarn, data() )
End Sub
See Also
|