private void RedrawRoisOnMaskBitmapSource() { MaskBitmapSource.Clear(); //foreach (Roi r in m_Rois) //{ // AddRoiToMaskBitmapSource(r); //} AddRoisToMaskBitmapSource(m_Rois); }
//private void InitMaskBitmap(System.Windows.Media.Imaging.BitmapSource bitmapSource) //{ // if (bitmapSource == null) // { // throw new NotImplementedException(); // } // //this.m_MaskBitmapSource = new System.Windows.Media.Imaging.RenderTargetBitmap(bitmapSource.PixelWidth, bitmapSource.PixelHeight, 96, 96, PixelFormats.Default); // this.m_MaskBitmapSource = UserControls.ImageResourceModerator.Instance.GetRenderTargetBitmap(this.FileName, this.PageIndex); // #region debug - write bitmap to file // //DrawingVisual drawingVisual = new DrawingVisual(); // //DrawingContext drawingContext = drawingVisual.RenderOpen(); // //drawingContext.DrawRectangle(new SolidColorBrush(Colors.Transparent), null, new System.Windows.Rect(0, 0, bitmapSource.PixelWidth, bitmapSource.PixelHeight)); // //drawingContext.Close(); // //m_MaskBitmapSource.Render(drawingVisual); // //System.Windows.Media.Imaging.PngBitmapEncoder encoder = new System.Windows.Media.Imaging.PngBitmapEncoder(); // //encoder.Frames.Add(System.Windows.Media.Imaging.BitmapFrame.Create(m_MaskBitmapSource)); // //using (System.IO.Stream s = System.IO.File.Create(string.Format(@"C:\Users\Yoav.Tiran\Desktop\Screenshots\b\t{0}.png", a.ToString()))) // //{ // // encoder.Save(s); // // a++; // //} // #endregion //} #endregion #region Public Methods public void Clear() { //order does matter.. MaskBitmapSource.Clear(); this.Rois.Clear(); this.RecognitionRois.Clear(); this.GoldenRois.Clear(); this.SelectedRois.Clear(); //will clear also subgroups }