当前位置: 首页>>代码示例>>C#>>正文


C# DcmDataset.Dump方法代码示例

本文整理汇总了C#中Dicom.Data.DcmDataset.Dump方法的典型用法代码示例。如果您正苦于以下问题:C# DcmDataset.Dump方法的具体用法?C# DcmDataset.Dump怎么用?C# DcmDataset.Dump使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Dicom.Data.DcmDataset的用法示例。


在下文中一共展示了DcmDataset.Dump方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnReceiveCMoveRequest

        protected override void OnReceiveCMoveRequest(byte presentationID, ushort messageID, string destinationAE, DcmPriority priority, DcmDataset query)
        {
            Console.WriteLine(String.Format("{0} Receive C-Move from {1} (marked as anonymous:{2})", DateTime.Now, this.Associate.CallingAE, _flagAnonymousAccess));
            Debug.WriteLine(query.Dump());

            AEInfo recipientInfo = FindAE(destinationAE);

            if (recipientInfo == null)
            {
                SendCMoveResponse(presentationID, messageID, DcmStatus.QueryRetrieveMoveDestinationUnknown, 0, 0, 0, 0);
                Console.Write("Moving to:" + recipientInfo.Name + "> ");

                return;
            }

            Console.Write("Moving to:" + recipientInfo.Name + "> ");

            ushort imagesProcessed = 0;
            ushort errorCount = 0;
            ushort successCount = 0;

            try
            {

                using (var database = new MedicalISDataContext())
                {
                    var storeClient = new CStoreClient();
                    storeClient.CallingAE = "CURAPACS";
                    storeClient.CalledAE = destinationAE;
                    storeClient.PreferredTransferSyntax = recipientInfo.TransferSyntax;
                    storeClient.PreloadCount = 10;
                    storeClient.LogID = "store";

                    if (Settings.Default.DebugMove)
                    Dicom.Debug.InitializeConsoleDebugLogger();

                    if (_flagAnonymousAccess)
                        storeClient.DisableFileStreaming = true;

                    var files = GetFilePaths(database, query);

                    if (Settings.Default.UseFixedFolder)
                    {
                        files = Directory.GetFiles(Settings.Default.FixedFolderPath);
                    }

                    long totalSize = 0;

                    foreach (var f in files)
                    {
                        totalSize += new FileInfo(f).Length;
                        storeClient.AddFile(f);
                    }

                    int totalImageCount = (ushort) files.Count();

                    Console.Write("#{0} files > ", totalImageCount);

                    Stopwatch timer = Stopwatch.StartNew();

                    storeClient.OnCStoreRequestBegin = (c, i) =>
                                                           {
                                                               if (_flagAnonymousAccess)
                                                               {
                                                                   var dataset = i.Dataset;

                                                                   AnonymizeDatasetBasedOnStudyInfo(dataset);
                                                               }
                                                           };

                    storeClient.OnCStoreRequestComplete = (c, i) =>
                                                                {
                                                                  timer.Stop();

                                                                  if (i.HasError)
                                                                  {
                                                                      Console.WriteLine("Error:{0}", i.Error);
                                                                  }
                                                                  else
                                                                  {
                                                                  //    Console.WriteLine("Done");
                                                                  }

                                                                  totalImageCount -= storeClient.PendingCount;
                                                              };

                    storeClient.OnCStoreResponseReceived = (c, i) =>
                                                               {

                                                                   if (i.Status == DcmStatus.Success)
                                                                   {
                                                                       successCount++;
                                                                       Console.Write(".");
                                                                   }
                                                                   else
                                                                   {
                                                                       errorCount++;
                                                                       Console.Write("x");
                                                                   }

//.........这里部分代码省略.........
开发者ID:curasystems,项目名称:dicomserver,代码行数:101,代码来源:CImageServer.cs

示例2: OnReceiveCFindRequest

        protected override void OnReceiveCFindRequest(byte presentationID, ushort messageID, DcmPriority priority, Dicom.Data.DcmDataset query)
        {
            TryInterpretStringsInDatasetUsingCorrectEncoding(query);

            Trace.WriteLine(String.Format("{0} Receive C-Find from {1} (marked as anonymous:{2})", DateTime.Now, this.Associate.CallingAE, _flagAnonymousAccess));
            Trace.WriteLine(query.Dump());

               using( var database = new MedicalISDataContext() )
            {
                var queryLevel = query.GetString(DicomTags.QueryRetrieveLevel, null);

                if (queryLevel == "PATIENT")
                {
                    IQueryable<Patient> patients = PatientQueries.GetMatchingPatients(database, query, _flagAnonymousAccess);

                    patients = patients.Take(Settings.Default.MaxNumberOfStudiesReturned);

                    foreach (var currentPatient in patients)
                    {
                        foreach (var currentStudy in currentPatient.Studies)
                        {
                            var p = currentPatient;

                            var response = new DcmDataset
                            {
                                SpecificCharacterSetEncoding = query.SpecificCharacterSetEncoding
                            };

                            // Map saved study tags to output

                            response.AddElementWithValue(DicomTags.RetrieveAETitle, "CURAPACS");
                            response.AddElementWithValue(DicomTags.QueryRetrieveLevel, "PATIENT");

                            response.AddElementWithValue(DicomTags.PatientID, p.ExternalPatientID);
                            response.AddElementWithValue(DicomTags.PatientsName, p.LastName + "^" + p.FirstName);
                            response.AddElementWithValue(DicomTags.PatientsBirthDate, p.BirthDateTime.Value);

                            response.AddElementWithValue(DicomTags.StudyInstanceUID, currentStudy.StudyInstanceUid);
                            response.AddElementWithValue(DicomTags.AccessionNumber, currentStudy.AccessionNumber);
                            response.AddElementWithValue(DicomTags.StudyDescription, currentStudy.Description);
                            response.AddElementWithValue(DicomTags.ModalitiesInStudy, currentStudy.ModalityAggregation);

                            if (currentStudy.PerformedDateTime.HasValue)
                            {
                                response.AddElementWithValue(DicomTags.StudyDate, currentStudy.PerformedDateTime.Value);
                                response.AddElementWithValue(DicomTags.StudyTime, currentStudy.PerformedDateTime.Value);
                            }

                            response.AddElementWithValue(DicomTags.NumberOfStudyRelatedSeries, currentStudy.Series.Count);
                            response.AddElementWithValue(DicomTags.NumberOfStudyRelatedInstances, (from s in currentStudy.Series select s.Images.Count).Sum());

                            if (_flagAnonymousAccess)
                                AnonymizeDatasetBasedOnStudyInfo(response);

                            SendCFindResponse(presentationID, messageID, response, DcmStatus.Pending);
                        }
                    }
                }
                else if (queryLevel == "STUDY")
                {
                    IQueryable<Study> studies = StudyQueries.GetMatchingStudies(database, query, _flagAnonymousAccess);

                    studies = studies.Take(Settings.Default.MaxNumberOfStudiesReturned);

                    foreach (var currentStudy in studies)
                    {
                        var p = currentStudy.Patient;

                        var response = new DcmDataset
                                           {
                                               SpecificCharacterSetEncoding = query.SpecificCharacterSetEncoding
                                           };

                        // Map saved study tags to output

                        response.AddElementWithValue(DicomTags.RetrieveAETitle, "CURAPACS");
                        response.AddElementWithValue(DicomTags.QueryRetrieveLevel, "STUDY");

                        response.AddElementWithValue(DicomTags.PatientID, p.ExternalPatientID);
                        response.AddElementWithValue(DicomTags.PatientsName, p.LastName + "^" + p.FirstName);
                        response.AddElementWithValue(DicomTags.PatientsBirthDate, p.BirthDateTime.Value);

                        response.AddElementWithValue(DicomTags.StudyInstanceUID, currentStudy.StudyInstanceUid);
                        response.AddElementWithValue(DicomTags.AccessionNumber, currentStudy.AccessionNumber);
                        response.AddElementWithValue(DicomTags.StudyDescription, currentStudy.Description);
                        response.AddElementWithValue(DicomTags.ModalitiesInStudy, currentStudy.ModalityAggregation);

                        if (currentStudy.PerformedDateTime.HasValue)
                        {
                            response.AddElementWithValue(DicomTags.StudyDate, currentStudy.PerformedDateTime.Value);
                            response.AddElementWithValue(DicomTags.StudyTime, currentStudy.PerformedDateTime.Value);
                        }

                        response.AddElementWithValue(DicomTags.NumberOfStudyRelatedSeries, currentStudy.Series.Count);
                        response.AddElementWithValue(DicomTags.NumberOfStudyRelatedInstances, (from s in currentStudy.Series select s.Images.Count).Sum());

                        if (! String.IsNullOrEmpty(query.GetString(DicomTags.PatientsSex, null)))
                        {
                            response.AddElementWithValue(DicomTags.PatientsSex, Settings.Default.AlwaysRespondWithGender);
                        }
//.........这里部分代码省略.........
开发者ID:curasystems,项目名称:dicomserver,代码行数:101,代码来源:CImageServer.cs


注:本文中的Dicom.Data.DcmDataset.Dump方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。