Esempio n. 1
0
        private void LoadFile(string fileName)
        {
            try
            {
                var elements   = OtherImageFormats.Read(fileName);
                var isDicomDir = elements.GetSafeStringValue(t.MediaStorageSOPClassUID) ==
                                 SOPClass.MediaStorageDirectoryStorage;

                var receivedDicom = new ReceivedDicomElements
                {
                    CallingAeTitle = "Localhost",
                    FileName       = fileName,
                    Elements       = elements,
                    ImageSource    = isDicomDir? ImageSource.LocalDicomDir : ImageSource.LocalDicomFile,
                    SavedToDisk    = true
                };

                ShowElements(receivedDicom);

                ShowMessage(fileName + " opened successfully!", false, false);
            }
            catch (Exception ex)
            {
                ShowMessage(fileName + " opened failed! " + ex.Message, true, true);
            }
        }
Esempio n. 2
0
        public Bitmap LoadBitmap(string fileName)
        {
            try
            {
                // we should either have a fileName or dataset
                if (fileName != null && fileName.Length > 0)
                {
                    Cursor.Current = Cursors.WaitCursor;
                    try
                    {
                        dicom = OtherImageFormats.Read(fileName);
                    }
                    finally
                    {
                        //SetStatus("");
                        Cursor.Current = Cursors.Default;
                    }
                }
                if (dicom == null)
                {
                    throw new ArgumentException("No fileName or dataset.");
                }

                return(LoadBitmap(dicom));
            }
            catch (Exception ex)
            {
                MessageBox.Show(Logging.Log(ex));
            }

            return(null);
        }
Esempio n. 3
0
        private void treeListView_DicomDir_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            if (treeListView_DicomDir.SelectedNodes.Count != 1)
            {
                return;
            }

            var fileId = treeListView_DicomDir.SelectedNodes[0].AdditionalData as Element;

            if (fileId == null)
            {
                return;
            }

            var filePath = fileId.Value as string[];

            if (filePath == null)
            {
                return;
            }

            var inDicomDirPath = filePath.Aggregate(string.Empty, (current, s) => current + ("\\" + s));
            var fullPath       = receivedDicomElements.FileName + inDicomDirPath;

            try
            {
                var elements      = OtherImageFormats.Read(fullPath);
                var receivedDicom = new ReceivedDicomElements
                {
                    CallingAeTitle = "Localhost",
                    FileName       = fullPath,
                    Elements       = elements,
                    ImageSource    = ImageSource.LocalDicomFile,
                    SavedToDisk    = true
                };

                ShowElements(receivedDicom, inDicomDirPath);

                dicomServiceWorkerUser.ShowMessage(fullPath + " opened successfully!", false, false);
            }
            catch (Exception ex)
            {
                dicomServiceWorkerUser.ShowMessage(fullPath + " opened failed! " + ex.Message, true, true);
            }
        }