Exemple #1
0
        private void FrameSelector_ValueChanged(object sender, RoutedPropertyChangedEventArgs <double> e)
        {
            var idx = (uint)FrameSelector.Value;

            DrawImages(idx);
            DrawEcg(m_source.GetFrameTimes()[idx]);
        }
Exemple #2
0
        private void FileOpenBtn_Click(object sender, RoutedEventArgs e)
        {
            Debug.Assert(m_loader != null);

            Image3dError err_type;
            string       err_msg;

            m_loader.LoadFile(FileName.Text, out err_type, out err_msg);
            if ((err_type != Image3dError.Image3d_SUCCESS))
            {
                string message;
                switch (err_type)
                {
                case Image3dError.Image3d_ACCESS_FAILURE:
                    message = "Unable to open the file. The file might be missing or locked.";
                    break;

                case Image3dError.Image3d_VALIDATION_FAILURE:
                    message = "Unsupported file. Probably due to unsupported vendor or modality.";
                    break;

                case Image3dError.Image3d_NOT_YET_SUPPORTED:
                    message = "The loader is too old to parse the file.";
                    break;

                case Image3dError.Image3d_SUPPORT_DISCONTINUED:
                    message = "The the file version is no longer supported (pre-DICOM format?).";
                    break;

                default:
                    message = "Unknown error";
                    break;
                }
                MessageBox.Show(message + ": " + err_msg);
                return;
            }
            m_source = m_loader.GetImageSource();

            FrameSelector.Minimum   = 0;
            FrameSelector.Maximum   = m_source.GetFrameCount() - 1;
            FrameSelector.IsEnabled = true;
            FrameSelector.Value     = 0;

            FrameCount.Text  = "Frame count: " + m_source.GetFrameCount();
            ProbeInfo.Text   = "Probe name: " + m_source.GetProbeInfo().name;
            InstanceUID.Text = "UID: " + m_source.GetSopInstanceUID();

            DrawImages(0);
            DrawEcg(m_source.GetFrameTimes()[0]);
        }
        private void FileOpenBtn_Click(object sender, RoutedEventArgs e)
        {
            Debug.Assert(m_loader != null);

            Image3dError err_type = Image3dError.Image3d_SUCCESS;
            string       err_msg  = "";

            try {
                m_loader.LoadFile(FileName.Text, out err_type, out err_msg);
            } catch (Exception) {
                // NOTE: err_msg does not seem to be marshaled back on LoadFile failure in .Net.
                // NOTE: This problem is limited to .Net, and does not occur in C++

                string message = "Unknown error";
                if ((err_type != Image3dError.Image3d_SUCCESS))
                {
                    switch (err_type)
                    {
                    case Image3dError.Image3d_ACCESS_FAILURE:
                        message = "Unable to open the file. The file might be missing or locked.";
                        break;

                    case Image3dError.Image3d_VALIDATION_FAILURE:
                        message = "Unsupported file. Probably due to unsupported vendor or modality.";
                        break;

                    case Image3dError.Image3d_NOT_YET_SUPPORTED:
                        message = "The loader is too old to parse the file.";
                        break;

                    case Image3dError.Image3d_SUPPORT_DISCONTINUED:
                        message = "The the file version is no longer supported (pre-DICOM format?).";
                        break;
                    }
                }
                MessageBox.Show("LoadFile error: " + message + " (" + err_msg + ")");
                return;
            }

            try {
                if (m_source != null)
                {
                    Marshal.ReleaseComObject(m_source);
                }
                m_source = m_loader.GetImageSource();
            } catch (Exception err) {
                MessageBox.Show("ERROR: " + err.Message, "GetImageSource error");
                return;
            }

            FrameSelector.Minimum   = 0;
            FrameSelector.Maximum   = m_source.GetFrameCount() - 1;
            FrameSelector.IsEnabled = true;
            FrameSelector.Value     = 0;

            FrameCount.Text  = "Frame count: " + m_source.GetFrameCount();
            ProbeInfo.Text   = "Probe name: " + m_source.GetProbeInfo().name;
            InstanceUID.Text = "UID: " + m_source.GetSopInstanceUID();

            DrawImages(0);
            DrawEcg(m_source.GetFrameTimes()[0]);
        }