Description This subroutine takes an array of ARNs and writes them out to a single video file with a user-specified resolution, color palette and data range. The supported video formats are MP4 and WMV.
Syntax ARNSaveToVideo( arns(), height, width, rangeMin, rangeMax, frameTime, palette, outputFile )
Parameters arns() As Long Input array of analysis result nodes (ARNs) whose data will be written to the output video file. The ARNs (and slices of any multi-slice ARNs in the list) must have the same data grid resolution in order for the video file to be successfully created.
height As Long Output video height in pixels. If height = width = 0, the output video will be "Auto" scaled. Regardless of the video height specification (user supplied, or Auto), the minimum height will be determined by the maximum of 200 pixels, twice the ARN pixel count, or the user-specified value. The resulting value is then rounded to the next highest even number to form the final video height.
width As Long Output video width in pixels. If height = width = 0, the output video will be "Auto" scaled. Regardless of the video width specification (user supplied, or Auto), the minimum width will be determined by the maximum of 200 pixels, twice the ARN pixel count, or the user-specified value. The resulting value is then rounded to the next highest even number to form the final video width.
rangeMin As Double Specifies a minimum data value below which the pixel color will be assigned the color at the low end of the color palette. If rangeMin = rangeMax = 0, the color scaling is "Auto".
rangeMax As Double Specifies a maximum data value above which the pixel color will be assigned the color at the high end of the color palette. If rangeMin = rangeMax = 0, the color scaling is "Auto".
frameTime As Double Specifies the length of time, in seconds, that each frame will be displayed in the video file.
palette As String Designates a color palette for the output image files. Options are:
outputFile As String Full output video file path including either the MP4 or WMV file extension.
Example The example below performs a raytrace and analysis inside of a loop to generate a number of Analysis Results Nodes. These ARNs are then Log10 scaled 6 orders of magnitude and combined together into a single multi-slice ARN. The resulting multi-slice ARN is then saved to an output FRED Grid Data file (FGD file) and also saved to an output video file in the MP4 file format. Each ARN data grid has resolution 101x81 pixels and the output video file will have final resolution 1000x810 pixels, use auto color-ranging, and have a 1.5 second delay per video frame.
Sub Main
ARNDeleteAllNodes()
Dim src As Long, ana As Long src = FindFullName( "Optical Sources.Plane Wave Source - SP" ) ana = FindFullName( "Analysis Surface(s).Focal Plane" )
'Source scan and analysis Dim curAng As Double, curArn As Long Dim parmString As String For curAng = 0 To 25 Step 5
'Set the Plane Wave type source primitive direction parmString = "0," & CStr(curAng) & ",SD" SourcePrimSetParmValue( src, 5, parmString )
'Raytrace and analyze DeleteRays() CreateSource( src ) TraceExisting() IrradianceToARN( ana, "Irradiance " & CStr(curAng), curArn )
Next
'Retrieve list of ARNs, Log10 the data and then compile them into a single multi-slice ARN Dim arnList() As Long, msArn(0) As Long ReDim arnList(ARNGetMaxNodeNum()) For curArn = 0 To ARNGetMaxNodeNum() ARNLog10WithRelativeFloor( curArn, 6, True, False ) arnList(curArn) = curArn Next msArn(0) = ARNCombineIntoMultislice( arnList(), "Source Scan Results" )
'Write the multi-slice ARN to an FGD file. ARNWriteToFile( msArn(0), GetDocDir() & "\SourceScan.fgd", False, False )
'Write multi-slice ARN out to a video file. ARNSaveToVideo( msArn(), 999, 809, 0, 0, 1.5, "Spectrum2", GetDocDir() & "\SourceScan.mp4" )
End Sub
See Also
|
|||||||||||||||||||||||||||||||||||||||||||