public void SetPixelMapFile(string fn) { if ((IntPtr)pixel_corr_list_ != IntPtr.Zero) { Marshal.FreeHGlobal((IntPtr)pixel_corr_list_); Kernel32Interface.CloseHandle((IntPtr)pixel_corr_list_); pixel_corr_list_ = (int *)IntPtr.Zero; } if (File.Exists(fn)) { List <ushort[, ]> list = HisObject.OpenFile(fn).dataList; int Frames = list.Count; width_ = list[0].GetLength(1); height_ = list[0].GetLength(0); int pCorrListSize = 0; ushort *pPixelSoure = ArrayListToBuffer(list); PKL_Interface.Acquisition_CreatePixelMap(pPixelSoure, height_, width_, null, ref pCorrListSize); pixel_corr_list_ = (int *)Marshal.AllocHGlobal((int)(pCorrListSize * sizeof(int))); PKL_Interface.Acquisition_CreatePixelMap(pPixelSoure, height_, width_, pixel_corr_list_, ref pCorrListSize); Marshal.FreeHGlobal((IntPtr)pPixelSoure); Kernel32Interface.CloseHandle((IntPtr)pPixelSoure); pPixelSoure = (ushort *)IntPtr.Zero; } }
public void SetGainFile(string fn) { if ((IntPtr)gain_map_ != IntPtr.Zero) { Marshal.FreeHGlobal((IntPtr)gain_map_); Kernel32Interface.CloseHandle((IntPtr)gain_map_); gain_map_ = (ushort *)IntPtr.Zero; } if ((IntPtr)gain_med_map_ != IntPtr.Zero) { Marshal.FreeHGlobal((IntPtr)gain_med_map_); Kernel32Interface.CloseHandle((IntPtr)gain_med_map_); gain_med_map_ = (ushort *)IntPtr.Zero; } if (File.Exists(fn)) { List <ushort[, ]> list = HisObject.OpenFile(fn).dataList; gain_seq_num_ = list.Count; int count = list[0].Length; width_ = list[0].GetLength(1); height_ = list[0].GetLength(0); gain_map_ = ArrayListToBuffer(list); gain_med_map_ = (ushort *)Marshal.AllocHGlobal((int)(gain_seq_num_ * sizeof(short))); PKL_Interface.Acquisition_CreateGainMap(gain_map_, gain_med_map_, count, gain_seq_num_); offset_map_ = (ushort *)Marshal.AllocHGlobal((int)(width_ * height_ * sizeof(short))); for (int i = 0; i < width_ * height_; i++) { offset_map_[i] = 0; } } }