Пример #1
0
        public void LoadImageAndSaveAsJpg()
        {
            OpenFileDialog fd = new OpenFileDialog();

            fd.ShowDialog();

            string dcmImagePath = fd.FileName;

            var image = new DicomImage(dcmImagePath);

            string filePath = @"C:\Users\Kowal\Source\Repos\XrayAnalyser\XrayPhotoAnalyser\XrayPhotoAnalyser\Images\" + Guid.NewGuid() + ".jpg";

            image.RenderImage().Save(filePath);

            BitmapImage src = new BitmapImage();

            src.BeginInit();
            src.UriSource   = new Uri(filePath, UriKind.Absolute);
            src.CacheOption = BitmapCacheOption.OnLoad;
            src.EndInit();

            xrayBitmap = _bitmapConverter.BitmapImage2Bitmap(src);

            GlobalData.XrayBitmap = src;

            sourceImageBitmap = src;

            GlobalData.SavedJPGImagePath = filePath;
            LoadedImage = filePath;
        }
Пример #2
0
        public ChartsViewModel(IBitmapConverter bitmapConverter)
        {
            GenerateChartsCommand = new RelayCommand(GenerateCharts);
            horizontalBrightness  = new ObservableCollection <KeyValuePair <double, double> >();
            verticalBrightness    = new ObservableCollection <KeyValuePair <double, double> >();

            _bitmapoConverter = bitmapConverter;

            ImageBitmap = GlobalData.XrayBitmap;
            xrayBitmap  = _bitmapoConverter.BitmapImage2Bitmap(ImageBitmap);
        }