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


C# DicomDataset.GetDateTime方法代码示例

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


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

示例1: GetDateTime_DateAndTimeMissing_ReturnsMinimumDateTime

        public void GetDateTime_DateAndTimeMissing_ReturnsMinimumDateTime()
        {
            var expected = DateTime.MinValue;

            var dataset = new DicomDataset();
            var actual = dataset.GetDateTime(DicomTag.CreationDate, DicomTag.CreationTime);

            Assert.Equal(expected, actual);
        }
开发者ID:aerik,项目名称:fo-dicom,代码行数:9,代码来源:DicomDatasetExtensionsTest.cs

示例2: GetDateTime_DateAvaliableTimeMissing_ReturnsSpecifiedDateMinimumTime

        public void GetDateTime_DateAvaliableTimeMissing_ReturnsSpecifiedDateMinimumTime()
        {
            var expected = new DateTime(2016, 5, 25, DateTime.MinValue.Hour, DateTime.MinValue.Minute, DateTime.MinValue.Second);

            var dataset = new DicomDataset(
                new DicomDate(DicomTag.CreationDate, "20160525"));
            var actual = dataset.GetDateTime(DicomTag.CreationDate, DicomTag.CreationTime);

            Assert.Equal(expected, actual);
        }
开发者ID:aerik,项目名称:fo-dicom,代码行数:10,代码来源:DicomDatasetExtensionsTest.cs

示例3: GetDateTime_DateMissingTimeAvailable_ReturnsMinimumDateSpecifiedTime

        public void GetDateTime_DateMissingTimeAvailable_ReturnsMinimumDateSpecifiedTime()
        {
            var expected = new DateTime(DateTime.MinValue.Year, DateTime.MinValue.Month, DateTime.MinValue.Day, 16, 2, 15);

            var dataset = new DicomDataset(
                new DicomTime(DicomTag.CreationTime, "160215"));
            var actual = dataset.GetDateTime(DicomTag.CreationDate, DicomTag.CreationTime);

            Assert.Equal(expected, actual);
        }
开发者ID:aerik,项目名称:fo-dicom,代码行数:10,代码来源:DicomDatasetExtensionsTest.cs

示例4: GetDateTime_DateAndTimeAvailable_ReturnsSpecifiedDateTime

        public void GetDateTime_DateAndTimeAvailable_ReturnsSpecifiedDateTime()
        {
            var expected = new DateTime(2016, 5, 25, 15, 54, 31);

            var dataset = new DicomDataset(
                new DicomDate(DicomTag.CreationDate, "20160525"),
                new DicomTime(DicomTag.CreationTime, "155431"));
            var actual = dataset.GetDateTime(DicomTag.CreationDate, DicomTag.CreationTime);

            Assert.Equal(expected, actual);
        }
开发者ID:aerik,项目名称:fo-dicom,代码行数:11,代码来源:DicomDatasetExtensionsTest.cs

