how to extract PatientBirthDate tag from DICOM file during import to XNAT

68 views
Skip to first unread message

Leopoldo Gonzalez

unread,
Nov 10, 2015, 10:17:13 AM11/10/15
to xnat_discussion
Dear Experts, 

Can someone help me : how to extract PatientBirthDate tag from DICOM file during import to XNAT

Thank you.

Herrick, Rick

unread,
Nov 10, 2015, 10:42:50 AM11/10/15
to xnat_di...@googlegroups.com
That really depends on the context. At what point in the import are you wanting to do this? When the data is received in the prearchive, when the data is archived into the project, some other time? Also, what do you want to do with the patient birth date once you’ve extracted it?

The other important question is what version of XNAT you’re running. If you’re on 1.6.5, the answer is going to much different from earlier versions.

-- 

Rick Herrick

Sr. Programmer/Analyst

Neuroinformatics Research Group

Washington University School of Medicine

(314) 740-5961


--
You received this message because you are subscribed to the Google Groups "xnat_discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to xnat_discussi...@googlegroups.com.
To post to this group, send email to xnat_di...@googlegroups.com.
Visit this group at http://groups.google.com/group/xnat_discussion.
For more options, visit https://groups.google.com/d/optout.



The material in this message is private and may contain Protected Healthcare Information (PHI). If you are not the intended recipient, be advised that any unauthorized use, disclosure, copying or the taking of any action in reliance on the contents of this information is strictly prohibited. If you have received this email in error, please immediately notify the sender via telephone or return mail.

Leopoldo Gonzalez

unread,
Nov 11, 2015, 10:58:02 AM11/11/15
to xnat_discussion
XNAT version that I have running on the 1.6.5. I want to save patient birth date and then use this field later.

Herrick, Rick

unread,
Nov 12, 2015, 5:51:32 PM11/12/15
to xnat_di...@googlegroups.com
If the birthdate is in the incoming DICOM, then it’s saved by default when the DICOM is imported into XNAT and available later through the resulting XNAT data object. You just need to know the session ID. You can then do something like:

final XnatImagesessiondata session = (XnatImagesessiondata) XnatExperimentdata.getXnatExperimentdatasById(dataId, user, false);
final Date date = (Date) session.getDcmpatientbirthdate();

Again, this really depends on how and where you want to use the field, but the data is already stored with the session object.

Angel Fernandez - Cañada Vilata

unread,
Nov 13, 2015, 11:20:07 AM11/13/15
to xnat_discussion
Hi,

I've the same problem with the fields: (Day of birth) DAY and gender.
Where Can I write this code in the platform?

Thanks in advance

Herrick, Rick

unread,
Nov 13, 2015, 11:24:52 AM11/13/15
to xnat_di...@googlegroups.com
Again, it’s very dependent on where you want to use the information. The fields are all accessible through the session object (presuming they were either in the imported DICOM data or set later via some other process), but how you access the session object will be different depending on how and where you’re trying to display it or work with it.

-- 

Rick Herrick

Sr. Programmer/Analyst

Neuroinformatics Research Group

Washington University School of Medicine

(314) 740-5961

Angel Fernandez - Cañada Vilata

unread,
Nov 13, 2015, 11:48:00 AM11/13/15
to xnat_di...@googlegroups.com

My system is xnat_1_6. When archive a file from the prearchive the subject  in the project hasn't the gender and birth of date even the data is in the DICOM FILES. How can I solve the problem?

Thanks again

You received this message because you are subscribed to a topic in the Google Groups "xnat_discussion" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/xnat_discussion/rjjGSa5Isco/unsubscribe.
To unsubscribe from this group and all its topics, send an email to xnat_discussi...@googlegroups.com.

Herrick, Rick

unread,
Nov 13, 2015, 12:22:00 PM11/13/15
to xnat_di...@googlegroups.com
Can you check the XML for the session? The birth date should be in there in the field <xnat:dcmPatientBirthDate>:

<xnat:dcmPatientBirthDate>1980-11-13</xnat:dcmPatientBirthDate>

Also, what specific version of XNAT are you running? I definitely know this works on 1.6.5, but it should work on pretty much any earlier version of XNAT as well, unless the birthdate is anonymized away on import or archive.

It’s worth noting that the birthdate will appear in the resulting experiment object for the DICOM data, but is NOT automatically set on the subject data. This includes if the subject doesn’t exist prior to the import of the DICOM data and is created automatically. But the birthdate should be preserved in the experiment data and could be pulled up and set in the subject data via, e.g., a script that handles the Transferred event, which is generated when a session is transferred from the prearchive to the archive.

Gender is actually not imported into either the session or the subject data when the session is built. That would be nice to have and would be relatively easy to add if you or someone in your lab is comfortable working with Java code. There’s a library named dicom-xnat-mx-version (so the proper code base needs to be pulled to make this change, otherwise the change may break dependencies on this library) with a class named ImageSessionAttributes. This would require adding the following line:

s.add(“gender", Tag.PatientSex);

As noted before, this still won’t get set on an automatically generated subject.

Herrick, Rick

unread,
Nov 13, 2015, 12:49:48 PM11/13/15
to xnat_di...@googlegroups.com
I meant to note, I’ve added issues to the XNAT JIRA for these tasks:
  • XNAT-3837: DICOM field mapping should be configurable and extensible
  • XNAT-3838: Should be able to configure fields used to create subjects from experiment data
I hope to have community access to the JIRA available within the next week or so, which will allow people to vote on issues, watch them (i.e. get emails when the issue is update), comment on them, etc.

-- 

Rick Herrick

Sr. Programmer/Analyst

Neuroinformatics Research Group

Washington University School of Medicine

(314) 740-5961

Angel Fernandez - Cañada Vilata

unread,
Nov 19, 2015, 3:53:49 AM11/19/15
to xnat_di...@googlegroups.com
Ok, thanks. Very grateful.
It's a very critical problem for us. We hope these updates arrive soon.
Thanks in advance
Reply all
Reply to author
Forward
0 new messages