private static void UncheckAllServers(ServerTree serverTree) { foreach (IServerTreeDicomServer server in serverTree.RootServerGroup.GetAllServers()) { server.IsChecked = false; } }
private static void SelectPriorsServers(ServerTreeComponent serverTreeComponent) { ServerTree serverTree = serverTreeComponent.ServerTree; var priorsServers = ServerDirectory.GetPriorsServers(false); CheckPriorsServers(serverTree, priorsServers); IServerTreeNode initialSelection = GetFirstPriorsServerOrGroup(serverTree.RootServerGroup); UncheckAllServers(serverTree); if (initialSelection == null) { if (serverTreeComponent.ShowLocalServerNode) { initialSelection = serverTreeComponent.ServerTree.LocalServer; } else { initialSelection = serverTreeComponent.ServerTree.RootServerGroup; } } serverTreeComponent.SetSelection(initialSelection); }
public static void AssertExampleTree(ServerTree tree) { Assert.IsNotNull(tree.LocalServer); Assert.IsNotNull(tree.RootServerGroup); Assert.AreEqual(1, tree.RootServerGroup.Servers.Count); Assert.AreEqual(1, tree.RootServerGroup.ChildGroups.Count); Assert.AreEqual(SR.ExampleServer, tree.RootServerGroup.Servers[0].Name); Assert.AreEqual(SR.ExampleGroup, tree.RootServerGroup.ChildGroups[0].Name); }
internal CatalogCacheManager(ServerTree oServerTree, string strCacheDir) { m_strCacheDir = Path.Combine(strCacheDir, "Dap Catalog Cache"); Directory.CreateDirectory(m_strCacheDir); #endif // Start the timer m_timer = new Timer(new TimerCallback(OnTimer), null, 0, (long)m_tsCleanupFrequency.TotalMilliseconds); m_oServerTree = oServerTree; }
private static void CheckPriorsServers(ServerTree serverTree, IList <IDicomServiceNode> priorsServers) { foreach (var server in serverTree.RootServerGroup.GetAllServers()) { var treeServer = server; if (priorsServers.Any(s => s.Name == treeServer.Name)) { server.IsChecked = true; } } }
public void TestToDicomServiceNodes_Local() { TestSettingsStore.Instance.Reset(); var tree = new ServerTree(null, null); tree.CurrentNode = tree.LocalServer; var serviceNodes = tree.CurrentNode.ToDicomServiceNodes(); Assert.AreEqual(1, serviceNodes.Count); var ae = serviceNodes.First(); Assert.AreEqual(@"<local>", ae.Name); Assert.AreEqual(string.Empty, ae.Location ?? ""); Assert.AreEqual("AETITLE", ae.AETitle); Assert.AreEqual("localhost", ae.ScpParameters.HostName); Assert.AreEqual(104, ae.ScpParameters.Port); Assert.IsNull(ae.StreamingParameters); }
public void TestToDicomServiceNodes_Local() { TestSettingsStore.Instance.Reset(); var tree = new ServerTree(null, null); tree.CurrentNode = tree.LocalServer; var serviceNodes = tree.CurrentNode.ToDicomServiceNodes(); Assert.AreEqual(1, serviceNodes.Count); var ae = serviceNodes.First(); Assert.AreEqual(Common.SR.LocalServerName, ae.Name); Assert.AreEqual(string.Empty, ae.Location ?? ""); Assert.AreEqual("AETITLE", ae.AETitle); Assert.AreEqual("localhost", ae.ScpParameters.HostName); Assert.AreEqual(104, ae.ScpParameters.Port); Assert.IsNull(ae.StreamingParameters); }
private static StudyItemList RetrieveAnnotationsInformationForStudy(string studyInstanceUID) { var queryParams = new QueryParameters(); queryParams.Add("PatientsName", ""); queryParams.Add("ReferringPhysiciansName", ""); queryParams.Add("PatientId", ""); queryParams.Add("AccessionNumber", ""); queryParams.Add("StudyDescription", ""); queryParams.Add("ModalitiesInStudy", "SR"); queryParams.Add("StudyDate", ""); queryParams.Add("StudyInstanceUid", studyInstanceUID); var serverTree = new ServerTree(); var failedServerInfo = new List <KeyValuePair <string, Exception> >(); var localDataStoreList = new List <IServerTreeNode>(); localDataStoreList.Add(serverTree.RootNode.LocalDataStoreNode); return(Query(queryParams, failedServerInfo, localDataStoreList)); }
// Called when a SOP Instance is imported into the local datastore private void OnSopInstanceImported(object sender, ItemEventArgs <ImportedSopInstanceInformation> e) { if (_sopInstanceUidToAeTitle.ContainsKey(e.Item.SopInstanceUid)) { var destinationAeTitle = _sopInstanceUidToAeTitle[e.Item.SopInstanceUid]; var destinationServer = FindAETitle(new ServerTree().RootNode.ServerGroupNode, destinationAeTitle); if (destinationServer == null) { Platform.Log(LogLevel.Error, "Study " + e.Item.SopInstanceUid + " cannot be send to server. Failed to find server infromation for AE Title " + destinationAeTitle + "."); } else { var storageScu = new StorageScu(ServerTree.GetClientAETitle(), destinationServer.AETitle, destinationServer.Host, destinationServer.Port); storageScu.ImageStoreCompleted += OnStoreEachInstanceCompleted; storageScu.AddFile(e.Item.SopInstanceFileName); storageScu.BeginSend(OnAnnotationSendComplete, storageScu); } lock (_mapLock) _sopInstanceUidToAeTitle.Remove(e.Item.SopInstanceUid); } }
public void PublishToServer() { AENavigatorComponent aeNavigator = new AENavigatorComponent(); aeNavigator.IsReadOnly = true; aeNavigator.ShowCheckBoxes = false; aeNavigator.ShowLocalDataStoreNode = false; aeNavigator.ShowTitlebar = false; aeNavigator.ShowTools = false; SimpleComponentContainer dialogContainer = new SimpleComponentContainer(aeNavigator); DialogBoxAction code = this.Host.DesktopWindow.ShowDialogBox(dialogContainer, SR.SelectDestination); if (code != DialogBoxAction.Ok) { return; } if (aeNavigator.SelectedServers == null || aeNavigator.SelectedServers.Servers == null || aeNavigator.SelectedServers.Servers.Count == 0) { return; } if (aeNavigator.SelectedServers.Servers.Count < 1) { return; } BackgroundTask task = new BackgroundTask( delegate { foreach (Server destinationAE in aeNavigator.SelectedServers.Servers) { _studyBuilder.Publish(ServerTree.GetClientAETitle(), destinationAE.AETitle, destinationAE.Host, destinationAE.Port); } }, false); ProgressDialog.Show(task, base.Host.DesktopWindow, true, ProgressBarStyle.Marquee); }
private static StudyItemList RetrieveAnnotationsForStudy(string studyInstanceUID) { QueryParameters queryParams = new QueryParameters(); queryParams.Add("PatientsName", ""); queryParams.Add("ReferringPhysiciansName", ""); queryParams.Add("PatientId", ""); queryParams.Add("AccessionNumber", ""); queryParams.Add("StudyDescription", ""); queryParams.Add("ModalitiesInStudy", "SR"); queryParams.Add("StudyDate", ""); queryParams.Add("StudyInstanceUid", studyInstanceUID); ServerTree serverTree = new ServerTree(); List <KeyValuePair <string, Exception> > failedServerInfo = new List <KeyValuePair <string, Exception> >(); List <IServerTreeNode> localDataStoreList = new List <IServerTreeNode>(); // TODO - retrieve annotations from remote host as well. Maybe, when streaming is in use only? localDataStoreList.Add(serverTree.RootNode.LocalDataStoreNode); return(Query(queryParams, failedServerInfo, localDataStoreList)); }
private static StudyItemList RetrieveAnnotationsInformationForStudy(string studyInstanceUID) { var queryParams = new QueryParameters(); queryParams.Add("PatientsName", ""); queryParams.Add("ReferringPhysiciansName", ""); queryParams.Add("PatientId", ""); queryParams.Add("AccessionNumber", ""); queryParams.Add("StudyDescription", ""); queryParams.Add("ModalitiesInStudy", "SR"); queryParams.Add("StudyDate", ""); queryParams.Add("StudyInstanceUid", studyInstanceUID); var serverTree = new ServerTree(); var failedServerInfo = new List<KeyValuePair<string, Exception>>(); var localDataStoreList = new List<IServerTreeNode>(); localDataStoreList.Add(serverTree.RootNode.LocalDataStoreNode); return Query(queryParams, failedServerInfo, localDataStoreList); }
// Note: you may change the name of the 'Apply' method as desired, but be sure to change the // corresponding parameter in the MenuAction and ButtonAction attributes /// <summary> /// Called by the framework when the user clicks the "apply" menu item or toolbar button. /// </summary> public void Apply() { // TODO: add code here to implement the functionality of the tool //|| this.Context.SelectedServerGroup.IsLocalDatastore if (!Enabled || this.Context.SelectedSingleSeries == null) { return; } //Dictionary<ApplicationEntity, List<StudyInformation>> retrieveInformation = new Dictionary<ApplicationEntity, List<StudyInformation>>(); List <string> seriesUIDs = new List <string>(); List <string> studyUIDs = new List <string>(); foreach (SeriesItem item in this.Context.SelectedMultipleSeries) { string foo = item.SeriesInstanceUID; Platform.Log(LogLevel.Info, foo); seriesUIDs.Add(item.SeriesInstanceUID); studyUIDs.Add(item.StudyInstanceUID); } string callingAE = ServerTree.GetClientAETitle(); BackgroundTask task = new BackgroundTask( delegate(IBackgroundTaskContext context) { // Send series level c-move //MyMoveScu moveScu = new MyMoveScu( //DicomMoveManager.MyMoveScu moveScu = new DicomMoveManager.MyMoveScu( MoveScuBase moveScu = new StudyRootMoveScu( callingAE, this.Context.SelectedServer.AETitle, this.Context.SelectedServer.Host, this.Context.SelectedServer.Port, callingAE); // Need to disable this line for the 1.5 version, because the movescu // code only allows one level per movescu request. This may not work with some // PACS moveScu.AddStudyInstanceUid(studyUIDs[0]); foreach (string seriesUID in seriesUIDs) { moveScu.AddSeriesInstanceUid(seriesUID); } moveScu.Move(); //moveScu.updated += delegate(object sender, EventArgs args) //{ // OnMoveUpdate(context, moveScu.completed, moveScu.total, moveScu.movestatus); // //context.ReportProgress(new BackgroundTaskProgress(moveScu.completed / moveScu.total, "Moving Study")); // //OnMoveUpdate(context, moveScu.completed, moveScu.total); //}; // += new EventHandler(OnMoveCompleted); moveScu.Dispose(); //OnMoveCompleted(); }, true); task.Run(); LocalDataStoreActivityMonitorComponentManager.ShowSendReceiveActivityComponent(this.Context.DesktopWindow); // //if (!retrieveInformation.ContainsKey(item.Server)) // // retrieveInformation[item.Server] = new List<StudyInformation>(); // //StudyInformation studyInformation = new StudyInformation(); // //studyInformation.PatientId = item.PatientId; // //studyInformation.PatientsName = item.PatientsName; // //DateTime studyDate; // //DateParser.Parse(item.StudyDate, out studyDate); // //studyInformation.StudyDate = studyDate; // //studyInformation.StudyDescription = item.StudyDescription; // //studyInformation.StudyInstanceUid = item.StudyInstanceUID; // //retrieveInformation[item.Server].Add(studyInformation); }
private static StudyItemList RetrieveAnnotationsInformationForStudy(string studyInstanceUID) { QueryParameters queryParams = new QueryParameters(); queryParams.Add("PatientsName", ""); queryParams.Add("ReferringPhysiciansName", ""); queryParams.Add("PatientId", ""); queryParams.Add("AccessionNumber", ""); queryParams.Add("StudyDescription", ""); queryParams.Add("ModalitiesInStudy", "SR"); queryParams.Add("StudyDate", ""); queryParams.Add("StudyInstanceUid", studyInstanceUID); ServerTree serverTree = new ServerTree(); List<KeyValuePair<string, Exception>> failedServerInfo = new List<KeyValuePair<string, Exception>>(); List<IServerTreeNode> localDataStoreList = new List<IServerTreeNode>(); // TODO - retrieve annotations from remote host as well. Maybe, when streaming is in use only? localDataStoreList.Add(serverTree.RootNode.LocalDataStoreNode); return Query(queryParams, failedServerInfo, localDataStoreList); }
/// <summary> /// Called by the framework when the user clicks the "apply" menu item or toolbar button. /// </summary> public void SeriesQuery() { string callingAE = ServerTree.GetClientAETitle(); List <SeriesItem> SeriesList = new List <SeriesItem>(); #region remote datastore // If remote data store, need to query server for series level information if (!this.Context.SelectedServerGroup.IsLocalDatastore) { // Loop through all selected servers foreach (Server node in this.Context.SelectedServerGroup.Servers) { DicomAttributeCollection dicomAttributeCollection = new DicomAttributeCollection(); // Query on "Series" Level dicomAttributeCollection[DicomTags.QueryRetrieveLevel].SetStringValue("SERIES"); string studyUID = this.Context.SelectedStudies[0].StudyInstanceUid; dicomAttributeCollection[DicomTags.StudyInstanceUid].SetStringValue(studyUID); dicomAttributeCollection[DicomTags.SeriesDescription].SetNullValue(); dicomAttributeCollection[DicomTags.SeriesInstanceUid].SetNullValue(); dicomAttributeCollection[DicomTags.SeriesNumber].SetNullValue(); dicomAttributeCollection[DicomTags.Modality].SetNullValue(); dicomAttributeCollection[DicomTags.Date].SetNullValue(); dicomAttributeCollection[DicomTags.Time].SetNullValue(); dicomAttributeCollection[DicomTags.RepetitionTime].SetNullValue(); IList <DicomAttributeCollection> resultsList; StudyRootFindScu findScu = new StudyRootFindScu(); List <string> seriesUIDs = new List <string>(); resultsList = findScu.Find( callingAE, node.AETitle, node.Host, node.Port, dicomAttributeCollection); findScu.CloseAssociation(); findScu.Dispose(); foreach (DicomAttributeCollection msg in resultsList) { string text = msg[DicomTags.SeriesInstanceUid]; Platform.Log(LogLevel.Info, text); SeriesItem series = new SeriesItem(); series.SeriesNumber = msg[DicomTags.SeriesNumber]; series.SeriesDescription = msg[DicomTags.SeriesDescription]; series.StudyInstanceUID = msg[DicomTags.StudyInstanceUid]; series.SeriesInstanceUID = msg[DicomTags.SeriesInstanceUid]; series.Modality = msg[DicomTags.Modality]; series.Date = msg[DicomTags.Date]; series.Time = msg[DicomTags.Time]; //series.NumberOfSeriesRelatedInstances = int.Parse(msg[DicomTags.NumberOfSeriesRelatedInstances].ToString()); SeriesList.Add(series); } _component = new SeriesBrowserComponent(SeriesList, node); _shelf = ApplicationComponent.LaunchAsShelf(this.Context.DesktopWindow, _component, "Series Browser", ShelfDisplayHint.DockBottom | ShelfDisplayHint.DockAutoHide); _shelf.Closed += Shelf_Closed; } } #endregion #region Local Datastore // If local datastore, can obtain series information by building study tree else { IImageViewer viewer = new ImageViewerComponent(); StudyTree studyTree = viewer.StudyTree; // Add selected objects studies to study tree foreach (StudyItem selectedstudy in this.Context.SelectedStudies) { string studyUID = selectedstudy.StudyInstanceUid; int numberOfSops = LocalStudyLoader.Start(new StudyLoaderArgs(studyUID, null)); for (int i = 0; i < numberOfSops; ++i) { Sop imageSop = LocalStudyLoader.LoadNextSop(); studyTree.AddSop(imageSop); } } foreach (Patient patient in studyTree.Patients) { foreach (Study study in patient.Studies) { foreach (Series series in study.Series) { SeriesItem seriesitem = new SeriesItem(); seriesitem.SeriesNumber = series.SeriesNumber.ToString(); seriesitem.SeriesDescription = series.SeriesDescription; seriesitem.StudyInstanceUID = study.StudyInstanceUid; seriesitem.SeriesInstanceUID = series.SeriesInstanceUid; seriesitem.Modality = series.Modality; seriesitem.Date = series.SeriesDate; seriesitem.Time = series.SeriesTime; //series.NumberOfSeriesRelatedInstances = int.Parse(msg[DicomTags.NumberOfSeriesRelatedInstances].ToString()); seriesitem.NumberOfSeriesRelatedInstances = series.Sops.Count.ToString(); SeriesList.Add(seriesitem); } _component = new SeriesBrowserComponent(SeriesList, null); _shelf = ApplicationComponent.LaunchAsShelf(this.Context.DesktopWindow, _component, DicomDataFormatHelper.PersonNameFormatter(patient.PatientsName), ShelfDisplayHint.DockBottom | ShelfDisplayHint.DockAutoHide); _shelf.Closed += Shelf_Closed; } } } #endregion }
/// <summary> /// Initializes a new instance of the CatalogCacheManager class. /// </summary> /// <param name="strCacheDir">Location of the cache files.</param> /// <remarks>Only files with extension .gz is managed and cleaned up</remarks> #if !DAPPLE internal CatalogCacheManager(ServerTree oServerTree) { // --- Create the cache manager --- GXNet.CSYS.IGetDirectory(GXNet.Constant.SYS_DIR_USER, ref m_strCacheDir); m_strCacheDir = Path.Combine(m_strCacheDir, "Dap Catalog Cache");