/// <summary>
        /// Using the list of hotpixels in order to substitute the hotpixels. This
        /// is the same function as in the Hotpixel Frame Filter.
        /// </summary>
        /// <param name="imgBuffer"></param>
        private void fixHotPixel(IFrameQueueBuffer imgBuffer)
        {
            unsafe
            {
                byte *           Hotpixel;
                int              bytesPerPixel = imgBuffer.FrameType.BitsPerPixel / 8;
                VCDRangeProperty offsetX       = (VCDRangeProperty)icImagingControl1.VCDPropertyItems.FindInterface(VCDGUIDs.VCDID_PartialScanOffset, VCDGUIDs.VCDElement_PartialScanOffsetX, VCDGUIDs.VCDInterface_Range);
                VCDRangeProperty offsetY       = (VCDRangeProperty)icImagingControl1.VCDPropertyItems.FindInterface(VCDGUIDs.VCDID_PartialScanOffset, VCDGUIDs.VCDElement_PartialScanOffsetY, VCDGUIDs.VCDInterface_Range);
                int              pixelsLeftX   = highestWidth - imgBuffer.FrameType.Width;
                int              pixelsLeftY   = highestHeight - imgBuffer.FrameType.Height;
                int              oX            = offsetX.Value;
                int              oY            = offsetY.Value;
                byte *           pstart        = imgBuffer.Ptr;
                if (offsetX.Value > pixelsLeftX)
                {
                    oX = pixelsLeftX;
                }
                if (offsetY.Value > pixelsLeftY)
                {
                    oY = pixelsLeftY;
                }

                foreach (var p in listOfCoordinates)
                {
                    if (p.X < oX)
                    {
                        continue;
                    }
                    if (p.Y < oY)
                    {
                        continue;
                    }
                    if (p.X >= imgBuffer.FrameType.Width + oX)
                    {
                        continue;
                    }
                    if (p.Y >= imgBuffer.FrameType.Height + oY)
                    {
                        continue;
                    }

                    if (imgBuffer.FrameType.IsBottomUp)
                    {
                        Hotpixel = pstart + ((imgBuffer.FrameType.Height - 1 - (p.Y - oY)) * imgBuffer.FrameType.Width + (p.X - oX)) * bytesPerPixel;
                    }
                    else
                    {
                        Hotpixel = pstart + ((p.Y - oY) * imgBuffer.FrameType.Width + (p.X - oX)) * bytesPerPixel;
                    }
                    if (Hotpixel < pstart + imgBuffer.FrameType.BufferSize - bytesPerPixel)
                    {
                        for (int i = 0; i < bytesPerPixel; i++)
                        {
                            Hotpixel[i] = Hotpixel[i + bytesPerPixel];
                        }
                    }
                }
            }
        }
 /*
  * The NotifyStart method is called, when the live video is to be started.
  */
 public override void NotifyStart(FrameType inType, FrameType outType)
 {
     //TODO: Insert your own initializations here.
     // ToDo: Pixel Liste Laden
     base.NotifyStart(inType, outType);
     listOfCoordinates.Clear();
     serialnumber = ic.DeviceCurrent.GetSerialNumber();
     readXML();
     getHighestResolution();
     offsetX = (VCDRangeProperty)ic.VCDPropertyItems.FindInterface(VCDGUIDs.VCDID_PartialScanOffset, VCDGUIDs.VCDElement_PartialScanOffsetX, VCDGUIDs.VCDInterface_Range);
     offsetY = (VCDRangeProperty)ic.VCDPropertyItems.FindInterface(VCDGUIDs.VCDID_PartialScanOffset, VCDGUIDs.VCDElement_PartialScanOffsetY, VCDGUIDs.VCDInterface_Range);
 }
 /// <summary>
 /// Show the device selection dialog of IC Imaging Control.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void cmdDevice_Click(object sender, EventArgs e)
 {
     OpenNewVideoCaptureDevice();
     getHighestResolution();
     icImagingControl1.VideoFormat = String.Format("Y800 " + "({0}x{1})", highestWidth, highestHeight);
     if (icImagingControl1.DeviceValid)
     {
         _gain = (VCDRangeProperty)icImagingControl1.VCDPropertyItems.FindInterface(VCDGUIDs.VCDID_Gain, VCDGUIDs.VCDElement_Value, VCDGUIDs.VCDInterface_Range);
         if (_gain != null)
         {
             _gain.Value    = (int)((double)_gain.RangeMax * 0.3);
             tbGain.Minimum = _gain.RangeMin;
             tbGain.Maximum = _gain.RangeMax;
             tbGain.Value   = _gain.Value;
             tbGain.Enabled = true;
         }
         icImagingControl1.LiveStart();
         prepareProperties(false);
         _findHotPixel   = true;
         btnSave.Enabled = true;
     }
 }