本文整理汇总了C#中DicomDataset.AddOrUpdate方法的典型用法代码示例。如果您正苦于以下问题:C# DicomDataset.AddOrUpdate方法的具体用法?C# DicomDataset.AddOrUpdate怎么用?C# DicomDataset.AddOrUpdate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DicomDataset
的用法示例。
在下文中一共展示了DicomDataset.AddOrUpdate方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Transform
public void Transform(DicomDataset dataset, DicomDataset modifiedAttributesSequenceItem = null)
{
IDbConnection connection = null;
try
{
if (_dbType == DatabaseType.MsSql) connection = new SqlConnection(_connectionString);
#if !__IOS__ && !__ANDROID__ && !NETSTANDARD
else if (_dbType == DatabaseType.Odbc) connection = new OdbcConnection(_connectionString);
#endif
using (IDbCommand command = connection.CreateCommand())
{
command.Connection = connection;
command.CommandText = _query;
for (int i = 0; i < _params.Count; i++)
{
var str = dataset.Get<string>(_params[i], -1, String.Empty);
SqlParameter prm = new SqlParameter(String.Format("@{0}", i), str);
command.Parameters.Add(prm);
}
connection.Open();
if (_output.Count == 0)
{
command.ExecuteNonQuery();
}
else
{
using (IDataReader reader = command.ExecuteReader())
{
if (reader.Read())
{
for (int i = 0; i < _output.Count; i++)
{
dataset.CopyTo(modifiedAttributesSequenceItem, _output[i]);
string str = reader.GetString(i);
dataset.AddOrUpdate(_output[i], str);
}
}
}
}
connection.Close();
connection = null;
}
}
finally
{
if (connection != null)
{
if (connection.State == ConnectionState.Closed || connection.State == ConnectionState.Broken) connection.Close();
connection.Dispose();
}
}
}
示例2: Transform
public void Transform(DicomDataset dataset, DicomDataset modifiedAttributesSequenceItem = null)
{
dataset.CopyTo(modifiedAttributesSequenceItem, _tag);
var uid = dataset.Get<DicomUID>(_tag);
dataset.AddOrUpdate(_tag, _generator.Generate(uid));
}
示例3: ProcessOverlays
private static void ProcessOverlays(DicomDataset input, DicomDataset output)
{
var overlays = DicomOverlayData.FromDataset(input.InternalTransferSyntax.IsEncapsulated ? output : input);
foreach (var overlay in overlays)
{
var dataTag = new DicomTag(overlay.Group, DicomTag.OverlayData.Element);
// Don't run conversion on non-embedded overlays.
if (output.Contains(dataTag)) continue;
// If embedded overlay, Overlay Bits Allocated should equal Bits Allocated (#110).
var bitsAlloc = output.Get(DicomTag.BitsAllocated, (ushort)0);
output.AddOrUpdate(new DicomTag(overlay.Group, DicomTag.OverlayBitsAllocated.Element), bitsAlloc);
var data = overlay.Data;
if (output.InternalTransferSyntax.IsExplicitVR) output.AddOrUpdate(new DicomOtherByte(dataTag, data));
else output.AddOrUpdate(new DicomOtherWord(dataTag, data));
}
}
示例4: RegenerateAll
/// <summary>
/// Regenerate all UIDs in a DICOM dataset.
/// </summary>
/// <param name="dataset">Dataset in which UIDs should be regenerated.</param>
public void RegenerateAll(DicomDataset dataset)
{
foreach (var ui in dataset.Where(x => x.ValueRepresentation == DicomVR.UI).ToArray())
{
var uid = dataset.Get<DicomUID>(ui.Tag);
if (uid.Type == DicomUidType.SOPInstance || uid.Type == DicomUidType.Unknown) dataset.AddOrUpdate(ui.Tag, this.Generate(uid));
}
foreach (var sq in dataset.Where(x => x.ValueRepresentation == DicomVR.SQ).Cast<DicomSequence>().ToArray())
{
foreach (var item in sq)
{
this.RegenerateAll(item);
}
}
}