Table of Contents

Class ImportExport

Namespace
VirtualLabAPI.Core.FieldRepresentations
Assembly
VirtualLabAPI.dll

Collection of static support functions for export and import of data fields.

public abstract class ImportExport
Inheritance
ImportExport
Inherited Members

Fields

SamplingDistanceStringInHeader

String to indicate the sampling distance information in the text file header.

public const string SamplingDistanceStringInHeader = "Sampling distance"

Field Value

string

WavelengthStringInHeader

String to indicate the wavelength information in the text file header.

public const string WavelengthStringInHeader = "Wavelength"

Field Value

string

Methods

DPItoSamplingDistance(VectorD)

Calculates the sampling distance in meters for a given resolution in dpi.

public static VectorD DPItoSamplingDistance(VectorD dpi)

Parameters

dpi VectorD

Resolution in DPI

Returns

VectorD

Sampling distance for the given resolution

ExportASCII(ComplexAmplitude, ASCIIParam)

Exports given globally polarized ComplexAmplitude to a text file. Note that only a real component of complex amplitude is stored. For complete export of complex amplitude use ExportPTF(ComplexAmplitude, string).

public static void ExportASCII(ComplexAmplitude ca, ASCIIParam param)

Parameters

ca ComplexAmplitude

ComplexAmplitude to be exported.

param ASCIIParam

Additional parameters for export.

ExportBitmap(ComplexAmplitude, string, ColorMapping)

Exports the given ComplexAmplitude as Bitmap with given ColorMapping.

public static void ExportBitmap(ComplexAmplitude complexAmplitude, string fileName, ColorMapping colorMapping)

Parameters

complexAmplitude ComplexAmplitude

ComplexAmplitude to be exported.

fileName string

File name with complete path of the exported image.

colorMapping ColorMapping

ColorMapping to be applied.

ExportCodeV(ComplexAmplitude, string)

Exports the given ComplexAmplitude into Code V field data.

public static void ExportCodeV(ComplexAmplitude ca, string fileName)

Parameters

ca ComplexAmplitude

The ComplexAmplitude to export.

fileName string

Name of the text file into which the field data is written.

ExportPTF(ComplexAmplitude, string)

Exports a ComplexAmplitude into a PTF file.

public static void ExportPTF(ComplexAmplitude ca, string fileName)

Parameters

ca ComplexAmplitude

ComplexAmplitude to export.

fileName string

File name with complete path to export into.

ImportASCII(string, char, char, PrecisionMode)

Imports an ASCII file into a ComplexField.

public static ComplexField ImportASCII(string fileName, char columnSeparator = ' ', char decimalSeparator = '.', PrecisionMode precisionMode = PrecisionMode.Double)

Parameters

fileName string

The name of the file to import.

columnSeparator char

Optional parameter giving the column separator. Default value is a space.

decimalSeparator char

Optional parameter giving the decimal parameter. Default value is a dot.

precisionMode PrecisionMode

Optional and obsolete parameter. Has no effect.

Returns

ComplexField

The imported data as a ComplexField.

ImportASCII(ASCIIParam, AdditionalCAImportParams)

Imports an ASCII file into a ComplexAmplitude.

public static ComplexAmplitude ImportASCII(ASCIIParam importASCIIParam, AdditionalCAImportParams additionalParams)

Parameters

importASCIIParam ASCIIParam

Contains all necessary parameters to import.

additionalParams AdditionalCAImportParams

Additional parameters for interpretation of imported data.

Returns

ComplexAmplitude

Imported ComplexAmplitude.

ImportBitmapQuantizedHeightProfile(string, double, bool, bool, SamplingParameters)

Imports a quantized bitmap into a ComplexAmplitude representing the height profile.

public static ComplexAmplitude ImportBitmapQuantizedHeightProfile(string fileName, double heightIncrement, bool invert, bool importGDSII, SamplingParameters samplingForGDSII)

Parameters

fileName string

Name of the file.

heightIncrement double

Needs number of quantization levels for proper calculation of phase.

invert bool

If set to true invert the layers.

importGDSII bool

If set to true import GDSII.

samplingForGDSII SamplingParameters

The sampling parameters imported from the XML file. Used to ease the GDSII import.

Returns

ComplexAmplitude

The imported ComplexAmplitude.

ImportBitmapQuantizedHeightProfile(string[], double, int, bool, bool, SamplingParameters)

Imports a quantized bitmap into a ComplexAmplitude representing the height profile.

public static ComplexAmplitude ImportBitmapQuantizedHeightProfile(string[] fileNames, double heightIncrement, int numberOfLayers, bool invert, bool importGDSII, SamplingParameters samplingForGDSII)

Parameters

fileNames string[]

Array of file names.

heightIncrement double

Needs number of quantization levels for proper calculation of phase.

numberOfLayers int

The number of layers.

invert bool

If set to true invert the layers.

importGDSII bool

If set to true import GDSII.

samplingForGDSII SamplingParameters

The sampling parameters imported from the XML file. Used to ease the GDSII import.

Returns

ComplexAmplitude

The imported ComplexAmplitude.

ImportCodeV(string)

Imports the given Code V field data into a ComplexAmplitude which is then shown as new document.

public static void ImportCodeV(string fileName)

Parameters

fileName string

Name of the file with the field data.

Exceptions

Exception

The imported data has got the data type VGeneralSpatial, VGridFarField, or VGeneralFarField. Import of this datatype is not possible! or There is no common wavelength unit in the Code V file! or There is no common 'Grid spacing'-unit in the Code V file!

ImportPTF(string, AdditionalCAImportParams)

Imports a ComplexAmplitude from a PTF file.

public static ComplexAmplitude ImportPTF(string fileName, AdditionalCAImportParams additionParams)

Parameters

fileName string

Filename to import.

additionParams AdditionalCAImportParams

Additional parameters for import.

Returns

ComplexAmplitude

Imported a ComplexAmplitude.

ImportPTF(string, PrecisionMode, bool)

Imports a file in the PTF file into a ComplexField.

public static ComplexField ImportPTF(string fileName, PrecisionMode precisionMode = PrecisionMode.Double, bool isComplex = true)

Parameters

fileName string

The name of the file to import.

precisionMode PrecisionMode

Optional and obsolete parameter. Has no effect.

isComplex bool

Optional parameter giving whether the imported data should be real-valued (FALSE) or complex-valued (TRUE). Default is true.

Returns

ComplexField

The imported data as ComplexField.

SamplingDistanceToDPI(double, double, bool)

Calculates the resolution in dpi for a given sampling distance in meters.

public static (float dpiX, float dpiY) SamplingDistanceToDPI(double sdx, double sdy, bool giveWarning)

Parameters

sdx double

sampling distance in x-direction

sdy double

sampling distance in y-direction

giveWarning bool

IF true, a warning is given regarding the limited accuracy of storing the sampling distance as DPI.

Returns

(float dpiX, float dpiY)

Resolution in dpi as x-y-tuple