Multiple subfields for PatientName tag

69 views
Skip to first unread message

Sui Jiang

unread,
Apr 7, 2016, 6:27:54 PM4/7/16
to Fellow Oak DICOM
Hi guys, I'm new to the fo-dicom library. I'm working with program that read's patient name.

If I go inside of the Patient Name, it contains several sub fields like FirstName and LastName. In this case I cannot cast it into a string.

What would be a proper data type to cast here?

Or when invoking dicomFile.Dataset.Get<T>(DicomTag.PatientName), what should I put for "T"?



In general, if some value representations are not simple values (when open in MATLAB they're MATLAB struct's), what would be a proper DataType to cast it?

Anders Gustafsson Cureos AB

unread,
Apr 11, 2016, 2:42:52 AM4/11/16
to Fellow Oak DICOM
Hi Sui,

if you replace T with string, you will get the original patient name string from the DICOM message (e.g. "Doe^John"), whereas if you replace T with DicomPersonName, you will be able to access the individual name parts from the result. So it is mainly a question of what you prefer.

The Get overrides typically support casts to basic types, so generally it is sufficient to replace T with basic types or arrays such as string, int, double, string[], int[], double[].

Regards,
Anders @ Cureos

Sui Jiang

unread,
Apr 11, 2016, 4:09:43 PM4/11/16
to Fellow Oak DICOM
Works like a champ. Thanks Anders.

Is there a way to check what cast types are available for each DicomTag?

I noticed that I have either to see it through exception or look it up by setting up a break point. Does FO developers supply a dictionary about that?

Anders Gustafsson Cureos AB

unread,
Apr 12, 2016, 2:39:45 AM4/12/16
to Fellow Oak DICOM
Hi again Sui,

at the moment, there is no detailed information available which casts are supported for which VRs, so looking at the DicomElement code or trial-and-error are currently the only ways forward. But we are continuously trying to add API documentation, and it would also make sense to put up a wiki page with the information you are asking for. Please feel free to post an issue in the Github repository about receiving detailed information about supported Get<T> casts.

Regards,
Anders
Reply all
Reply to author
Forward
0 new messages