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
WavelengthStringInHeader
String to indicate the wavelength information in the text file header.
public const string WavelengthStringInHeader = "Wavelength"
Field Value
Methods
DPItoSamplingDistance(VectorD)
Calculates the sampling distance in meters for a given resolution in dpi.
public static VectorD DPItoSamplingDistance(VectorD dpi)
Parameters
dpiVectorDResolution 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
caComplexAmplitudeComplexAmplitude to be exported.
paramASCIIParamAdditional 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
complexAmplitudeComplexAmplitudeComplexAmplitude to be exported.
fileNamestringFile name with complete path of the exported image.
colorMappingColorMappingColorMapping to be applied.
ExportCodeV(ComplexAmplitude, string)
Exports the given ComplexAmplitude into Code V field data.
public static void ExportCodeV(ComplexAmplitude ca, string fileName)
Parameters
caComplexAmplitudeThe ComplexAmplitude to export.
fileNamestringName 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
caComplexAmplitudeComplexAmplitude to export.
fileNamestringFile 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
fileNamestringThe name of the file to import.
columnSeparatorcharOptional parameter giving the column separator. Default value is a space.
decimalSeparatorcharOptional parameter giving the decimal parameter. Default value is a dot.
precisionModePrecisionModeOptional 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
importASCIIParamASCIIParamContains all necessary parameters to import.
additionalParamsAdditionalCAImportParamsAdditional 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
fileNamestringName of the file.
heightIncrementdoubleNeeds number of quantization levels for proper calculation of phase.
invertboolIf set to
trueinvert the layers.importGDSIIboolIf set to
trueimport GDSII.samplingForGDSIISamplingParametersThe 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
fileNamesstring[]Array of file names.
heightIncrementdoubleNeeds number of quantization levels for proper calculation of phase.
numberOfLayersintThe number of layers.
invertboolIf set to
trueinvert the layers.importGDSIIboolIf set to
trueimport GDSII.samplingForGDSIISamplingParametersThe 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
fileNamestringName 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
fileNamestringFilename to import.
additionParamsAdditionalCAImportParamsAdditional 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
fileNamestringThe name of the file to import.
precisionModePrecisionModeOptional and obsolete parameter. Has no effect.
isComplexboolOptional 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
sdxdoublesampling distance in x-direction
sdydoublesampling distance in y-direction
giveWarningboolIF
true, a warning is given regarding the limited accuracy of storing the sampling distance as DPI.