示例5: StoreImage

        void StoreImage(DicomDataset ds, string modality)
        {
            DicomImage di = new DicomImage(ds);

            // store in cached resource
            var idc = new ImageDataContract();
            idc.PatientId = ds.Get<string>(DicomTag.PatientID);

            if (ds.Contains(DicomTag.PixelSpacing))
            {
                idc.PixelSpacing = new VoxelSize()
                {
                    X = Convert.ToSingle(ds.Get<double>(DicomTag.PixelSpacing, 0)),
                    Y = Convert.ToSingle(ds.Get<double>(DicomTag.PixelSpacing, 1)),
                };
            }
            else
            {
                idc.PixelSpacing = new VoxelSize() 
                { 
                    X = 1.0f, 
                    Y = 1.0f, 
                };
            }

            idc.ImagePosition = new ImagePosition()
            {
                X = Convert.ToSingle(ds.Get<double>(DicomTag.ImagePositionPatient, 0)),
                Y = Convert.ToSingle(ds.Get<double>(DicomTag.ImagePositionPatient, 1)),
                Z = Convert.ToSingle(ds.Get<double>(DicomTag.ImagePositionPatient, 2)),
            };

            idc.ImageOrientation = new ImageOrientation();
            idc.ImageOrientation.Row = new DirectionCosine()
            {
                X = Convert.ToSingle(ds.Get<double>(DicomTag.ImageOrientationPatient, 0)),
                Y = Convert.ToSingle(ds.Get<double>(DicomTag.ImageOrientationPatient, 1)),
                Z = Convert.ToSingle(ds.Get<double>(DicomTag.ImageOrientationPatient, 2)),
            };

            idc.ImageOrientation.Column = new DirectionCosine()
            {
                X = Convert.ToSingle(ds.Get<double>(DicomTag.ImageOrientationPatient, 3)),
                Y = Convert.ToSingle(ds.Get<double>(DicomTag.ImageOrientationPatient, 4)),
                Z = Convert.ToSingle(ds.Get<double>(DicomTag.ImageOrientationPatient, 5)),
            };

            idc.Width = di.Width;
            idc.Height = di.Height;
            idc.Label = string.Format("{0} {1}",
                modality,
                ds.GetDateTime(DicomTag.SeriesDate, DicomTag.SeriesTime).ToString());
            idc.SeriesInstanceUID = ds.Get<string>(DicomTag.SeriesInstanceUID);

            // store for association closed event
            _seriesInstanceUIDs.Add(idc.SeriesInstanceUID);

            string for_uid = ds.Get<string>(DicomTag.FrameOfReferenceUID);
            idc.FrameOfReferenceUID = for_uid;

            LocalImageResourceManagerClient
                cache1 = new LocalImageResourceManagerClient();

            idc = cache1.AddImage(idc);
            double repoGb = cache1.GetRepositorySizeGB();

            cache1.Close();

            if (di.PhotometricInterpretation == PhotometricInterpretation.Monochrome1
                || di.PhotometricInterpretation == PhotometricInterpretation.Monochrome2)
            {
                var dsForWl = di.Dataset;
                if (_firstImageIn.ContainsKey(idc.SeriesInstanceUID))
                {
                    dsForWl = _firstImageIn[idc.SeriesInstanceUID].Dataset;
                }
                else
                {
                    _firstImageIn.TryAdd(idc.SeriesInstanceUID, di);
                }

                var gro = GrayscaleRenderOptions.FromDataset(dsForWl);
                var voilut = VOILUT.Create(gro);

                var ipd = PixelDataFactory.Create(di.PixelData, 0);

                int[] outPixelsInt = new int[di.Width * di.Height];
                ipd.Render(voilut, outPixelsInt);

                ushort[] outPixelsUshort = Array.ConvertAll(outPixelsInt,
                    new Converter<int, ushort>(inInt => (ushort)(inInt)));
                var handle = idc.PixelBuffer.GetHandle();
                handle.WriteArray<ushort>(0, outPixelsUshort, 0, outPixelsUshort.Length);
                idc.PixelBuffer.ReleaseHandle();
                idc.PixelBuffer.CloseMapping();

                // inform of found image
                ImageResponseClient proxy = ImageResponseClient.CreateProxy();
                proxy.OnImageStored(idc.ImageId, repoGb);
                proxy.Close();
//.........这里部分代码省略.........
开发者ID:dg1an3,项目名称:PheonixRt.Mvvm,代码行数:101,代码来源:DicomScanManager.cs

示例6: GetAcquisitionTime

        /// <summary>
        /// Gets the acquisition time.
        /// </summary>
        /// <param name="currentDataSet">The current Dicom data set.</param>
        /// <returns></returns>
        private static string GetAcquisitionTime(DicomDataset currentDataSet)
        {
            var acquisitionDate = currentDataSet.GetDateTime(DicomTag.AcquisitionDate, DicomTag.AcquisitionTime);
            var acquisitionTime = currentDataSet.GetDateTime(DicomTag.AcquisitionDate, DicomTag.AcquisitionTime);
            var date = acquisitionDate.ToString("dd-MMM-yyyy");
            var time = acquisitionTime.ToString("HH:mm:ss");

            return String.Format("{0} {1}", date, time);
        }
开发者ID:GMZ,项目名称:fo-dicom,代码行数:14,代码来源:AnnotationText.cs


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