本文整理汇总了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;
}
示例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);
}
}
}
示例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);
}
示例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);
}