|
Programming Reference for VirtualLab Fusion
2022.1
|
This class provides methods for the import and export of fields to bitmaps, text files, or bitmap animations and access to the Microsoft Windows file system. More...
Static Public Member Functions | |
| static Bitmap | CalculateBitmapFromChromaticFieldsSet2D (ChromaticFieldsSet cfs, double brightnessFactor, out bool noVisibleWavelength, bool interpolated=true, Size? numberOfPixels=null, PhysicalValueRange xRange=null, PhysicalValueRange yRange=null) |
| Static conversion method for creating a bitmap from a 2D Chromatic Fields Set. More... | |
| static Bitmap | CalculateBitmapFromDataArray2D (DataArray2D dataArray, int subsetIndex, FieldQuantity fieldQuantity, bool interpolated=true, Size? numberOfPixels=null, PhysicalValueRange xRange=null, PhysicalValueRange yRange=null, double minValue=double.NaN, double maxValue=double.NaN, ColorLookUpTableForDataView2D colorTable=null, Color? colorForUndefined=null) |
| Static public conversion method for creating a bitmap from a 2D Data Array. More... | |
| static ComplexAmplitude | ImportGrayScaleBitmap (string fileName, double minimumValue=0, double maximumValue=1, FieldQuantity fieldQuantity=FieldQuantity.RealPart, PrecisionMode precision=PrecisionMode.Float, double? wavelength=null) |
| Imports the values of a grayscale bitmap (24 bit RGB or 16 bit gray scale) into a ComplexAmplitude. The sampling distance is calculated from the dpi values of the bitmap. More... | |
| static ComplexAmplitude | LoadField (string fileName) |
| Loads a field from a file. More... | |
| static HarmonicFieldsSet | LoadFieldsSet (string fileName) |
| Loads a fields set from a file. More... | |
| static int | NumberOfLines (string fileName) |
| Returns the number of lines in the text file specified by fileName. More... | |
| static void | ProcessOpticalSetup (string fileNameOpticalSetup, string outputFolder, string fileNameParameters="", PropagationEngine? simulationEngine=null, int? analyzerIndex=null, bool useSubfolder=false) |
| Loads and simulates the given Optical Setup file. More... | |
| static string | ReadLine (string fileName, int lineNumber) |
| Returns the nth line of the text file specified by fileName, where \(n\) equals the lineNumber. The first line of the file is line number 1. If the file does not exist or the specified line number is beyond the end of the file, the program using this method will be stopped unless the thrown exception is handled outside of this method. More... | |
| static void | SaveDocument (IDocument document, string fileName) |
| Saves a document (e. g. a ComplexAmplitude or a HarmonicFieldsSet object) to the hard disc. More... | |
| static void | WriteLineToLogFile (string fileName, string message) |
| Writes a string as a separate line to the end of the specified log file. More... | |
| static void | WriteToLogFile (string fileName, string message) |
| Writes a string to the end of the specified log file. In contrast to the WriteLineToLogFile method, this method does not introduce a line break. More... | |
This class provides methods for the import and export of fields to bitmaps, text files, or bitmap animations and access to the Microsoft Windows file system.
|
static |
Static conversion method for creating a bitmap from a 2D Chromatic Fields Set.
| cfs | Chromatic fields set to create the bitmap from |
| brightnessFactor | Factor to increase or decrease the brightness in the bitmap to be calculated. Too high brightness can lead to oversaturation. |
| noVisibleWavelength | Out parameter that indicates whether none of the wavelengths is in the range of visible wavelengths. |
| interpolated | If this optional parameter is set to false, you see the original sampling points in the bitmap. Else an interpolation between neighbored sampling points is done. |
| numberOfPixels | Number of pixels in the resulting bitmap. If this optional parameter is not specified, one pixel per sampling point is created. |
| xRange | Optional x-coordinate range of the Chromatic Fields Set to be displayed in the bitmap. Can be used to show only a part of the Chromatic Fields Set. |
| yRange | Optional y-coordinate range of the Chromatic Fields Set to be displayed in the bitmap. Can be used to show only a part of the Chromatic Fields Set. |
|
static |
Static public conversion method for creating a bitmap from a 2D Data Array.
| dataArray | Data Array to create the bitmap from |
| subsetIndex | The index of that data subset of the Data Array to be converted to the bitmap. |
| fieldQuantity | The field quantity to be converted to the bitmap. |
| interpolated | If this optional parameter is set to false, you see the original sampling points in the bitmap. Else an interpolation between neighbored sampling points is done, using the interpolation methods (X and Y) of the data array. |
| numberOfPixels | Number of pixels in the resulting bitmap. If this optional parameter is not specified, one pixel per sampling point is created. |
| xRange | Optional x-coordinate range of the Data Array to be displayed in the bitmap. Can be used to show only a part of the Chromatic Fields Set. |
| yRange | Optional y-coordinate range of the Data Array to be displayed in the bitmap. Can be used to show only a part of the Chromatic Fields Set. |
| minValue | Optional minimum value to be mapped to a color. All values below will have the same color as this value. |
| maxValue | Optional maximum value to be mapped to a color. All values above will have the same color as this value. |
| colorTable | Optional color table for mapping double values to colors. By default the corresponding Global Option is used. |
| colorForUndefined | Color to be used for undefined values. By default the corresponding Global Option is used. |
|
static |
Imports the values of a grayscale bitmap (24 bit RGB or 16 bit gray scale) into a ComplexAmplitude. The sampling distance is calculated from the dpi values of the bitmap.
| fileName | File name of the bitmap to be imported. |
| minimumValue | Optional minimum value, i.e. the value of black pixels. 0 by default. |
| maximumValue | Optional maximum value, i.e. the value of white pixels. 1 by default. |
| fieldQuantity | Optional field quantity. If not specified, the data is imported into the real part. If the field quantity is Imaginary Part or Phase, the resulting ComplexAmplitude will be complex-valued, otherwise it will be real-valued. |
| precision | Optional precision (float or double) of the resulting field. Float by default. |
| wavelength | Optional wavelength. If you specify this value, a Harmonic Field instead of a Jones Matrix Transmission is generated. |
|
static |
Loads a field from a file.
| fileName | Full path of the file to load. Note that backslashes must be doubled, for example “C:\myField.ca2”. |
|
static |
Loads a fields set from a file.
| fileName | Full path of the file to load. Note that backslashes must be doubled, for example “C:\myFieldsSet.hfs” |
|
static |
Returns the number of lines in the text file specified by fileName.
| fileName | The full path of the file from which the text is to be read. Note that backslashes must be doubled, for example “C:\log.txt”. |
|
static |
Loads and simulates the given Optical Setup file.
| fileNameOpticalSetup | The complete path of the Optical Setup file. |
| outputFolder | The folder to which all results are written. Note that messages, warnings, and errors are still written to the Messages tab of the main window of VirtualLab Fusion. |
| fileNameParameters | If you specify this optional parameter, the parameters of the Optical Setup are overwritten with the parameters of that given file. The file must be in a specific XML format which can be generated by exporting an Optical Setup to batch mode files within VirtualLab Fusion. |
| simulationEngine | The simulation engine to use. If this optional parameter is not specified, the given analyzer is executed instead. |
| analyzerIndex | Index of the analyzer to be executed. If this optional parameter is not specified and also no simulation engine, then the default simulation engine as defined in the Global Options is used. |
| useSubfolder | If set to true a unique sub-folder for each simulation run is generated. |
|
static |
Returns the nth line of the text file specified by fileName, where \(n\) equals the lineNumber. The first line of the file is line number 1. If the file does not exist or the specified line number is beyond the end of the file, the program using this method will be stopped unless the thrown exception is handled outside of this method.
| fileName | The full path of the file from which the text is to be read. Note that backslashes must be doubled, for example “C:\log.txt”. |
| lineNumber | The line number to be read. |
| System.ArgumentException | Line number must be between 1 and the number of lines in the file. |
|
static |
Saves a document (e. g. a ComplexAmplitude or a HarmonicFieldsSet object) to the hard disc.
| document | The document to save. |
| fileName | The desired file name including the full path. Note that backslashes must be doubled, for example “C:\myField.ca2” |
|
static |
Writes a string as a separate line to the end of the specified log file.
| fileName | The full path of the file into which the text is to be written. Note that backslashes must be doubled, for example “C:\log.txt”. If the file does not exist, it is created. |
| message | The string to write into the log file. |
|
static |
Writes a string to the end of the specified log file. In contrast to the WriteLineToLogFile method, this method does not introduce a line break.
| fileName | The full path of the file into which the text is to be written. Note that backslashes must be doubled, for example “C:\log.txt”. If the file does not exist, it is created. |
| message | The string to write into the log file. |