Navigation: Scripting Reference Manual > Functions & Subroutines > ColorImage

 

ColorImage

 

Contact Us: fredsupport@photonengr.com

 

Description

This function performs a color image calculation using rays which exist on a specific surface and stores the resulting tristimulus values in individual arrays.  The third argument of the command is a T_ANALYSIS structure, which defines a sampling grid (pixels, orientation and location) over which the color image is computed but does not define any ray selection filter operations.  Depending on the number of rays traced, it may be necessary to dimension ray index and ray counter variables as data type Huge_ instead of Long.  Please see Multi-threaded Raytracing for more information.

 

Syntax

count = ColorImage( n, nCoordSys, ana, X(), Y(), Z() )

 

Parameters

count (Long or Huge_)

Returned number of rays that were included in the calculation.

 

n As Long

Node number of the surface to be used as the ray selection filter.  Only rays which exist on this surface at the time of the ColorImage call will be included in the calculation.

 

nCoordSys As Long

Node number of the entity whose coordinate system the ana structure is expressed in.  If the ana structure was initialized using the LoadAnalysis command, the value of nCoordSys should be set to -1.

 

ana As T_ANALYSIS

Structure defining a sample area over which the calculation will be performed.  This variable may be initialized manually or by calling LoadAnalysis.  If LoadAnalysis is used, note that the T_ANALYSIS structure is defined in global coordinates and therefore nCoordSys = -1.

 

X() As Double

After the ColorImage function is called, this array variable contains the resulting X tristimulus values and has the same dimensions as the number of pixels in x and y as defined by the T_ANALYSIS structure.

 

Y() As Double

After the ColorImage function is called, this array variable contains the resulting Y tristimulus values and has the same dimensions as the number of pixels in x and y as defined by the T_ANALYSIS structure.

 

Z() As Double

After the ColorImage function is called, this array variable contains the resulting Z tristimulus values and has the same dimensions as the number of pixels in x and y as defined by the T_ANALYSIS structure.

 

 

Example

The example below demonstrates how to use the LoadAnalysis command in conjunction with ColorImage in order to generate X,Y,Z tristimulus values.  The arrays of tristimulus values are then converted to RGB values and written to a bitmap image file.


Sub Main

 

    Dim anaSurf As Long, detSurf As Long

    anaSurf = FindFullName( "Analysis Surface(s).Detector Analysis" )

    detSurf = FindFullName( "Geometry.Detector.Surface" )

 

    DeleteRays()

    TraceCreate()

 

    'retrieve analysis surface parameters

    Dim tAna As T_ANALYSIS

    Dim pxArea As Double

    LoadAnalysis anaSurf, tAna

 

    'calculate the color image

    Dim nRays As Long

    Dim X() As Double, Y() As Double, Z() As Double

    nRays = ColorImage( detSurf, -1, tAna, X(), Y(), Z() )

 

    'Convert to RGB, then write to a bitmap

    Dim R() As Integer, G() As Integer, B() As Integer

    Dim nOut As Long

    Dim fName As String

    fName = "C:\temp\colorImageOutput.bmp"

    XYZImageToRGBImage( X(), Y(), Z(), 1.0, R(), G(), B(), nOut )

    RGBToBitmap( fName, R(), G(), B() )

 

End Sub

 

See Also

ColorImageToFile

ColorImageToARN

ColorImageToFileAS

RGBToBitmap 

XYZImageToRGBImage 

T_ANALYSIS

LoadAnalysis

SetAnalysisParameters

Irradiance

IrradianceToFile

Intensity

EnergyDensity

ScalarField

ScalarFieldToFile

ScalarFieldToFileAS

VectorField

VectorFieldToFile

VectorFieldToFileAS

 

 

 

 

 

Copyright © Photon Engineering, LLC