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); } }
public void OnDicomElementsReceived(ReceivedDicomElements receivedDicomElements) { if (InvokeRequired) { Invoke(new DicomElementsReceivedHandler(OnDicomElementsReceived), new object[] { receivedDicomElements }); } else { try { if (receivedDicomElements.ImageStatus == ImageMemoryStatus.OpenedInWindow) { ShowElements(receivedDicomElements); } else { RefreshControl(); } } catch (Exception ex) { MessageBox.Show(Logging.Log(ex)); } } }
public StorageCommitmentForm(IDicomServiceWorkerUser dicomServiceWorkerUser, DicomServiceWorker dicomServiceWorker, ReceivedDicomElements receivedDicomElements) { InitializeComponent(); this.dicomServiceWorker = dicomServiceWorker; this.receivedDicomElements = receivedDicomElements; this.dicomServiceWorkerUser = dicomServiceWorkerUser; }
public ucDoseReport(ReceivedDicomElements receivedDicomElements) { InitializeComponent(); try { this.receivedDicomElements = receivedDicomElements; LoadTagList(receivedDicomElements.Elements); } catch (Exception ex) { lastError = ex.Message; } }
public ucTag(ReceivedDicomElements receivedDicomElements) { InitializeComponent(); try { tagTreeList.BeforeLabelEdit += OnBeforeLabelEdit; this.receivedDicomElements = receivedDicomElements; LoadTagList(receivedDicomElements.Elements); } catch (Exception ex) { lastError = ex.Message; } }
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); } }
public void OnDicomDirSaved(ReceivedDicomElements receivedDicomElements, string dicomDir) { if (InvokeRequired) { Invoke(new DicomDirSavedHandler(OnDicomDirSaved), new object[] { receivedDicomElements, dicomDir }); } else { try { LoadAllDicomDir(); } catch (Exception ex) { MessageBox.Show(Logging.Log(ex)); } } }
public ucTagAndImage(ReceivedDicomElements receivedDicomElements) { InitializeComponent(); this.receivedDicomElements = receivedDicomElements; try { SetPicture(null); LoadTagList(receivedDicomElements.Elements); var imageLoader = new ImageLoader(); var bitmap = imageLoader.LoadBitmap(receivedDicomElements.Elements); SetPicture(bitmap); } catch (Exception ex) { lastError = ex.Message; } }
public ucDircomDir(ReceivedDicomElements receivedDicomElements, IDicomServiceWorkerUser dicomServiceWorkerUser) { InitializeComponent(); tabControl_DicomDirFiles.DrawMode = TabDrawMode.OwnerDrawFixed; tabControl_DicomDirFiles.DrawItem += tabControl_DicomDirFiles_DrawItem; this.receivedDicomElements = receivedDicomElements; this.dicomServiceWorkerUser = dicomServiceWorkerUser; receivedDicomElements.FileName = (new FileInfo(receivedDicomElements.FileName)).DirectoryName; var dir = new DicomDir(receivedDicomElements.FileName); var rootNode = new TreeListNode { Text = "All Patients" }; treeListView_DicomDir.Nodes.Add(rootNode); FillElement(dir.Patients, rootNode); rootNode.ExpandAll(); }
private void ShowElements(ReceivedDicomElements receivedDicom, string inDicomDirPath) { var tabPage = new TabPage { Text = inDicomDirPath }; UserControl userControl; var modality = receivedDicom.Elements.GetSafeStringValue(t.Modality).ToUpper(); if (modality == "SR") { userControl = new ucDoseReport(receivedDicom) { Dock = DockStyle.Fill }; } else if (modality == "PR" || receivedDicom.ImageSource == ImageSource.StorageCommitment || receivedDicom.ImageSource == ImageSource.Mpps) { userControl = new ucTag(receivedDicom) { Dock = DockStyle.Fill }; } else { userControl = new ucTagAndImage(receivedDicom) { Dock = DockStyle.Fill }; } tabPage.Controls.Add(userControl); tabControl_DicomDirFiles.Controls.Add(tabPage); tabControl_DicomDirFiles.SelectTab(tabPage); }
public void ShowElements(ReceivedDicomElements receivedDicomElements) { var tabPage = GetTabPageByReceivedDicomElements(receivedDicomElements); if (tabPage != null) { tcDicomFiles.SelectTab(tabPage); return; } var modality = receivedDicomElements.Elements.GetSafeStringValue(t.Modality).ToUpper(); var title = receivedDicomElements.CallingAeTitle + " : " + receivedDicomElements.ImageSource + " "; if (string.IsNullOrEmpty(receivedDicomElements.FileName)) { title += receivedDicomElements.ReceivedDateTime.ToString("HH:mm:ss.fff"); } else { title += receivedDicomElements.FileName; } tabPage = new TabPage { Text = title }; UserControl userControl; if (receivedDicomElements.ImageSource == ImageSource.LocalDicomDir) { userControl = new ucDircomDir(receivedDicomElements, this) { Dock = DockStyle.Fill }; } else { if (modality == "SR") { userControl = new ucDoseReport(receivedDicomElements) { Dock = DockStyle.Fill }; } else if (modality == "PR" || receivedDicomElements.ImageSource == ImageSource.StorageCommitment || receivedDicomElements.ImageSource == ImageSource.Mpps) { userControl = new ucTag(receivedDicomElements) { Dock = DockStyle.Fill }; } else { userControl = new ucTagAndImage(receivedDicomElements) { Dock = DockStyle.Fill }; } } tabPage.Controls.Add(userControl); tcDicomFiles.Controls.Add(tabPage); tcDicomFiles.SelectTab(tabPage); receivedDicomElements.ImageStatus = ImageMemoryStatus.OpenedInWindow; RefreshControl(); var elementBase = userControl as IElementsBase; if (string.IsNullOrEmpty(elementBase.GetLastError())) { return; } throw new Exception(elementBase.GetLastError()); }
private TabPage GetTabPageByReceivedDicomElements(ReceivedDicomElements receivedDicomElements) { return(tcDicomFiles.TabPages.Cast <TabPage>().FirstOrDefault(tabPage => GetReceivedDicomElementsByTabPage(tabPage) == receivedDicomElements)); }