Mapping Session ID from DICOM header; defaulting to Patient ID tag results in duplicates, alternatives?

253 views
Skip to first unread message

Pascal Pas

unread,
Aug 25, 2017, 3:01:03 PM8/25/17
to xnat_discussion
By default XNAT looks at the patient ID tag (0010,0020) to create a session ID, if nothing else is specified at the patient or study comment fields. The tag 0010,0020 is unique per patient, and not per session. This means that when multiple sessions are uploaded to XNAT of the same patient, only the first is archived and the following get stuck due to a duplicate session ID. 

This is of course resolved by specifying a session ID in the other input fields before acquiring the data; but I simply do not understand the reasoning behind taking the 0010,0020 tag for the third pass. It would be more logical to use a tag that is unique per session like Accession Number (0008,0050), or by creating a session number by combining date and time.

Is there anyway to change this default behaviour? We would love to upload data from the same patient over multiple sessions without the need for pre-specifying a session ID, but the default XNAT behaviour prevents this and will only accept a single session per patient.

Pascal Pas

unread,
Aug 29, 2017, 2:51:16 AM8/29/17
to xnat_discussion
I did find this thread on the customisation of the session label, but it revolves around an extra script running.


Isn't it possible to change the actual tag that is used for the session label, one that is actually unique over sessions? 

Pascal Pas

unread,
Sep 1, 2017, 7:21:11 AM9/1/17
to xnat_discussion
I've now looked at many archived threads, some asking the same question (due to the default session ID method resulting in duplicates and errors), but am not able to find an actual solution. 

Some refer to the anonimization script, but that is run after data is already saved under the project, subject and session tags.. and with longitudinal measurements the session ID will not be unique (DICOM tag is a patient identifier, not a session). 

Is it simply impossible to change the 'third pass' arguments in a straightforward manner? This would mean we cannot use XNAT as our data management system for longitudinal studies, as it relies on specific inputs on the scanner and we found that to be quite sensitive to errors. 

Daniel Marcus

unread,
Sep 4, 2017, 9:48:47 AM9/4/17
to xnat_di...@googlegroups.com
Hi Pascal,

As Kevin indicated in the thread you linked to, the import logic can be modified by revising the java class that implements the logic.  It can't be done, as far as I know, through configuration -- XNAT developer, correct me if I'm wrong about that -- so you'd need to recompile XNAT.  

-Dan

--
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_discussion+unsubscribe@googlegroups.com.
To post to this group, send email to xnat_discussion@googlegroups.com.
Visit this group at https://groups.google.com/group/xnat_discussion.
For more options, visit https://groups.google.com/d/optout.

Pascal Pas

unread,
Sep 4, 2017, 10:02:14 AM9/4/17
to xnat_discussion
Thanks for the reply. I'm afraid we lack the development skills to implement such a revision. 

I don't understand the rationale behind choosing the 'Patient ID' tag, which is the primary hospital identification number or code for individual patients, as a session identifier.. then by default there can never be multiple sessions for the same patient in the system.

On Monday, September 4, 2017 at 3:48:47 PM UTC+2, Daniel Marcus wrote:
Hi Pascal,

As Kevin indicated in the thread you linked to, the import logic can be modified by revising the java class that implements the logic.  It can't be done, as far as I know, through configuration -- XNAT developer, correct me if I'm wrong about that -- so you'd need to recompile XNAT.  

-Dan
On Fri, Sep 1, 2017 at 12:21 PM, Pascal Pas <pasca...@gmail.com> wrote:
I've now looked at many archived threads, some asking the same question (due to the default session ID method resulting in duplicates and errors), but am not able to find an actual solution. 

Some refer to the anonimization script, but that is run after data is already saved under the project, subject and session tags.. and with longitudinal measurements the session ID will not be unique (DICOM tag is a patient identifier, not a session). 

Is it simply impossible to change the 'third pass' arguments in a straightforward manner? This would mean we cannot use XNAT as our data management system for longitudinal studies, as it relies on specific inputs on the scanner and we found that to be quite sensitive to errors. 


On Tuesday, August 29, 2017 at 8:51:16 AM UTC+2, Pascal Pas wrote:
I did find this thread on the customisation of the session label, but it revolves around an extra script running.


Isn't it possible to change the actual tag that is used for the session label, one that is actually unique over sessions? 

--
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.

Daniel Marcus

unread,
Sep 4, 2017, 10:33:53 AM9/4/17
to xnat_di...@googlegroups.com
The reason for using Patient ID is somewhat historical -- it's a field that can be edited at the console, so techs at research scanners can easily insert research IDs of their choice.

For those not wanting to modify the core logic, the reason anon scripts have been suggested is that the site-wide anon script is applied before the data are imported.  Thus you can use it as a place to do some basic DICOM manipulation to guide subsequent logic.  For example, you can compose your preferred session ID from the value in the accession number or date field and then put it in study comments.

I'm not familiar with your particular workflow but would using the sitewide anon script this way work?

-Dan

To unsubscribe from this group and stop receiving emails from it, send an email to xnat_discussion+unsubscribe@googlegroups.com.
To post to this group, send email to xnat_discussion@googlegroups.com.

Pascal Pas

unread,
Sep 7, 2017, 10:55:02 AM9/7/17
to xnat_discussion
I have added the following site-wide anonymization script:

timestamp := format["{0}_{1}_{2}", (0010,0020), (0008,0030), (0008,0020)]
(0010,0020) := timestamp

When uploading a new dataset via the compressed uploader the tag (0010,0020) is indeed replaced with the combination of PatientID + date + timestamp. However, the data is still archived with solely the patientID as sessionID.

In addition, the PatientID tag is locked on our Philips MR console and field input is linked to other hospital records.

Léo HARDY

unread,
Nov 1, 2022, 5:45:25 AM11/1/22
to xnat_discussion
Hi, I know that's an old thread but if it can help someone someday, we got a similar issue and this is what we did. For information, we tested it on both 1.8.2 and 1.8.6 versions
- we made the same constatation that putting the  0010,0020 tag into the session label was not fitting our needs because one patient ID could refer to multiple session
- we decided to put the SeriesInstanceUID  (0020,000e)  in the session label, as it should be unique at the scan level project-wise
- by reading this doc, we set the Session routing rule to:  (0020,000E):(.*):1
- (as the session labels can't have dots, dots are replaced by underscore automatically)

I don't know if we can concatenate multiple tags as you've lately mentioned, still I think this solution can help finding other unique fields to take to obtain unique sessions labels.

Léo
Reply all
Reply to author
Forward
0 new messages