本文整理汇总了C#中DicomTag类的典型用法代码示例。如果您正苦于以下问题:C# DicomTag类的具体用法?C# DicomTag怎么用?C# DicomTag使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DicomTag类属于命名空间,在下文中一共展示了DicomTag类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnBeginSequence
public void OnBeginSequence(IByteSource source, DicomTag tag, uint length) {
DicomSequence sq = new DicomSequence(tag);
_sequences.Push(sq);
DicomDataset ds = _datasets.Peek();
ds.Add(sq);
}
示例2: DicomReaderEventArgs
public DicomReaderEventArgs(long position, DicomTag tag, DicomVR vr, IByteBuffer data)
{
Position = position;
Tag = tag;
VR = vr;
Data = data;
}
示例3: OnBeginSequence
public void OnBeginSequence(IByteSource source, DicomTag tag, uint length)
{
_currentSequenceTag.Push(tag);
if (tag == DicomTag.DirectoryRecordSequence) {
_directoryRecordSequence = _dataset.Get<DicomSequence>(tag);
}
}
示例4: TestFile
public void TestFile()
{
string filename = "OutOfRange.dcm";
DicomFile file = new DicomFile(filename, new DicomAttributeCollection(), new DicomAttributeCollection());
SetupMR(file.DataSet);
SetupMetaInfo(file);
DicomTag tag = new DicomTag(0x00030010, "Test", "TestBad", DicomVr.LOvr, false, 1, 1, false);
file.DataSet[tag].SetStringValue("Test");
file.Save(filename);
file = new DicomFile(filename);
file.DataSet.IgnoreOutOfRangeTags = true;
file.Load();
Assert.IsNotNull(file.DataSet.GetAttribute(tag));
file = new DicomFile(filename);
file.DataSet.IgnoreOutOfRangeTags = false;
try
{
file.Load();
Assert.Fail("file.Load failed");
}
catch (DicomException)
{
}
}
示例5: IsStoredTag
private bool IsStoredTag(DicomTag tag)
{
if (_metaInfo.Contains(tag))
return true;
//if it's meta info, just defer to the file.
if (tag.TagValue <= 0x0002FFFF)
return false;
if (_xml.IsTagExcluded(tag.TagValue))
return false;
if (tag.VR == DicomVr.SQvr)
{
var items = _xml[tag].Values as DicomSequenceItem[];
if (items != null)
{
if (items.OfType<InstanceXmlDicomSequenceItem>().Any(item => item.HasExcludedTags(true)))
return false;
}
}
bool isBinary = tag.VR == DicomVr.OBvr || tag.VR == DicomVr.OWvr || tag.VR == DicomVr.OFvr;
//these tags are not stored in the xml.
if (isBinary || tag.IsPrivate || tag.VR == DicomVr.UNvr)
return false;
return true;
}
示例6: BeginRead
public IAsyncResult BeginRead(IByteSource source, IDicomReaderObserver observer, DicomTag stop, AsyncCallback callback, object state) {
_stop = stop;
_observer = observer;
_result = DicomReaderResult.Processing;
_exception = null;
_async = new EventAsyncResult(callback, state);
ThreadPool.QueueUserWorkItem(ParseProc, source);
return _async;
}
示例7: OnElement_ValidData_AddsCorrectTypeToDataset
public void OnElement_ValidData_AddsCorrectTypeToDataset(DicomTag tag, DicomVR vr, string data, Type expected)
{
var dataset = new DicomDataset();
var observer = new DicomDatasetReaderObserver(dataset);
var buffer = new MemoryByteBuffer(Encoding.ASCII.GetBytes(data));
observer.OnElement(null, tag, vr, buffer);
Assert.IsType(expected, dataset.First());
}
示例8: DicomNGetRequest
public DicomNGetRequest(
DicomUID requestedClassUid,
DicomUID requestedInstanceUid,
DicomTag[] attributes,
DicomPriority priority = DicomPriority.Medium)
: base(DicomCommandField.NGetRequest, requestedClassUid, priority)
{
SOPInstanceUID = requestedInstanceUid;
}
示例9: OnBeginFragmentSequence
public void OnBeginFragmentSequence(IByteSource source, DicomTag tag, DicomVR vr)
{
_log.Log(
_level,
"{marker:x8}: {padding}{tag} {vrCode} {tagDictionaryEntryName}",
source.Marker,
_pad,
tag,
vr.Code,
tag.DictionaryEntry.Name);
IncreaseDepth();
}
示例10: OnBeginSequence
public void OnBeginSequence(IByteSource source, DicomTag tag, uint length)
{
_log.Log(
_level,
"{marker:x8}: {padding}{tag} SQ {length}",
source.Marker,
_pad,
tag,
tag.DictionaryEntry.Name,
length);
IncreaseDepth();
}
示例11: OnElement
public void OnElement(IByteSource source, DicomTag tag, DicomVR vr, IByteBuffer data)
{
_log.Log(
_level,
"{marker:x8}: {padding}{tag} {vrCode} {tagDictionaryEntryName} [{size}]",
source.Marker,
_pad,
tag,
vr.Code,
tag.DictionaryEntry.Name,
data.Size);
}
示例12: OnBeginFragmentSequence
public void OnBeginFragmentSequence(IByteSource source, DicomTag tag, DicomVR vr)
{
if (vr == DicomVR.OB)
_fragment = new DicomOtherByteFragment(tag);
else if (vr == DicomVR.OW)
_fragment = new DicomOtherWordFragment(tag);
else
throw new DicomDataException("Unexpected VR found for DICOM fragment sequence: {0}", vr.Code);
DicomDataset ds = _datasets.Peek();
ds.Add(_fragment);
}
示例13: DicomDictionaryEntry
public DicomDictionaryEntry(DicomTag tag, string name, string keyword, DicomVM vm, bool retired,
params DicomVr[] vrs)
{
Tag = tag;
Name = string.IsNullOrWhiteSpace(name) ? tag.ToString() : name;
Keyword = string.IsNullOrWhiteSpace(keyword) ? Name : keyword;
ValueMultiplicity = vm;
ValueRepresentations = vrs;
IsRetired = retired;
}
示例14: ConvertAttributeToUN
public void ConvertAttributeToUN(DicomAttributeCollection theSet, uint tag)
{
ByteBuffer theData =
theSet[tag].GetByteBuffer(TransferSyntax.ImplicitVrLittleEndian,
theSet.SpecificCharacterSet);
DicomTag baseTag = DicomTagDictionary.GetDicomTag(tag);
DicomTag theTag = new DicomTag(tag,
baseTag.Name, baseTag.VariableName, DicomVr.UNvr, baseTag.MultiVR, baseTag.VMLow, baseTag.VMHigh, baseTag.Retired);
DicomAttribute unAttrib = DicomVr.UNvr.CreateDicomAttribute(theTag, theData);
theSet[tag] = unAttrib;
}
示例15: TestIgnoreOutOfRangeTags
public void TestIgnoreOutOfRangeTags()
{
DicomFile file = new DicomFile();
DicomAttributeCollection collection = file.DataSet;
SetupMR(collection);
collection.IgnoreOutOfRangeTags = true;
DicomTag tag = new DicomTag(0x00030010, "Test", "TestBad", DicomVr.STvr, false, 1, 1, false);
Assert.IsNotNull(collection.GetAttribute(tag));
Assert.IsNotNull(collection[tag]);
try
{
DicomAttribute attrib = collection[tag.TagValue];
Assert.Fail("DicomAttributeCollection.GetAttribute failed");
}
catch (DicomException)
{
}
collection.IgnoreOutOfRangeTags = false;
try
{
collection.GetAttribute(tag);
Assert.Fail("DicomAttributeCollection.GetAttribute failed");
}
catch (DicomException)
{
}
try
{
DicomAttribute attrib = collection[tag];
Assert.Fail("DicomAttributeCollection.GetAttribute failed");
}
catch (DicomException)
{
}
try
{
DicomAttribute attrib = collection[tag.TagValue];
Assert.Fail("DicomAttributeCollection.GetAttribute failed");
}
catch (DicomException)
{
}
}