Interactive Mode takes an XML Collector Configuration File and a DIRSIG cfg file as input. An example of the collector XML follows:
<?xml version="1.0" standalone="no"?>
<!DOCTYPE interactive SYSTEM "http://www.dirsig.org/dtds/interactive.dtd">
<interactive format="plain" pausepolicy="never">
<simulationcollectors>
<simscenefilename/>
<simbandpasses/>
<simscenebbox/>
</simulationcollectors>
<solutioncollectors>
<pathviewray/>
<pathsolidangle/>
<pathsurfacecount/>
</solutioncollectors>
<surfacecollectors>
<surfacematid/>
<surfacetemperature/>
<surfaceentrypoint/>
<surfaceexitpoint/>
<surfacepathlength/>
<surfacenormal/>
<surfacetransmission/>
<surfaceradiance/>
</surfacecollectors>
</interactive>
The interactive section has four attributes which may be set:
The "format" attribute may be set to "plain", "xml", or "binary". It controls the output formatting of the Interactive Session.
The "pausepolicy" is an experimental feature which may be set to "never", "percollector", or "persurface". Rather than immediately output all the results, the interactive session will halt at the specified points, waiting for the user to type an abitrary character (or characters) followed by a new line.
The "startupoutputredirect" may specify a filename to which all the DIRSIG startup text gets redirected. This does not include the output portion of the interactive session. If this attribute is not specified, then all output will go to either stdout or stderr, as in a normal DIRSIG simulation. Note that input must still be provided via stdin.
The "interactiveoutputredirect" may specify a filename to which all the DIRSIG interactive results are redirected. If this attribute is not specified, then all output will go to stdout. Note that input must still be provided via stdin.
In the collector configuration file, the "<simulationcollectors>" corresponds to the Simulation Level Queries. Likewise, "<solutioncollectors>" go with Solutions and "<surfacecollectors>" are applied to each surface in a given solution. A full list of available collectors are given in: Table 19-1, Table 19-2, and Table 19-3. The Document Type Definition (DTD) associated with this input file also lists the available options and provides a means for syntax validation using external tools.
Table 19-1. Simulation Level Collectors
| Collector Tag | Description |
|---|---|
| simatmmodelname | String describing atmospheric model being used. |
| simscenefilename | Name of the top-level ODB filename for the simulation. |
| simmatfilename | Name of the simulation material filename. |
| simbandpasses | Outputs the simulation bandpass list. This is indicates the discretization of electromagnetic spectrum which DIRSIG is using in its radiometric calculations. |
| simscenebbox | Provides extent points of an axis-aligned bounding box encapsulating all the nonmoving geometry in the scene. |
Table 19-2. Solution Level Collectors
| Collector Tag | Description |
|---|---|
| pathviewray | Origin and direction of the ray used to intersect geometry. (Matches what is supplied by user). |
| pathsolidangle | Solid angle used for radiometric calculations with view ray. (Matches what is supplied by user). |
| pathsurfacecount | Number of surfaces intersected by the ray before the path transmission fell below DIRSIG's internal threshold. (Normally the maximum value in the transmission spectral vector is no higher than 0.5%). |
| pathradiance | The sensor reaching radiance. |
| pathtransmission | Transmission along the entire path. Note that this will be zero if the ray strikes any opaque surfaces. |
Table 19-3. Surface Level Collectors
| Collector Tag | Description |
|---|---|
| surfacetransmission | A spectral vector of mueller matrices indicating the surface transmission. |
| surfaceradiance | A spectral vector of stokes vector indicating the surface radiance in W/(cm^2 * omega * micron). |
| surfaceirradiance | A spectral vector of stokes vectors indicating the surface irradiance in W/(cm^2). |
| surfacetemperature | The temperature of the surface in Kelvin. |
| surfaceentrypoint | World space coordinate (in meters) where the view ray hit the surface. |
| surfaceexitpoint | World space coordinate (in meters) where the view ray left the surface. Relevant for volume geometry. |
| surfaceentrydistance | Distance along ray to surface entry. |
| surfaceexitdistance | Distance along ray to surface exit. |
| surfaceentryangle | Entry angle of the ray relative to the surface normal. Given in radians. |
| surfaceexitangle | Exit angle of the ray relative to the surface normal. Given in radians. |
| surfacepathlength | Length of the ray segment passing through the surface. Relevant for volume geometry and equals the Euclidean distance between the entry and exit point. |
| surfacenormal | A normalized vector describing the surface normal. |
| surfacematerialid | The Material Id associated with the surface. This corresponds to an entry in the materials database (.mat file). |
| surfacethermalthickness | Non-volume geometry can be given a thermal thickness for the purposes of running DIRSIG's temperature (Therm) model. This value is normally specified in the materials database (.mat file), but can be overridden on a per facet basis in a GDB file. |
| surfacegasconcentration | Volume geometry may be used to represent a gas, in which case this value represents the gas concentration of the associated material in PPM. |
Note that Polarized Mueller Matrices are stored in Row Major Order (M01,M02, M03,M04, M10, ... ,M44). In the current release of Interactive Mode, the location attribute associated with each Mueller Matrix or Stokes Vector in a Spectral Vector gives the spectral location in Microns.
Note also that the Surfaces are output in ascending order sorted by Entry Distance.
The spectral coverage computed by Interactive Mode is determined by a Bandpass Configuration File. DIRSIG defines spectral regions using a minimum, maximum, and a uniform delta. These spectral regions are termed a "bandpass". Multiple bandpasses can be assembled in to a "bandpass list". A bandpass with a minimum wavelength of 0.3 microns, a maximum wavelength of 0.5 microns, and a sampling delta of 0.1 microns tells DIRSIG to simulate for the wavelengths 0.3, 0.4, and 0.5 microns. This means that internally, all the radiances, transmissions, irradiances, etc are computed for these three wavelengths. An example of the bandpass XML follows:
<bandpasslist>
<bandpass spectralunits="microns">
<minimum>0.3</minimum>
<maximum>0.5</maximum>
<delta>0.1</delta>
</bandpass>
</bandpasslist>
Spectral units of "microns", "nanometers", and "wavenumbers" are currently supported. An example of a bandpass XML specifying two bandpasses follows. This example will cause DIRSIG to simulate at 0.3, 0.31, 0.32, 0.33, 0.4, and 0.5 microns.
<bandpasslist>
<bandpass spectralunits="microns">
<minimum>0.3</minimum>
<maximum>0.5</maximum>
<delta>0.1</delta>
</bandpass>
<bandpass spectralunits="nanometers">
<minimum>310</minimum>
<maximum>330</maximum>
<delta>10</delta>
</bandpass>
</bandpasslist>
With a collector configuration file in place, DIRSIG4 can be placed in Interactive Mode as follows:
dirsig4 -interactive ./collector.xml ./bandpass.xml nadir.cfg
In this case, collector.xml is the name of a Collector Configuration File. The bandpass.xml is the Bandpass Configuration File. The nadir.cfg is a traditional DIRSIG3 cfg file corresponding to a simulation. Parts of this CFG file, such as the atmosphere and the simulation base time, are still used by Interactive Mode. Future releases will allow all this information to be supplied via the command line, doing away entirely with the CFG file. When DIRSIG4 has finished loading the scene, the following prompt will appear:
Interactive Mode Ready <!-- [time] [omega] [orX] [orY] [orZ] [dirX] [dirY] [dirZ] -->
The XML style comment indicates the input which Interactive Mode expects, summarized in Table 19-4. This informational prompt does not appear when operating in "binary" output mode.
Table 19-4. Interactive Input Parameters
| Parameter | Description |
|---|---|
| time | Offset in seconds from simulation time specified in DIRSIG cfg. Fractional and negative values allowed. |
| omega | The solid angle represented by the ray. |
| orX, orY, orZ | Ray Origin: X, Y, and Z coordinates. |
| dirX, dirY, dirZ | Ray Direction Vector: X, Y, and Z values. |
Note that the ray direction vector does not need to be normalized. However, it may never be the zero vector. Also, the solid angle must obviously be greater than zero.
Interactive Mode is capable of outputting plain text, XML, or binary. The is controlled by setting the "format" attribute in the Collector Configuration File.
The Plain output format is intended to be human friendly. The following example contains the verbatim results of an interactive session.
Interactive Mode Ready
# Simulation Parameters #
Scene Bounding Box:
minimum: (-521.713,-543.484,-953.792)
maximum: (1654.42,1632.64,1222.34)
# Solution Results #
View Ray:
origin: (800,800,1000)
direction: (0,0,-1)
Solid Angle: 1
Surface Count: 1
Path Radiance:
[0.47 microns] 0.00279327
[0.48 microns] 0.00281209
[0.49 microns] 0.00275102
[0.5 microns] 0.0028744
# Surface 1 #
Entry Distance: 859.254
Entry Angle: 0.485803
Material ID: 25
Interactive Mode Finished
The XML output format allows users to easily parse interactive mode output using a DOM or SAX parser. The output is a completely valid XML document, including a reference to a DTD which can be used for basic syntax validation. Note that the spacing in the XML demonstration has been modified to make it more human-friendly. Likewise, some XML-style comments have been omitted for brevity.
<?xml version="1.0" standalone="no"?>
<!DOCTYPE interactivesession
SYSTEM "http://www.dirsig.org/dtds/interactive_out.dtd">
<interactivesession>
<simulationinfo>
<simscenebbox>
<box>
<lowerextent>
<point><x>-521.713</x><y>-543.484</y><z>-953.792</z></point>
</lowerextent>
<upperextent>
<point><x>1654.42</x><y>1632.64</y><z>1222.34</z></point>
</upperextent>
</box>
</simscenebbox>
</simulationinfo>
<solutioninfo>
<pathviewray>
<ray>
<origin><point><x>800</x><y>800</y><z>1000</z></point></origin>
<direction><vector><x>0</x><y>0</y><z>-1</z></vector></direction>
</ray>
</pathviewray>
<pathsolidangle>1</pathsolidangle>
<pathsurfacecount>1</pathsurfacecount>
<pathradiance>
<spectralvector>
<stokesvector location="0.47"> 0.00279327 </stokesvector>
<stokesvector location="0.48"> 0.00281209 </stokesvector>
<stokesvector location="0.49"> 0.00275102 </stokesvector>
<stokesvector location="0.5"> 0.0028744 </stokesvector>
</spectralvector>
</pathradiance>
<surfaceinfo>
<surfaceentrydistance>859.254</surfaceentrydistance>
<surfaceentryangle>0.485803</surfaceentryangle>
<surfacematid>25</surfacematid>
</surfaceinfo>
</solutioninfo>
</interactivesession>
Interactive Mode also supports binary output. This section describes the format for that output. All data is output as big endian, regardless of the CPU architecture on which DIRSIG is run. Table 19-5 shows the assumptions about the size and formatting of the basic types discussed in this section.
Table 19-5. Basic Type Descriptions
| Type | Description |
|---|---|
| byte | 8 bits, signed via two's complement, -128 to 127 |
| int | 4 bytes, signed via two's complement, big endian, -2,147,483,648 to 2,147,483,647 |
| double | 8 bytes, IEEE754 format, big endian, 4.94065645841246544e-324 to 1.79769313486231570e+308 |
DIRSIG builds on these basic types to build more complex types for things like rays, stokes vectors, strings, etc. The following collection of tables shows how these DIRSIG types are structured. They list the elements of each type, in order, and explain what that element represents.
Table 19-6. DIRSIG Type: String
| Type | Description |
|---|---|
| int | Number of characters in string. |
| N bytes | All N ASCII characters in string. |
Table 19-7. DIRSIG Type: Mueller Matrix
| Type | Description |
|---|---|
| byte | Polarization status. 0=unpolarized, 1=polarized. |
| 1 or 16 doubles | Mueller matrix elements in row major order. If unpolarized, there is only a single double (M_00) otherwise the full 4x4 matrix is presented. |
Table 19-8. DIRSIG Type: Stokes Vector
| Type | Description |
|---|---|
| byte | Polarization status. 0=unpolarized, 1=polarized. |
| 1 or 4 doubles | Stokes vector elements. If unpolarized, there is only a single double (S_0) otherwise the full 4 element vector is presented. |
Table 19-9. DIRSIG Type: Spectral Vector of Mueller Matrices
| Type | Description |
|---|---|
| int | Number of mueller matrices in spectral vector. |
| N (double, Mueller Matrix) | All N matrices in the vector are printed out. Each is preceeded by a double indicating the wavelength associated with the matrix in microns. |
Table 19-10. DIRSIG Type: Spectral Vector of Stokes Vectors
| Type | Description |
|---|---|
| int | Number of stokes vectors in spectral vector. |
| N (double, Stokes Vector) | All N stokes vectors in the spectral vector are printed out. Each is preceeded by a double indicating the wavelength associated with the stokes vector in microns. |
Table 19-11. DIRSIG Type: Point
| Type | Description |
|---|---|
| double | x coordinate. |
| double | y coordinate. |
| double | z coordinate. |
Table 19-12. DIRSIG Type: Vector
| Type | Description |
|---|---|
| double | x component. |
| double | y component. |
| double | z component. |
Table 19-14. DIRSIG Type: Box
| Type | Description |
|---|---|
| Point | Minimum extent of axis-aligned box. |
| Point | Maximum extent of axis-aligned box. |
Table 19-15. DIRSIG Type: Bandpass
| Type | Description |
|---|---|
| double | Minimum extent of bandpass. Units defined byte "spectral units" byte. |
| double | Maximum extent of bandpass. Units defined byte "spectral units" byte. |
| double | Sampling delta for bandpass. |
| byte | Spectral units. 1 = wave numbers, 2 = microns, 3 = nanometers. |
| int | Total number of sampling points in bandpass. Should be same as computing via min/max extents and delta. |
Table 19-16. DIRSIG Type: Bandpass List
| Type | Description |
|---|---|
| int | Number of "Bandpass" items in list. |
| int | Total number of sampling points for all the bandpasses in list. |
| N Bandpass | All N bandpasses in the list, printed out sequentially. Number of bandpasses printed is given by "bandpass count" above. |
With the list of basic types and DIRSIG types established above, it is now possible to parse the collector output when in binary mode. Table 19-17 shows the output from each collector.
Table 19-17. Binary Collector Outputs
| Collector | Output Type |
|---|---|
| simatmmodelname | string |
| simscenefilename | string |
| simmatfilename | string |
| simbandpasses | Bandpass List |
| simscenebbox | Box |
| pathviewray | Ray |
| pathsolidangle | double |
| pathsurfacecount | int |
| pathtransmission | Spectral Vector of Mueller Matrices |
| pathradiance | Spectral Vector of Stokes Vectors |
| surfacetransmission | Spectral Vector of Mueller Matrices |
| surfaceradiance | Spectral Vector of Stokes Vectors |
| surfacetemperature | double |
| surfaceentrypoint | Point |
| surfaceexitpoint | Point |
| surfaceentrydistance | double |
| surfaceexitdistance | double |
| surfaceentryangle | double |
| surfaceexitangle | double |
| surfacepathlength | double |
| surfacenormal | Vector |
| surfacematid | int |
| surfacethermalthickness | double |
| surfacegasconcentration | double |