How to read private tag value

1,387 views
Skip to first unread message

MENG HO

unread,
Feb 19, 2013, 8:19:28 AM2/19/13
to fo-d...@googlegroups.com
I tried to read the private tag value from a dicom file. It has a private block (300B, 00XX) and private attribute (300B, XX02). VR = FL, VM = 1.
 
I tested with several ways (like add the tag in dicom dictionary and private dictionary) and none of them worked.
 

Mahesh Dubey

unread,
Feb 26, 2013, 3:33:15 AM2/26/13
to fo-d...@googlegroups.com
What I understand from your question is you want to read the value of private tag
Following are two ways

var tag = DicomTag.Parse("2001,107B");
var value = file.Dataset.Get<string>(tag);

If above will not work (why ??? )
try below

var tag = DicomTag.Parse("2001,107B");  
var item = (from dicomItem in file.Dataset
            where dicomItem.Tag.Group == tag.Group &&   dicomItem.Tag.Element == tag.Element
            select dicomItem as DicomElement).SingleOrDefault();

var value = item==null?string.Empty:item.Get<string>();

Regards
Mahesh
Reply all
Reply to author
Forward
0 new messages