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


C# DicomUncompressedPixelData.UpdateAttributeCollection方法代码示例

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


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

示例1: TestAdvanced_FileOnDisk_16Bits_OW

		public void TestAdvanced_FileOnDisk_16Bits_OW()
		{
			var filename = Path.GetTempFileName();
			CreateDicomImage(rows : 20, columns : 30, numberOfFrames : 5).Save(filename);

			var dcf = new DicomFile(filename);
			dcf.Load(DicomReadOptions.StorePixelDataReferences);
			try
			{
				var pd = new DicomUncompressedPixelData(dcf);

				Assert.AreEqual(16, pd.BitsAllocated, "BitsAllocated");
				Assert.AreEqual(16, pd.BitsStored, "BitsStored");
				Assert.AreEqual(15, pd.HighBit, "HighBit");
				Assert.AreEqual(20, pd.ImageHeight, "ImageHeight");
				Assert.AreEqual(30, pd.ImageWidth, "ImageWidth");
				Assert.AreEqual(5, pd.NumberOfFrames, "NumberOfFrames");
				Assert.AreEqual("MONOCHROME2", pd.PhotometricInterpretation, "PhotometricInterpretation");
				Assert.AreEqual(0, pd.PixelRepresentation, "PixelRepresentation");
				Assert.AreEqual(1, pd.SamplesPerPixel, "SamplesPerPixel");
				Assert.AreEqual(20*30*2, pd.UncompressedFrameSize, "UncompressedFrameSize");

				var newFrameData = new byte[pd.UncompressedFrameSize];
				for (var n = 0; n < newFrameData.Length; ++n)
					newFrameData[n] = 0x7F;
				pd.SetFrame(1, newFrameData);
				pd.UpdateAttributeCollection(dcf.DataSet);

				var pixelData = dcf.DataSet[DicomTags.PixelData].Values as byte[];
				for (var frame = 0; frame < 5; ++frame)
				{
					var fd = pd.GetFrame(frame);
					var expectedValue = frame == 1 ? (byte) 0x7F : (byte) (0x80 + frame);

					Assert.AreEqual(pd.UncompressedFrameSize, fd.Length, "PixelData(frame={0}).Length", frame);
					AssertBytesEqual(expectedValue, fd, "PixelData(frame={0})", frame);
					AssertBytesEqual(expectedValue, pixelData, frame*pd.UncompressedFrameSize, pd.UncompressedFrameSize, "AttributeValues(frame={0})", frame);
				}
			}
			finally
			{
				File.Delete(filename);
			}
		}
开发者ID:stevengiblin,项目名称:ClearCanvas,代码行数:44,代码来源:DicomUncompressedPixelDataTests.cs

示例2: CreateFile

		public DicomFile CreateFile(ushort rows, ushort columns, string photometricInterpretation, ushort bitsStored, ushort bitsAllocated, bool isSigned, ushort numberOfFrames)
		{
			DicomFile file = new DicomFile("SCTestImage.dcm");

			DicomAttributeCollection dataSet = file.DataSet;

			SetupSecondaryCapture(dataSet);

			dataSet[DicomTags.PixelData] = null;

			DicomUncompressedPixelData pd = new DicomUncompressedPixelData(dataSet)
			                                	{
			                                		ImageWidth = columns,
			                                		ImageHeight = rows,
			                                		PhotometricInterpretation = photometricInterpretation,
			                                		BitsAllocated = bitsAllocated,
			                                		BitsStored = bitsStored,
			                                		HighBit = (ushort) (bitsStored - 1),
			                                		PixelRepresentation = (ushort) (isSigned ? 1 : 0),
			                                		NumberOfFrames = numberOfFrames
			                                	};

            CreatePixelData(pd);
            pd.UpdateAttributeCollection(dataSet);

			SetupMetaInfo(file);

			file.TransferSyntax = TransferSyntax.ExplicitVrLittleEndian;

			return file;
		}
开发者ID:emmandeb,项目名称:ClearCanvas-1,代码行数:31,代码来源:AbstractTest.cs

示例3: CreatePixelData

 protected static void CreatePixelData(DicomAttributeCollection dataSet)
 {
     dataSet[DicomTags.PixelData] = null;
     var pd = new DicomUncompressedPixelData(dataSet);
     CreatePixelData(pd);
     pd.UpdateAttributeCollection(dataSet);
 }
开发者ID:emmandeb,项目名称:ClearCanvas-1,代码行数:7,代码来源:AbstractTest.cs

示例4: CreateFile

		public DicomFile CreateFile(ushort rows, ushort columns, string photometricInterpretation, ushort bitsStored, ushort bitsAllocated, bool isSigned, ushort numberOfFrames)
		{
			DicomFile file = new DicomFile("SCTestImage.dcm");

			DicomAttributeCollection dataSet = file.DataSet;

			SetupSecondaryCapture(dataSet);

			dataSet[DicomTags.PixelData] = null;

			DicomUncompressedPixelData pd = new DicomUncompressedPixelData(dataSet)
			                                	{
			                                		ImageWidth = columns,
			                                		ImageHeight = rows,
			                                		PhotometricInterpretation = photometricInterpretation,
			                                		BitsAllocated = bitsAllocated,
			                                		BitsStored = bitsStored,
			                                		HighBit = (ushort) (bitsStored - 1),
			                                		PixelRepresentation = (ushort) (isSigned ? 1 : 0),
			                                		NumberOfFrames = numberOfFrames
			                                	};

			if (photometricInterpretation.Equals("RGB")
			 || photometricInterpretation.Equals("YBR_FULL"))
			{
				pd.SamplesPerPixel = 3;
				pd.PlanarConfiguration = 1;
				CreateColorPixelData(pd);
			}
			else if (photometricInterpretation.Equals("MONOCHROME1")
				  || photometricInterpretation.Equals("MONOCHROME2"))
			{
				CreateMonochromePixelData(pd);
			}
			else
			{
				throw new DicomException("Unsupported Photometric Interpretation in CreateFile");
			}

			pd.UpdateAttributeCollection(dataSet);

			SetupMetaInfo(file);

			file.TransferSyntax = TransferSyntax.ExplicitVrLittleEndian;

			return file;
		}
开发者ID:khaha2210,项目名称:radio,代码行数:47,代码来源:AbstractTest.cs


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