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


C# DcmDataset.AddItem方法代码示例

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


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

示例1: Clone

 public DcmDataset Clone()
 {
     DcmDataset dataset = new DcmDataset(StreamPosition, StreamLength, InternalTransferSyntax);
     foreach (DcmItem item in Elements) {
         dataset.AddItem(item.Clone());
     }
     dataset.UserState = UserState;
     return dataset;
 }
开发者ID:karanbajaj,项目名称:mdcm,代码行数:9,代码来源:DcmDataset.cs

示例2: Save

        private static void Save(XElement parent, DcmDataset dataset)
        {
            foreach (XElement attr in parent.Elements("attr"))
            {
                DicomTag tag = DicomTag.Parse(attr.Attribute("tag").Value);
                DicomVR vr = DicomVR.Lookup(attr.Attribute("vr").Value);
                int len = int.Parse(attr.Attribute("len").Value, CultureInfo.InvariantCulture);

                if (vr == DicomVR.SQ)
                {
                    DcmItemSequence seq = new DcmItemSequence(tag);
                    foreach (XElement itm in attr.Elements("item"))
                    {
                        DcmItemSequenceItem item = new DcmItemSequenceItem();
                        Save(itm, item.Dataset);
                        seq.AddSequenceItem(item);
                    }
                    dataset.AddItem(seq);
                }
                else if (len == -1)
                {
                    DcmFragmentSequence seq = new DcmFragmentSequence(tag, vr);
                    bool first = true;
                    foreach (XElement itm in attr.Elements("item"))
                    {
                        if (first)
                        {
                            SaveFragmentOffsetTable(itm, seq);
                            first = false;
                        }
                        else
                        {
                            SaveFragmentItem(itm, seq);
                        }
                    }
                    dataset.AddItem(seq);
                }
                else
                {
                    DcmElement element = DcmElement.Create(tag, vr);
                    element.SetValueString(attr.FirstText());
                    dataset.AddItem(element);
                }
            }
        }
开发者ID:GMZ,项目名称:mdcm,代码行数:45,代码来源:XDicom.cs

示例3: OnReceiveNGetRequest

        protected override void OnReceiveNGetRequest(byte presentationID, ushort messageID,
            DicomUID requestedClass, DicomUID requestedInstance, DicomTag[] attributes)
        {
            if (requestedClass == DicomUID.PrinterSOPClass && requestedInstance == DicomUID.PrinterSOPInstance) {
                DcmDataset ds = new DcmDataset(DicomTransferSyntax.ImplicitVRLittleEndian);
                ds.AddElementWithValue(DicomTags.PrinterStatus, "NORMAL");
                ds.AddElementWithValue(DicomTags.PrinterStatus, "NORMAL");
                ds.AddElementWithValue(DicomTags.PrinterName, _config.PrinterName);
                ds.AddElementWithValue(DicomTags.Manufacturer, "N/A");
                ds.AddElementWithValue(DicomTags.ManufacturersModelName, "N/A");
                ds.AddElementWithValue(DicomTags.DeviceSerialNumber, "N/A");
                ds.AddElementWithValue(DicomTags.SoftwareVersions, "N/A");
                ds.SetDateTime(DicomTags.DateOfLastCalibration, DicomTags.TimeOfLastCalibration, DateTime.Now);

                SendNGetResponse(presentationID, messageID, requestedClass, requestedInstance, ds, DcmStatus.Success);
                return;
            }

            if (requestedClass == DicomUID.PrintJobSOPClass) {
                DcmPrintJob job = null;

                foreach (DcmPrintJob pj in _jobs) {
                    if (pj.SOPInstanceUID == requestedInstance) {
                        job = pj;
                        break;
                    }
                }

                if (job == null) {
                    job = new DcmPrintJob(requestedInstance);
                    job.ExecutionStatus = "DONE";
                    job.CreationDateTime = DateTime.Today;
                    job.PrintPriority = _session.PrintPriority;
                    job.PrinterName = _config.PrinterName;
                    job.Originator = Associate.CallingAE;
                }

                SendNGetResponse(presentationID, messageID, requestedClass, requestedInstance, job.Dataset, DcmStatus.Success);
                return;
            }

            if (requestedClass == DicomUID.PrinterConfigurationRetrievalSOPClass && requestedInstance == DicomUID.PrinterConfigurationRetrievalSOPInstance) {
                DcmDataset ds = new DcmDataset(DicomTransferSyntax.ImplicitVRLittleEndian);
                DcmDataset config = new DcmDataset(DicomTransferSyntax.ImplicitVRLittleEndian);

                DcmItemSequence sq = new DcmItemSequence(DicomTags.PrinterConfigurationSequence);
                sq.AddSequenceItem(config);
                ds.AddItem(sq);

                SendNGetResponse(presentationID, messageID, requestedClass, requestedInstance, ds, DcmStatus.Success);
                return;
            }

            SendAbort(DcmAbortSource.ServiceProvider, DcmAbortReason.NotSpecified);
        }
开发者ID:k11hao,项目名称:mdcm-printscp,代码行数:55,代码来源:NPrintService.cs

示例4: UpdateDataset

		public void UpdateDataset(DcmDataset dataset) {
			if (_lossy) {
				DcmCodeString cs = dataset.GetCS(DicomTags.ImageType);
				if (cs != null) {
					string[] values = cs.GetValues();
					values[0] = "DERIVED";
					cs.SetValues(values);
				}

				dataset.AddElementWithValue(DicomTags.SOPInstanceUID, DicomUID.Generate());

				// FIXME: append existing values
				dataset.AddElementWithValue(DicomTags.LossyImageCompression, "01");
				dataset.AddElementWithValue(DicomTags.LossyImageCompressionMethod, _lossyMethod);
				dataset.AddElementWithValue(DicomTags.LossyImageCompressionRatio, _lossyRatio);
			}
			dataset.AddElementWithValue(DicomTags.NumberOfFrames, _frames);
			dataset.AddElementWithValue(DicomTags.Columns, _width);
			dataset.AddElementWithValue(DicomTags.Rows, _height);
			dataset.AddElementWithValue(DicomTags.HighBit, _highBit);
			dataset.AddElementWithValue(DicomTags.BitsStored, _bitsStored);
			dataset.AddElementWithValue(DicomTags.BitsAllocated, _bitsAllocated);
			dataset.AddElementWithValue(DicomTags.SamplesPerPixel, _samplesPerPixel);
			dataset.AddElementWithValue(DicomTags.PixelRepresentation, _pixelRepresentation);
			dataset.AddElementWithValue(DicomTags.PhotometricInterpretation, _photometricInterpretation);
			if (SamplesPerPixel == 1) {
				dataset.AddElementWithValue(DicomTags.RescaleSlope, _rescaleSlope);
				dataset.AddElementWithValue(DicomTags.RescaleIntercept, _rescaleIntercept);
				//if (_pixelPaddingValue != 0)
				//    dataset.AddElementWithValue(DicomTags.PixelPaddingValue, _pixelPaddingValue);
			}
			else {
				dataset.AddElementWithValue(DicomTags.PlanarConfiguration, _planarConfiguration);
			}
			dataset.AddItem(_pixelDataItem);
		}
开发者ID:mcmssupereditor,项目名称:mdcm,代码行数:36,代码来源:DcmPixelData.cs


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