public void  Apply()
        {
            // offset
            //--------------------------------------------------------------------------------
            if (do_offset_)
            {
                for (int i = 0; i < height_; i++)
                {
                    for (int j = 0; j < width_; j++)
                    {
                        img_[i, j] -= offset_img_[i, j];
                    }
                }
            }


            //////////////////////////////////////////////////////////////////////////
            if ((IntPtr)img_buf_ != IntPtr.Zero)
            {
                Marshal.FreeHGlobal((IntPtr)img_buf_);
                Kernel32Interface.CloseHandle((IntPtr)img_buf_);
                img_buf_ = (ushort *)IntPtr.Zero;
            }

            img_buf_ = ArrayToBuffer(img_);
            //////////////////////////////////////////////////////////////////////////

            // gain
            if (do_gain_)
            {
                PKL_Interface.Acquisition_DoOffsetGainCorrection_Ex(img_buf_, img_buf_, offset_map_, gain_map_, gain_med_map_, width_ * height_, gain_seq_num_);
            }

            //////////////////////////////////////////////////////////////////////////
            // pixel
            if (do_pixel_)
            {
                PKL_Interface.Acquisition_DoPixelCorrection(img_buf_, pixel_corr_list_);
            }

            //////////////////////////////////////////////////////////////////////////
            ushort *p_idx = img_buf_;

            for (int i = 0; i < width_; i++)
            {
                for (int j = 0; j < height_; j++)
                {
                    img_[i, j] = *p_idx;
                    p_idx++;
                }
            }
            Marshal.FreeHGlobal((IntPtr)img_buf_);
            Kernel32Interface.CloseHandle((IntPtr)img_buf_);
            img_buf_ = (ushort *)IntPtr.Zero;
        }