Tag Values are empty or zero

587 views
Skip to first unread message

Marco Ribolla

unread,
Jun 3, 2014, 10:17:38 AM6/3/14
to fo-d...@googlegroups.com
I have designed four classes (Patient, Study, Series, Image) which should hold the information of the related tags.

First I tried to read the private tag values like this:

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


and this:

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>();

and this:

var value = file.Dataset.Get<string>(file.Dataset.GetPrivateTag(DicomTag.PatientBirthName));

All of them returned me null / an empty string, but I don't really understand this result. My file isn't null (otherwise --> exception) and that tag can't be empty. Can you eventually explain me the possibilities of this occurence and how to solve it?

Thank you

Marco Ribolla

unread,
Jun 4, 2014, 5:29:43 AM6/4/14
to fo-d...@googlegroups.com
Finally I've found my mistake:

wrong: var value = file.Dataset.Get<string>(file.Dataset.GetPrivateTag(DicomTag.PatientBirthName));

right: var name = file.Dataset.Get<string>(DicomTag.PatientID);

Can it be, that with the second alternative it works only because the DicomTag isn't private? Is possible to get values from private tags?

MENG HO

unread,
Jul 16, 2015, 1:32:56 PM7/16/15
to fo-d...@googlegroups.com
I have the same issue, too. I keep looking for a way to read private tag and change the value. But no luck for fo-dicom. I ended up with using other DICOM toolkit to read it. But really want to know how to do it with fo-dicom.

Chris Horn

unread,
Jul 29, 2015, 8:50:41 AM7/29/15
to Fellow Oak DICOM for .NET, meng...@gmail.com
Reply all
Reply to author
Forward
0 new messages