예제 #1
0
        private async void CreateImagesFromDicom()
        {
            try
            {
                _fileNames = ReadFromFolder();

                await Task.Run(() =>
                {
                    double min = 0;
                    double max = 0;
                    Dispatcher.Invoke(() =>
                    {
                        min = SliderIntensity.RangeStart;
                        max = SliderIntensity.RangeEnd;
                        TextBoxLogs.AppendText("Processing, please wait...\r\n");
                    });
                    var images = _dcmManager.GrayscaleImagesFromDicom(_fileNames, min, max);

                    Dispatcher.Invoke(() =>
                    {
                        _arrayImages = images;
                    });
                });

                _currIndex = 0;
                TextBoxLogs.AppendText("Done!\r\n");
                Image.Source = _arrayImages[_currIndex].BitmapImage();
            }
            catch (Exception ex)
            {
                TextBoxLogs.Text = "Error:" + ex.Message + "\r\n";
            }
        }
예제 #2
0
 void WriteLog(string msg)
 {
     _serviceInfo.Logs += $"{msg}{Environment.NewLine}";
     Dispatcher.Invoke(() =>
     {
         TextBoxLogs.ScrollToEnd();
     });
 }
예제 #3
0
        private async void SaveToFolder()
        {
            try
            {
                var fileDialog = new SaveFileDialog
                {
                    FileName         = "Dicom 3d model",
                    DefaultExt       = ".xyz",
                    Filter           = @"XYZ Files |.xyz",
                    RestoreDirectory = true
                };

                if (fileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    var    name = "";
                    double min  = 0;
                    double max  = 0;

                    await Task.Run(() =>
                    {
                        Dispatcher.Invoke(() =>
                        {
                            min  = SliderIntensity.RangeStart;
                            max  = SliderIntensity.RangeEnd;
                            name = fileDialog.FileName;
                            TextBoxLogs.AppendText("Saving, please wait...\r\n");
                        });

                        _dcmManager.SaveToXyz(_arrayImages, min, max, name);
                    });

                    TextBoxLogs.AppendText("Done!\r\n");
                }
            }
            catch (Exception ex)
            {
                TextBoxLogs.Text = "Error: " + ex.Message;
            }
        }