Esempio n. 1
0
 void SetRecoloredModel()
 {
     VirtualSurgeon_CSWrapper.VirtualSurgeonImage im = m_vs_wrapper.getModelRecolored();
     if (im == null)
     {
         return;
     }
     SetModelSource(im);
 }
Esempio n. 2
0
 void SetCompleteModel()
 {
     VirtualSurgeon_CSWrapper.VirtualSurgeonImage im = m_vs_wrapper.getCompleteModel();
     if (im == null)
     {
         return;
     }
     SetModelSource(im);
 }
Esempio n. 3
0
 void SetOriginalModel()
 {
     VirtualSurgeon_CSWrapper.VirtualSurgeonImage im = m_vs_wrapper.getModelImage();
     if (im == null)
     {
         return;
     }
     SetModelSource(im);
     image2.Init();
 }
Esempio n. 4
0
        private void SetModelSource(VirtualSurgeon_CSWrapper.VirtualSurgeonImage im)
        {
            BitmapSource bs = BitmapSource.Create(
                im.width, im.height, 96, 96,
                System.Windows.Media.PixelFormats.Bgr24,
                null, im.buf, im.row_stride);

            Dispatcher.Invoke(
                (ExtractHeadDelegate) delegate(BitmapSource _bs)
            {
                image2.Source        = _bs;
                image2.UnderlayImage = _bs;
                image2.InvalidateVisual();
            },
                bs);
        }
Esempio n. 5
0
        private void SetMaskAsImage()
        {
            //display image
            VirtualSurgeon_CSWrapper.VirtualSurgeonImage i = m_vs_wrapper.getHeadMask();
            if (i == null)
            {
                return;
            }

            BitmapSource bs = BitmapSource.Create(
                i.width, i.height, 96, 96,
                System.Windows.Media.PixelFormats.Gray32Float,
                null, i.buf, i.row_stride);

            Dispatcher.Invoke(
                (ExtractHeadDelegate) delegate(BitmapSource _bs)
            {
                image1.Source = _bs;
            },
                bs);
        }
Esempio n. 6
0
        private BitmapSource SetOrigAsImage()
        {
            VirtualSurgeon_CSWrapper.VirtualSurgeonImage i = m_vs_wrapper.getOrigImage();
            if (i == null)
            {
                return(null);
            }

            BitmapSource bs = BitmapSource.Create(
                i.width, i.height, 96, 96,
                System.Windows.Media.PixelFormats.Bgr24,
                null, i.buf, i.row_stride);

            Dispatcher.Invoke(
                (ExtractHeadDelegate) delegate(BitmapSource _bs)
            {
                image1.UnderlayImage = _bs;
                image1.Init();
                image1.InvalidateVisual();
            },
                bs);
            return(bs);
        }
Esempio n. 7
0
        private void save_neck(object sender, RoutedEventArgs e)
        {
            Point[] ps = image1.points;
            Stream  s  = File.Open(
                image_filename.Substring(0, image_filename.LastIndexOf('.')) + ".points",
                FileMode.Create
                );
            StreamWriter sw = new StreamWriter(s);

            foreach (Point p in ps)
            {
                sw.WriteLine(p);
            }
            sw.Flush();
            sw.Close();

            FileStream stream = new FileStream(image_filename.Substring(0, image_filename.LastIndexOf('.')) + ".mask.bin",
                                               FileMode.OpenOrCreate, FileAccess.Write);

            //PngBitmapEncoder encoder = new PngBitmapEncoder();

            VirtualSurgeon_CSWrapper.VirtualSurgeonImage i = m_vs_wrapper.getHeadMask();
            if (i == null)
            {
                return;
            }

            BitmapSource bs = BitmapSource.Create(
                i.width, i.height, 96, 96,
                System.Windows.Media.PixelFormats.Gray32Float,
                null, i.buf, i.row_stride);

            //encoder.Frames.Add(BitmapFrame.Create(bs));
            //encoder.Save(stream);
            stream.Write(i.buf, 0, i.buf_size);
            stream.Close();
        }