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


C# DicomDataset类代码示例

本文整理汇总了C#中DicomDataset的典型用法代码示例。如果您正苦于以下问题:C# DicomDataset类的具体用法?C# DicomDataset怎么用?C# DicomDataset使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: FromDataset

 public static BitDepth FromDataset(DicomDataset dataset)
 {
     var allocated = dataset.Get<ushort>(DicomTag.BitsAllocated);
     var stored = dataset.Get<ushort>(DicomTag.BitsStored);
     var signed = dataset.Get<PixelRepresentation>(DicomTag.PixelRepresentation) == PixelRepresentation.Signed;
     return new BitDepth(allocated, stored, GetHighBit(stored, signed), signed);
 }
开发者ID:jwake,项目名称:fo-dicom,代码行数:7,代码来源:BitDepth.cs

示例2: FromWindowLevel_ValidInput_CorrectOutput

        public void FromWindowLevel_ValidInput_CorrectOutput(
            ushort bitsAllocated,
            ushort bitsStored,
            ushort pixelRepresentation,
            double rescaleSlope,
            double rescaleIntercept,
            double windowWidth,
            double windowCenter,
            string voiLutFunction)
        {
            var dataset = new DicomDataset(
                new DicomUnsignedShort(DicomTag.BitsAllocated, bitsAllocated),
                new DicomUnsignedShort(DicomTag.BitsStored, bitsStored),
                new DicomUnsignedShort(DicomTag.PixelRepresentation, pixelRepresentation),
                new DicomDecimalString(DicomTag.RescaleSlope, (decimal)rescaleSlope),
                new DicomDecimalString(DicomTag.RescaleIntercept, (decimal)rescaleIntercept),
                new DicomDecimalString(DicomTag.WindowWidth, (decimal)windowWidth),
                new DicomDecimalString(DicomTag.WindowCenter, (decimal)windowCenter),
                new DicomCodeString(DicomTag.VOILUTFunction, voiLutFunction));

            var actual = GrayscaleRenderOptions.FromWindowLevel(dataset);

            Assert.Equal(windowWidth, actual.WindowWidth);
            Assert.Equal(windowCenter, actual.WindowCenter);
        }
开发者ID:gustavosaita,项目名称:fo-dicom,代码行数:25,代码来源:GrayscaleRenderOptionsTest.cs

示例3: Add_UniversalResourceElement_Succeeds

 public void Add_UniversalResourceElement_Succeeds()
 {
     var dataset = new DicomDataset();
     dataset.Add(DicomTag.URNCodeValue, "abc");
     Assert.IsType(typeof(DicomUniversalResource), dataset.First());
     Assert.Equal("abc", dataset.Get<string>(DicomTag.URNCodeValue));
 }
开发者ID:dremerdt,项目名称:fo-dicom,代码行数:7,代码来源:DicomDatasetTest.cs

