123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062 |
- using System;
- using System.Runtime.InteropServices;
- namespace Bruker.API
- {
- [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Ansi)]
- public struct TRTImageInfoEx
- {
- public int Magnification;
- public double PixelSizeX; // mü pro Pixel
- public double PixelSizeY;
- public double HighVoltage; // kV
- public double WorkingDistance; // mm
- }
- [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Ansi)]
- public struct TSegment
- {
- public int Y;
- public int XStart;
- public int XCount;
- }
- // TSegmentList = array[0..8192] of TSegment;
- [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Ansi)]
- public struct TSegmentList
- {
- public TSegment[] Segments;
- }
- [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Ansi)]
- public struct TFeatureData // describes 1 scan feature
- {
- public int SegmentCount;
- public TSegmentList Segments;
- }
- // TFeatureDataList = array[0..0] of TFeatureData;
- [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Ansi)]
- public struct TFeatureDataList
- {
- public TFeatureData[] FeatureDatas;
- }
- [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Ansi)]
- public struct TRTEBSDCalibSettings
- {
- public int TiltAngle;
- public int TiltAzimuthAngle;
- public int ScanRotation;
- public int WD;
- public int DetectorAxis;
- public int DetectorTilt;
- public int PhosphorSize;
- }
- public class EspritFunctions
- {
- #if WIN32
- const string rtdll = "Bruker.API.Esprit.DLL";
- #else
- const string rtdll = "Bruker.API.Esprit64.DLL";
- #endif
- /// <summary>
- /// Read current image device configuration
- /// </summary>
- /// <param name="CID">Connection Id</param>
- /// <param name="Width"></param>
- /// <param name="Height"></param>
- /// <param name="Average"></param>
- /// <param name="Ch1"></param>
- /// <param name="Ch2"></param>
- /// <returns>Function call sucessful or not( 0 = success, otherwise error)</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int ImageGetConfiguration(
- uint CID,
- ref int Width,
- ref int Height,
- ref int Average,
- ref bool Ch1,
- ref bool Ch2);
- /// <summary>
- /// Write current image device configuration
- /// </summary>
- /// <param name="CID">Connection Id</param>
- /// <param name="Width"></param>
- /// <param name="Height"></param>
- /// <param name="Average"></param>
- /// <param name="Ch1"></param>
- /// <param name="Ch2"></param>
- /// <returns>Function call sucessful or not( 0 = success, otherwise error)</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int ImageSetConfiguration(
- uint CID,
- int Width,
- int Height,
- int Average,
- bool Ch1,
- bool Ch2);
- /// <summary>
- /// Use external scan engine which triggers our scan generator trough an external signal
- /// </summary>
- /// <param name="CID">Connection Id</param>
- /// <param name="UseExternalScan"></param>
- /// <returns>Function call sucessful or not( 0 = success, otherwise error)</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int ImageSetExternalScan(
- uint CID,
- bool UseExternalScan);
- /// <summary>
- /// Aquire new image and read image data
- /// </summary>
- /// <param name="CID">Connection Id</param>
- /// <param name="Ch"></param>
- /// <param name="ShowProgress"></param>
- /// <param name="Buffer"></param>
- /// <param name="BufSize"></param>
- /// <param name="ImgInfo"></param>
- /// <returns>Function call sucessful or not( 0 = success, otherwise error)</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int ImageAquireImage(
- uint CID,
- int Ch,
- bool ShowProgress,
- object Buffer,
- ref int BufSize,
- TRTImageInfoEx ImgInfo);
- /// <summary>
- /// Aquire new image and read image data (extended)
- /// </summary>
- /// <param name="CID">Connection Id</param>
- /// <param name="Ch"></param>
- /// <param name="Buffer"></param>
- /// <param name="Options">
- /// Bit combination of the following values
- /// cImgAcq_ShowProgress = 1;
- /// cImgAcq_UpdateSEMData = 2;
- /// </param>
- /// <param name="BufSize"></param>
- /// <param name="ImgInfo"></param>
- /// <returns>Function call sucessful or not( 0 = success, otherwise error )</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int ImageAquireImageEx(
- uint CID,
- int Ch,
- object Buffer,
- int Options,
- ref int BufSize,
- TRTImageInfoEx ImgInfo);
- /// <summary>
- /// Read the image field width from scan settings and SEM magnification, microns unit
- /// </summary>
- /// <param name="CID">Connection Id</param>
- /// <param name="FieldWidth"></param>
- /// <returns>Function call sucessful or not( 0 = success, otherwise error )</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int ImageGetFieldWidth(
- uint CID,
- ref double FieldWidth);
- /// <summary>
- /// Set electron beam position in image
- /// </summary>
- /// <param name="CID">Connection Id</param>
- /// <param name="X"></param>
- /// <param name="Y"></param>
- /// <returns>Function call sucessful or not( 0 = success, otherwise error )</returns>
- //
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int ImageSetPoint(
- uint CID,
- int X,
- int Y);
- // functions to deal with point lists
- /// <summary>
- /// Start PointList Measurement
- /// </summary>
- /// <param name="CID">connection identifier</param>
- /// <param name="SPU">spectrometer index (1..n)</param>
- /// <param name="SegmentCount"></param>
- /// <param name="LineSegments">description of points to measure</param>
- /// <param name="RealTime">acquisition time in ms</param>
- /// <returns>Function call sucessful or not( 0 = success, otherwise error )</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int StartPointListMeasurement(
- uint CID,
- int SPU,
- int SegmentCount,
- TSegmentList LineSegments,
- int RealTime);
- /// <summary>
- /// Start PointList Measurement direct
- /// </summary>
- /// <param name="CID">connection identifier</param>
- /// <param name="SPU">spectrometer index (1..n)</param>
- /// <param name="SegmentCount"></param>
- /// <param name="LineSegments">description of points to measure</param>
- /// <param name="RealTime">acquisition time in ms</param>
- /// <param name="IsFirst"></param>
- /// <returns>Function call sucessful or not( 0 = success, otherwise error )</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int StartPointListMeasurementDirect(
- uint CID,
- int SPU,
- int SegmentCount,
- TSegmentList LineSegments,
- int RealTime,
- bool IsFirst);
- /// <summary>
- /// Get PointList Spectrum
- /// </summary>
- /// <param name="CID">connection identifier</param>
- /// <param name="Index">spectrum index (1..n)</param>
- /// <param name="SpectrumBuf">buffer to hold complete spectrum with header (around 20kB), must be allocated by caller</param>
- /// <param name="BufSize">size of spectrum buffer</param>
- /// <returns>Function call sucessful or not( 0 = success, otherwise error )</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int GetPointListSpectrum(
- uint CID,
- int Index,
- TRTSpectrumHeaderRec SpectrumBuf,
- int BufSize);
- /// <summary>
- /// Get PointList Spectrum direct
- /// </summary>
- /// <param name="CID">connection identifier</param>
- /// <param name="Index">spectrum index (1..n)</param>
- /// <param name="SpectrumBuf">buffer to hold complete spectrum with header (around 20kB), must be allocated by caller</param>
- /// <param name="BufSize">size of spectrum buffer</param>
- /// <returns>Function call sucessful or not( 0 = success, otherwise error )</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int GetPointListSpectrumDirect(
- uint CID,
- int Index,
- TRTSpectrumHeaderRec SpectrumBuf,
- int BufSize);
- /// <summary>
- /// Quantify PointList Spectrum
- /// </summary>
- /// <param name="CID">connection identifier</param>
- /// <param name="Index">spectrum index (1..n)</param>
- /// <param name="MethodName"></param>
- /// <param name="Params"></param>
- /// <param name="ResultBuf"></param>
- /// <param name="ResultBufSize"></param>
- /// <param name="SpectrumBuf">buffer to hold complete spectrum with header (around 20kB), must be allocated by caller</param>
- /// <param name="BufSize">size of spectrum buffer</param>
- /// <returns>Function call sucessful or not( 0 = success, otherwise error )</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int QuantifyPointListSpectrum(
- uint CID,
- int Index,
- string MethodName,
- string Params,
- [MarshalAs(UnmanagedType.VBByRefStr)] ref string ResultBuf,
- int ResultBufSize,
- TRTSpectrumHeaderRec SpectrumBuf,
- int BufSize);
- /// <summary>
- /// Save PointList Spectrum
- /// </summary>
- /// <param name="CID">connection identifier</param>
- /// <param name="Buffer">spectrum index (1..n)</param>
- /// <param name="FileName">filename to save to</param>
- /// <returns>Function call sucessful or not( 0 = success, otherwise error )</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int SavePointListSpectrum(
- uint CID,
- int Buffer,
- string FileName);
- /// <summary>
- /// Start FeatureList Measurement
- /// </summary>
- /// <param name="CID">connection identifier</param>
- /// <param name="SPU">spectrometer index (1..n)</param>
- /// <param name="FeatureCount"></param>
- /// <param name="Features"></param>
- /// <param name="PixelTimes"></param>
- /// <returns>Function call sucessful or not( 0 = success, otherwise error )</returns>
- // functions to deal with object lists
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int StartFeatureListMeasurement(
- uint CID,
- int SPU,
- int FeatureCount,
- TFeatureDataList Features,
- int[] PixelTimes);
- /// <summary>
- /// Get FeatureList-Spectrum
- /// </summary>
- /// <param name="CID">connection identifier</param>
- /// <param name="Index"></param>
- /// <param name="SpectrumBuf"></param>
- /// <param name="BufSize"></param>
- /// <returns>Function call sucessful or not( 0 = success, otherwise error )</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int GetFeatureListSpectrum(
- uint CID,
- int Index,
- TRTSpectrumHeaderRec SpectrumBuf,
- int BufSize);
- /// <summary>
- /// Quantify FeatureList Spectrum
- /// </summary>
- /// <param name="CID">connection identifier</param>
- /// <param name="Index"></param>
- /// <param name="MethodName"></param>
- /// <param name="Params"></param>
- /// <param name="ResultBuf"></param>
- /// <param name="ResultBufSize"></param>
- /// <param name="SpectrumBuf"></param>
- /// <param name="BufSize"></param>
- /// <returns>Function call sucessful or not( 0 = success, otherwise error )</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int QuantifyFeatureListSpectrum(
- uint CID,
- int Index,
- string MethodName,
- string Params,
- [MarshalAs(UnmanagedType.VBByRefStr)] ref string ResultBuf,
- int ResultBufSize,
- TRTSpectrumHeaderRec SpectrumBuf,
- int BufSize);
- /// <summary>
- /// Save FeatureList Spectrum
- /// </summary>
- /// <param name="CID">connection identifier</param>
- /// <param name="Buffer"></param>
- /// <param name="FileName"></param>
- /// <returns>Function call sucessful or not( 0 = success, otherwise error )</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int SaveFeatureListSpectrum(
- uint CID,
- int Buffer,
- string FileName);
- // functions to communicate with SEM
- /// <summary>
- /// Set SEM Data
- /// </summary>
- /// <param name="CID">connection identifier</param>
- /// <param name="Magnification"></param>
- /// <param name="HighVoltage"></param>
- /// <param name="WorkingDistance"></param>
- /// <returns>Function call sucessful or not( 0 = success, otherwise error )</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int SetSEMData(
- uint CID,
- double Magnification,
- double HighVoltage,
- double WorkingDistance);
- /// <summary>
- /// Get SEM Data
- /// </summary>
- /// <param name="CID">connection identifier</param>
- /// <param name="Magnification"></param>
- /// <param name="HighVoltage"></param>
- /// <param name="WorkingDistance"></param>
- /// <returns>Function call sucessful or not( 0 = success, otherwise error )</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int GetSEMData(
- uint CID,
- ref double Magnification,
- ref double HighVoltage,
- ref double WorkingDistance);
- /// <summary>
- /// Get SEM BC-Data
- /// </summary>
- /// <param name="CID">connection identifier</param>
- /// <param name="Brightness"></param>
- /// <param name="Contrast"></param>
- /// <returns>Function call sucessful or not( 0 = success, otherwise error )</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int GetSEMBCData(
- uint CID,
- ref double Brightness,
- ref double Contrast);
- /// <summary>
- /// Set SEM BC-Data
- /// </summary>
- /// <param name="CID">connection identifier</param>
- /// <param name="Brightness"></param>
- /// <param name="Contrast"></param>
- /// <returns>Function call sucessful or not( 0 = success, otherwise error )</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int SetSEMBCData(
- uint CID,
- double Brightness,
- double Contrast);
- /// <summary>
- /// Get SEM ProbeCurrent
- /// </summary>
- /// <param name="CID">connection identifier</param>
- /// <param name="ProbeCurrent"></param>
- /// <returns>Function call sucessful or not( 0 = success, otherwise error )</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int GetSEMProbeCurrent(
- uint CID,
- ref double ProbeCurrent);
- /// <summary>
- /// Set SEM ProbeCurrent
- /// </summary>
- /// <param name="CID">connection identifier</param>
- /// <param name="ProbeCurrent"></param>
- /// <returns>Function call sucessful or not( 0 = success, otherwise error )</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int SetSEMProbeCurrent(
- uint CID,
- double ProbeCurrent);
- /// <summary>
- /// Get SEM SpotSize
- /// </summary>
- /// <param name="CID">connection identifier</param>
- /// <param name="SpotSize"></param>
- /// <returns>Function call sucessful or not( 0 = success, otherwise error )</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int GetSEMSpotSize(
- uint CID,
- ref double SpotSize);
- /// <summary>
- /// Set SEM SpotSize
- /// </summary>
- /// <param name="CID">connection identifier</param>
- /// <param name="SpotSize"></param>
- /// <returns>Function call sucessful or not( 0 = success, otherwise error )</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int SetSEMSpotSize(
- uint CID,
- double SpotSize);
- /// <summary>
- /// Set SEM Detector
- /// </summary>
- /// <param name="CID">connection identifier</param>
- /// <param name="Channel"></param>
- /// <param name="DetectorName"></param>
- /// <returns>Function call sucessful or not( 0 = success, otherwise error )</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int SetSEMDetector(
- uint CID,
- int Channel,
- string DetectorName);
- /// <summary>
- /// Get SEM Detector
- /// </summary>
- /// <param name="CID">connection identifier</param>
- /// <param name="Channel"></param>
- /// <param name="DetectorName"></param>
- /// <param name="BufSize"></param>
- /// <returns>Function call sucessful or not( 0 = success, otherwise error )</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int GetSEMDetector(
- uint CID,
- int Channel,
- [MarshalAs(UnmanagedType.VBByRefStr)] ref string DetectorName,
- int BufSize);
- /// <summary>
- /// Set SEM Stage Data
- /// </summary>
- /// <param name="CID">connection identifier</param>
- /// <param name="XPos"></param>
- /// <param name="YPos"></param>
- /// <param name="ZPos"></param>
- /// <param name="Tilt"></param>
- /// <param name="Rotation"></param>
- /// <returns>Function call sucessful or not( 0 = success, otherwise error )</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int SetSEMStageData(
- uint CID,
- double XPos,
- double YPos,
- double ZPos,
- double Tilt,
- double Rotation);
- /// <summary>
- /// Get SEM Stage Data
- /// </summary>
- /// <param name="CID">connection identifier</param>
- /// <param name="XPos"></param>
- /// <param name="YPos"></param>
- /// <param name="ZPos"></param>
- /// <param name="Tilt"></param>
- /// <param name="Rotation"></param>
- /// <returns>Function call sucessful or not( 0 = success, otherwise error )</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int GetSEMStageData(
- uint CID,
- ref double XPos,
- ref double YPos,
- ref double ZPos,
- ref double Tilt,
- ref double Rotation);
- /// <summary>
- /// Get SEM Stage Range
- /// </summary>
- /// <param name="CID">connection identifier</param>
- /// <param name="Xmin"></param>
- /// <param name="Xmax"></param>
- /// <param name="Ymin"></param>
- /// <param name="Ymax"></param>
- /// <param name="Zmin"></param>
- /// <param name="Zmax"></param>
- /// <param name="Tmin"></param>
- /// <param name="Tmax"></param>
- /// <param name="Rmin"></param>
- /// <param name="Rmax"></param>
- /// <returns>Function call sucessful or not( 0 = success, otherwise error )</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int GetSEMStageRange(
- uint CID,
- ref double Xmin,
- ref double Xmax,
- ref double Ymin,
- ref double Ymax,
- ref double Zmin,
- ref double Zmax,
- ref double Tmin,
- ref double Tmax,
- ref double Rmin,
- ref double Rmax);
- /// <summary>
- /// Get SEM Stage State
- /// </summary>
- /// <param name="CID">connection identifier</param>
- /// <param name="State"></param>
- /// <returns>Function call sucessful or not( 0 = success, otherwise error )</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int GetSEMStageState(
- uint CID,
- ref int State);
- /// <summary>
- /// Get SEM Capabilities
- /// </summary>
- /// <param name="CID">connection identifier</param>
- /// <param name="Capabilities"></param>
- /// <param name="BufSize"></param>
- /// <returns>Function call sucessful or not( 0 = success, otherwise error )</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int GetSEMCapabilities(
- uint CID,
- [MarshalAs(UnmanagedType.VBByRefStr)] ref string Capabilities,
- int BufSize);
- /// <summary>
- /// Get SEM info
- /// </summary>
- /// <param name="CID">connection identifier</param>
- /// <param name="Info"></param>
- /// <param name="BufSize"></param>
- /// <returns>Function call sucessful or not( 0 = success, otherwise error )</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int GetSEMInfo(
- uint CID,
- [MarshalAs(UnmanagedType.VBByRefStr)] ref string Info,
- int BufSize);
- /// <summary>
- /// Set SEM External On
- /// </summary>
- /// <param name="CID">connection identifier</param>
- /// <returns>Function call sucessful or not( 0 = success, otherwise error )</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int SetSEMExternalOn(
- uint CID);
- /// <summary>
- /// Set SEM External Off
- /// </summary>
- /// <param name="CID">connection identifier</param>
- /// <returns>Function call sucessful or not( 0 = success, otherwise error )</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int SetSEMExternalOff(
- uint CID);
- /// <summary>
- /// Reset SEM Communication
- /// </summary>
- /// <param name="CID">connection identifier</param>
- /// <returns>Function call sucessful or not( 0 = success, otherwise error )</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int ResetSEMCommunication(
- uint CID);
- /// <summary>
- /// Switch SEM Off
- /// </summary>
- /// <param name="CID">connection identifier</param>
- /// <param name="HVOff"></param>
- /// <param name="BeamCurrentOff"></param>
- /// <param name="BeamBlank"></param>
- /// <returns>Function call sucessful or not( 0 = success, otherwise error )</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int SwitchSEMOff(
- uint CID,
- bool HVOff,
- bool BeamCurrentOff,
- bool BeamBlank);
- // Move EDS detector
- /// <summary>
- /// Set Position of EDS-Detector
- /// </summary>
- /// <param name="CID">connection identifier</param>
- /// <param name="Detector">Detector to be moved ( 1 in most cases )</param>
- /// <param name="Position">Position to move to ( 1 = Park position, 2 = Acquisition position )</param>
- /// <returns>Function call sucessful or not( 0 = success, otherwise error )</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int EDSSetDetectorPosition(
- uint CID,
- int Detector,
- int Position);
- /// <summary>
- /// Get Position of EDS-Detector
- /// </summary>
- /// <param name="CID">connection identifier</param>
- /// <param name="Detector">Detector to ask for position ( 1 in most cases )</param>
- /// <param name="Position">Current position ( 1 = Park position, 2 = Acquisition position )</param>
- /// <returns>Function call sucessful or not( 0 = success, otherwise error )</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int EDSGetDetectorPosition(
- uint CID,
- int Detector,
- out int Position);
- // Mapping functions
- /// <summary>
- /// Start Hypermapping
- /// </summary>
- /// <param name="CID">connection identifier</param>
- /// <param name="SPU"></param>
- /// <param name="PixelTime">Dwell time per Pixel in microseconds</param>
- /// <param name="RealTime">Acquisition time in s, RealTime=0 does exactly 1 scan</param>
- /// <returns>Function call sucessful or not( 0 = success, otherwise error )</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int HyMapStart(
- uint CID,
- int SPU,
- int PixelTime,
- int RealTime);
- /// <summary>
- /// Start Hypermapping of Image region
- /// </summary>
- /// <param name="CID">connection identifier</param>
- /// <param name="SPU"></param>
- /// <param name="PixelTime">Dwell time per Pixel in microseconds</param>
- /// <param name="RealTime">Acquisition time in s, RealTime=0 does exactly 1 scan</param>
- /// <param name="Region">Image region to be mapped</param>
- /// <returns>Function call sucessful or not( 0 = success, otherwise error )</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int HyMapStartEx(
- uint CID,
- int SPU,
- int PixelTime,
- int RealTime,
- TFeatureData Region);
- /// <summary>
- /// Start Hypermap acquisition with selected setup
- /// </summary>
- /// <param name="CID">connection identifier</param>
- /// <param name="SPU"></param>
- /// <param name="PixelTime">Dwell time per Pixel in microseconds</param>
- /// <param name="Region">Image region to be mapped</param>
- /// <param name="Profile">Parameter setup</param>
- /// <returns>Function call sucessful or not( 0 = success, otherwise error )</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int HyMapStartWithProfile(
- uint CID,
- int SPU,
- int PixelTime,
- TFeatureData Region,
- string Profile);
- //-------------------------------------------------------------------------------------
- // EBSD functions
- //-------------------------------------------------------------------------------------
- /// <summary>
- /// Retrieve the list of predefined acquisition setups
- /// </summary>
- /// <param name="CID">connection identifier</param>
- /// <param name="Profiles">buffer to store the list information</param>
- /// <param name="BufSize">Size of buffer</param>
- /// <returns>Function call sucessful or not( 0 = success, otherwise error )</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int EBSDGetAcquisitionProfiles(
- uint CID,
- [MarshalAs(UnmanagedType.VBByRefStr)] ref string Profiles,
- int BufSize);
- /// <summary>
- /// Load a predefined acquisition setup
- /// </summary>
- /// <param name="CID">connection identifier</param>
- /// <param name="Profile">buffer with profile name to select</param>
- /// <returns>Function call sucessful or not( 0 = success, otherwise error )</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int EBSDSelectAcquisitionProfile(
- uint CID,
- string Profile);
- /// <summary>
- /// Start EBSD acquisition with selected setup
- /// </summary>
- /// <param name="CID">connection identifier</param>
- /// <returns>Function call sucessful or not( 0 = success, otherwise error )</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int EBSDStartAcquisition(
- uint CID);
- /// <summary>
- /// // Start EBSD acquisition with defined profile data
- /// </summary>
- /// <param name="CID">connection identifier</param>
- /// <param name="Profile"></param>
- /// <returns></returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int EBSDStartAcquisitionWithProfile(
- uint CID,
- string Profile);
- /// <summary>
- /// Stop EBSD acquisition
- /// </summary>
- /// <param name="CID">connection identifier</param>
- /// <returns>Function call sucessful or not( 0 = success, otherwise error )</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int EBSDStopAcquisition(
- uint CID);
- /// <summary>
- /// Retrieve EBSD acquisition state
- /// </summary>
- /// <param name="CID">connection identifier</param>
- /// <param name="CurrentLine">current acquisition Y -position</param>
- /// <param name="PercentReady">Current state of Acquisition in %</param>
- /// <param name="IndexingPercentReady">Current State of Indexing in %</param>
- /// <param name="AcquisitionRunning">Is just giving the running state of the Acquisition</param>
- /// <param name="IndexingRunning">Is just giving the running state of the Indexing</param>
- /// <returns>Function call sucessful or not( 0 = success, otherwise error )</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int EBSDGetAcquisitionState(
- uint CID,
- out int CurrentLine,
- out int PercentReady,
- out int IndexingPercentReady,
- out bool AcquisitionRunning,
- out bool IndexingRunning);
- /// <summary>
- /// Save EBSD acquisition data to file in Bruker format
- /// </summary>
- /// <param name="CID">connection identifier</param>
- /// <param name="FileName">File name for the file to store information (*.bcf)</param>
- /// <param name="WithEdx">Saves EDX Data</param>
- /// <param name="WithPatterns">Saves Patterns</param>
- /// <returns>Function call sucessful or not( 0 = success, otherwise error )</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int EBSDSaveToFile(
- uint CID,
- string FileName,
- bool WithEdx,
- bool WithPatterns);
- // SaveOptions : Bit flags to specify which information has to be stored (frames, detected lines…)
- /// <summary>
- /// Export Data
- /// </summary>
- /// <param name="CID">connection identifier</param>
- /// <param name="BaseFileName">Base file name for the result files to export (map images…)</param>
- /// <param name="ExportOptions">longint representation of export options (Phase=2,IPFX=3,IPFY=4,IPFZ=5,Euler=6)</param>
- /// <returns>Function call sucessful or not( 0 = success, otherwise error )</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int EBSDExportData(
- uint CID,
- string BaseFileName,
- int ExportOptions);
- /// <summary>
- /// Export Data
- /// </summary>
- /// <param name="CID">connection identifier</param>
- /// <param name="Buffer">Memory buffer provided by caller, must be large enough to handle image data</param>
- /// <param name="BufferSize">Maximum size of buffer available, returns size which really used</param>
- /// <param name="ExportOptions">longint representation of export options (Phase=2,IPFX=3,IPFY=4,IPFZ=5,Euler=6)</param>
- /// <returns>Function call sucessful or not( 0 = success, otherwise error )</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int EBSDExportDataBuffer(
- uint CID,
- IntPtr Buffer,
- ref int BufferSize,
- int ExportOptions);
- /// <summary>
- /// Export Results
- /// </summary>
- /// <param name="CID">connection identifier</param>
- /// <param name="BaseFileName">Base file name for the result list (ctf-file) to export</param>
- /// <returns>Function call sucessful or not( 0 = success, otherwise error )</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int EBSDExportResults(
- uint CID,
- string BaseFileName);
- /// <summary>
- /// Retrieve EBSD detector position
- /// </summary>
- /// <param name="CID">connection identifier</param>
- /// <param name="Position">Detector position in mm</param>
- /// <returns>Function call sucessful or not( 0 = success, otherwise error )</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int EBSDGetDetectorPosition(
- uint CID,
- out double Position);
- /// <summary>
- /// Move EBSD detector to specified position
- /// </summary>
- /// <param name="CID">connection identifier</param>
- /// <param name="Position">Detector position in mm</param>
- /// <param name="Speed">Detector speed in mm/s</param>
- /// <returns>Function call sucessful or not( 0 = success, otherwise error )</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int EBSDSetDetectorPosition(
- uint CID,
- double Position,
- double Speed);
- /// <summary>
- /// Start EBSD-Calibration
- /// </summary>
- /// <param name="CID">connection identifier</param>
- /// <param name="Settings">
- /// Settings include:
- /// TiltAngle of the Detector
- /// TiltAzimuthAngle of the Detector
- /// ScanRotation
- /// WD
- /// DetectorAxis
- /// DetectorTilt
- /// PhosphorSize
- /// </param>
- /// <returns>Function call sucessful or not( 0 = success, otherwise error )</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int EBSDStartCalibration(
- uint CID,
- TRTEBSDCalibSettings Settings);
- /// <summary>
- /// Stop EBSD Calibration
- /// </summary>
- /// <param name="CID">connection identifier</param>
- /// <returns>Function call sucessful or not( 0 = success, otherwise error )</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int EBSDStopCalibration(
- uint CID);
- /// <summary>
- /// Get Calibration State
- /// </summary>
- /// <param name="CID">connection identifier</param>
- /// <param name="CurrentLine">not yet in use</param>
- /// <param name="PercentReady">Calibration state in %</param>
- /// <param name="Running">Running state of calibration</param>
- /// <returns>Function call sucessful or not( 0 = success, otherwise error )</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int EBSDGetCalibrationState(
- uint CID,
- out int CurrentLine,
- out int PercentReady,
- out bool Running);
- /// <summary>
- /// EBSD Save ImageFromPosition
- /// </summary>
- /// <param name="CID">connection identifier</param>
- /// <param name="aBaseFilename"></param>
- /// <param name="X"></param>
- /// <param name="Y"></param>
- /// <returns>Function call sucessful or not( 0 = success, otherwise error )</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int EBSDSaveEBSPImageFromPosition(
- uint CID,
- string aBaseFilename,
- int X,
- int Y);
- /// <summary>
- /// EBSD SetExposureTime
- /// </summary>
- /// <param name="CID">connection identifier</param>
- /// <param name="ExposureTime"></param>
- /// <returns>Function call sucessful or not( 0 = success, otherwise error )</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int EBSDSetExposureTime(
- uint CID,
- int ExposureTime);
- /// <summary>
- /// EBDS Get Exposure Time
- /// </summary>
- /// <param name="CID">connection identifier</param>
- /// <param name="ExposureTime"></param>
- /// <returns>Function call sucessful or not( 0 = success, otherwise error )</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int EBSDGetExposureTime(
- uint CID,
- out int ExposureTime);
- /// <summary>
- /// EBSD Get Image Configuration
- /// </summary>
- /// <param name="CID">connection identifier</param>
- /// <param name="Width">Map width</param>
- /// <param name="Height">Map height</param>
- /// <returns></returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int EBSDGetImageConfiguration(
- uint CID,
- out int Width,
- out int Height);
- /// <summary>
- /// Get Camera Configuration
- /// </summary>
- /// <param name="CID">connection identifier</param>
- /// <param name="Width">Current camera width</param>
- /// <param name="Height">Current camera height</param>
- /// <returns></returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int EBSDGetCameraConfiguration(
- uint CID,
- out int Width,
- out int Height);
-
- /// <summary>
- /// EDSB Set Gain
- /// </summary>
- /// <param name="CID">connection identifier</param>
- /// <param name="Value"></param>
- /// <returns>Function call sucessful or not( 0 = success, otherwise error )</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int EBSDSetGain(
- uint CID,
- int Value);
- /// <summary>
- /// EBSD Get Gain
- /// </summary>
- /// <param name="CID">connection identifier</param>
- /// <param name="Value"></param>
- /// <returns>Function call sucessful or not( 0 = success, otherwise error )</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int EBSDGetGain(
- uint CID,
- out int Value);
- /// <summary>
- /// EBSD Get Tilt
- /// </summary>
- /// <param name="CID">connection identifier</param>
- /// <param name="Value"></param>
- /// <returns></returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int EBSDGetTilt(
- uint CID,
- out double Value);
- /// <summary>
- /// EBSD Get Available Pattern Format Count
- /// </summary>
- /// <param name="CID">connection identifier</param>
- /// <param name="Count">returns the amount of image format (binning)</param>
- /// <returns></returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int EBSDGetAvailablePatternFormatCount(
- uint CID,
- out int Count);
- /// <summary>
- /// Get available Pattern Format
- /// </summary>
- /// <param name="CID">connection identifier</param>
- /// <param name="FormatIndex">Seletion index of image format</param>
- /// <param name="Width">Camera Width</param>
- /// <param name="Height">Camera Height</param>
- /// <returns></returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int EBSDGetAvailablePatternFormat(
- uint CID,
- int FormatIndex,
- out int Width,
- out int Height);
- /// <summary>
- /// Set Pattern Format
- /// </summary>
- /// <param name="CID">connection identifier</param>
- /// <param name="FormatIndex">The choosen Index for Camera Format</param>
- /// <returns></returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int EBSDSetPatternFormat(
- uint CID,
- int FormatIndex);
- /// <summary>
- /// EBSDSetPattern16bitMode
- /// </summary>
- /// <param name="CID">connection identifier</param>
- /// <param name="Value">true (16bit Mode), false (8 bit Mode)</param>
- /// <returns></returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int EBSDSetPattern16bitMode(
- uint CID,
- bool Value);
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int EBSDGetEstimatedMappingTime(
- uint CID,
- out int Time);
- }
- }
|