示例4: FromDataset_WindowCenterWidth_ReturnsSameAsFromWindowLevel

        public void FromDataset_WindowCenterWidth_ReturnsSameAsFromWindowLevel(
            ushort bitsAllocated,
            ushort bitsStored,
            ushort pixelRepresentation,
            double rescaleSlope,
            double rescaleIntercept,
            double windowWidth,
            double windowCenter,
            string voiLutFunction)
        {
            var dataset = new DicomDataset(
                new DicomCodeString(DicomTag.PhotometricInterpretation, "MONOCHROME1"),
                new DicomUnsignedShort(DicomTag.BitsAllocated, bitsAllocated),
                new DicomUnsignedShort(DicomTag.BitsStored, bitsStored),
                new DicomUnsignedShort(DicomTag.PixelRepresentation, pixelRepresentation),
                new DicomDecimalString(DicomTag.RescaleSlope, (decimal)rescaleSlope),
                new DicomDecimalString(DicomTag.RescaleIntercept, (decimal)rescaleIntercept),
                new DicomDecimalString(DicomTag.WindowWidth, (decimal)windowWidth),
                new DicomDecimalString(DicomTag.WindowCenter, (decimal)windowCenter),
                new DicomCodeString(DicomTag.VOILUTFunction, voiLutFunction));

            var expected = GrayscaleRenderOptions.FromWindowLevel(dataset);
            var actual = GrayscaleRenderOptions.FromDataset(dataset);

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

示例5: Add_OtherDoubleElementWithMultipleDoubles_Succeeds

 public void Add_OtherDoubleElementWithMultipleDoubles_Succeeds()
 {
     var dataset = new DicomDataset();
     dataset.Add(DicomTag.DoubleFloatPixelData, 3.45, 6.78, 9.01);
     Assert.IsType(typeof(DicomOtherDouble), dataset.First());
     Assert.Equal(3, dataset.Get<double[]>(DicomTag.DoubleFloatPixelData).Length);
 }
开发者ID:dremerdt,项目名称:fo-dicom,代码行数:7,代码来源:DicomDatasetTest.cs

示例6: DicomFile

 public DicomFile()
 {
     FileMetaInfo = new DicomFileMetaInformation();
     Dataset = new DicomDataset();
     Format = DicomFileFormat.DICOM3;
     IsPartial = false;
 }
开发者ID:aerik,项目名称:fo-dicom,代码行数:7,代码来源:DicomFile.cs

示例7: FromBitmap

        /// <summary>
        /// Creates a DICOM overlay from a GDI+ Bitmap.
        /// </summary>
        /// <param name="ds">Dataset</param>
        /// <param name="bitmap">Bitmap</param>
        /// <param name="mask">Color mask for overlay</param>
        /// <returns>DICOM overlay</returns>
        public static DicomOverlayData FromBitmap(DicomDataset ds, Bitmap bitmap, Color mask)
        {
            ushort group = 0x6000;
            while (ds.Contains(new DicomTag(group, DicomTag.OverlayBitPosition.Element))) group += 2;

            var overlay = new DicomOverlayData(ds, group)
                              {
                                  Type = DicomOverlayType.Graphics,
                                  Rows = bitmap.Height,
                                  Columns = bitmap.Width,
                                  OriginX = 1,
                                  OriginY = 1,
                                  BitsAllocated = 1,
                                  BitPosition = 1
                              };

            var array = new BitList { Capacity = overlay.Rows * overlay.Columns };

            int p = 0;
            for (var y = 0; y < bitmap.Height; y++)
            {
                for (var x = 0; x < bitmap.Width; x++, p++)
                {
                    if (bitmap.GetPixel(x, y).ToArgb() == mask.ToArgb()) array[p] = true;
                }
            }

            overlay.Data = EvenLengthBuffer.Create(new MemoryByteBuffer(array.Array));

            return overlay;
        }
开发者ID:gustavosaita,项目名称:fo-dicom,代码行数:38,代码来源:DicomOverlayDataFactory.cs

示例8: DicomFileMetaInformation

 public DicomFileMetaInformation(DicomDataset dataset)
     : this()
 {
     MediaStorageSOPClassUID = dataset.Get<DicomUID>(DicomTag.SOPClassUID);
     MediaStorageSOPInstanceUID = dataset.Get<DicomUID>(DicomTag.SOPInstanceUID);
     TransferSyntax = dataset.InternalTransferSyntax;
 }
开发者ID:gustavosaita,项目名称:fo-dicom,代码行数:7,代码来源:DicomFileMetaInformation.cs

示例9: Contains_PrivateTag_SufficientlyFound

 public void Contains_PrivateTag_SufficientlyFound()
 {
     var dataset = new DicomDataset();
     dataset.Add(new DicomTag(0x0021, 0x0010, "TEST"), "TEST");
     var found = dataset.Contains(new DicomTag(0x0021, 0x0010, "TEST"));
     Assert.True(found);
 }
开发者ID:aerik,项目名称:fo-dicom,代码行数:7,代码来源:GH319.cs

示例10: Add_OtherDoubleElement_Succeeds

 public void Add_OtherDoubleElement_Succeeds()
 {
     var tag = DicomTag.DoubleFloatPixelData;
     var dataset = new DicomDataset();
     dataset.Add(tag, 3.45);
     Assert.IsType<DicomOtherDouble>(dataset.First(item => item.Tag.Equals(tag)));
 }
开发者ID:gustavosaita,项目名称:fo-dicom,代码行数:7,代码来源:DicomDatasetTest.cs

示例11: Transform

		public void Transform(DicomDataset dataset, DicomDataset modifiedAttributesSequenceItem = null) {
			var remove = dataset.EnumerateMasked(_mask).Select(x => x.Tag).ToList();
			foreach (DicomTag tag in remove) {
				dataset.CopyTo(modifiedAttributesSequenceItem, tag);
				dataset.Remove(tag);
			}
		}
开发者ID:ZeryZhang,项目名称:fo-dicom,代码行数:7,代码来源:DicomTransformRules.cs

示例12: Add_UnlimitedCharactersElementWithMultipleStrings_Succeeds

 public void Add_UnlimitedCharactersElementWithMultipleStrings_Succeeds()
 {
     var dataset = new DicomDataset();
     dataset.Add(DicomTag.LongCodeValue, "a", "b", "c");
     Assert.IsType(typeof(DicomUnlimitedCharacters), dataset.First());
     Assert.Equal("c", dataset.Get<string>(DicomTag.LongCodeValue, 2));
 }
开发者ID:dremerdt,项目名称:fo-dicom,代码行数:7,代码来源:DicomDatasetTest.cs

示例13: SerializeAndDeserializePrivateTags

        public void SerializeAndDeserializePrivateTags()
        {
            var privCreatorDictEntry = new DicomDictionaryEntry(new DicomTag(0x0011, 0x0010), "Private Creator", "PrivateCreator", DicomVM.VM_1, false, DicomVR.LO);
            DicomDictionary.Default.Add(privCreatorDictEntry);

            DicomPrivateCreator privateCreator1 = DicomDictionary.Default.GetPrivateCreator("TESTCREATOR1");
            DicomDictionary privDict1 = DicomDictionary.Default[privateCreator1];

            var dictEntry = new DicomDictionaryEntry(DicomMaskedTag.Parse("0011", "xx01"), "TestPrivTagName", "TestPrivTagKeyword", DicomVM.VM_1, false, DicomVR.CS);
            privDict1.Add(dictEntry);

            var ds = new DicomDataset();
            ds.Add(dictEntry.Tag, "VAL1");
            ds.Add(DicomTag.SOPClassUID, DicomUID.CTImageStorage);
            ds.Add(DicomTag.SOPInstanceUID, "2.25.123");
            Assert.Equal(DicomVR.CS, ds.Get<DicomVR>(dictEntry.Tag));

            var bytes = SerializeDicom_(ds);

            File.OpenWrite("C:\\Temp\\x.dcm").Write(bytes, 0, bytes.Length);

            var ds2 = ParseDicom_(bytes);

            Assert.Equal(DicomVR.CS, ds2.Get<DicomVR>(dictEntry.Tag));
        }
开发者ID:raysearchlabs,项目名称:fo-dicom,代码行数:25,代码来源:DicomDatasetTest.cs

示例14: SerializeDicom_

 private static byte[] SerializeDicom_(DicomDataset dataset)
 {
     var stream = new MemoryStream();
     var file = new DicomFile(dataset);
     file.Save(stream);
     return stream.ToArray();
 }
开发者ID:raysearchlabs,项目名称:fo-dicom,代码行数:7,代码来源:DicomDatasetTest.cs

示例15: DicomCMoveRequest

		public DicomCMoveRequest(string destinationAe, string studyInstanceUid, string seriesInstanceUid, DicomPriority priority = DicomPriority.Medium) : base(DicomCommandField.CMoveRequest, DicomUID.StudyRootQueryRetrieveInformationModelMOVE, priority) {
			DestinationAE = destinationAe;
			Dataset = new DicomDataset();
			Level = DicomQueryRetrieveLevel.Series;
			Dataset.Add(DicomTag.StudyInstanceUID, studyInstanceUid);
			Dataset.Add(DicomTag.SeriesInstanceUID, seriesInstanceUid);
		}
开发者ID:ZeryZhang,项目名称:fo-dicom,代码行数:7,代码来源:DicomCMoveRequest.cs


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