Hi Both,
When the error message talks about "invalid modification of session UID", this means, as Alex noted, that the DICOM tag StudyInstanceUID from the file(s) you are trying to import second doesn't match the corresponding tag in images already imported for that subject and image session in XNAT. In my experience, any time I've ever tried to force DICOM files with different StudyInstanceUIDs into the same session, it has ended in tears. The XNAT warning is there for a reason and my advice would be "just don't do it".
DICOM is a framework that is built around relationships between files (images) that contain various UIDs. For example, all files with the same SeriesInstanceUID tag belong together, and that's how XNAT know to separate the incoming data into different scans (aka DICOM series). It's the same with StudyInstanceUIDs. Even if you can force files with different StudyInstanceUIDs into the same imaging session in XNAT, I wouldn't like to guarantee that things won't get screwed up in the OHIF viewer somewhere, because it will look at the DICOM StudyInstanceUID for various operations. Things involving regions-of-interest (masks/labelmaps and contours) make extensive use of these UID relationships.
Alex notes that, as data importer, you will be the person who has to take a decision whether the images should be in the same session. Be very aware that this is quite a responsibility and any actions should be appropriately documented if you are in a clinical trial context. Note that the error message you pasted is telling you that the scan number is duplicated between the two imaging sessions with different UIDs, so if you were to try and force the two sets of files together, you would need to resolve this. The way I would personally solve this issue is to import the two studies as two different sessions with linked session labels. Yes, they might have occurred while the patient was still lying in the same position in the scanner at the same time, but the equipment vendor clearly took the decision that it regarded the studies as different. In your case, is there really anything wrong with organising XNAT such that you have Visit1_inspiration and Visit1_expiration as two session labels that will display adjacent to each other in the XNAT listing, with the same date attached?
[@Alex, you mention research sites. I know that it's difficult, but we try to push back very hard, if necessary with the support of the trial sponsor and Chief Investigator, against the sites that do the type of thing you described and send "poor quality data". FWIW I've always regarded UID randomisation (and also date shifting) as a very dangerous thing when it comes to clinical trials. We strongly believe in an appropriate risk assessment that balances the risk of reidentification by a "motivated attacker" (which is very unlikely when running a clinical trial with only a small team accessing the data) with the much more significant risk that the patient ID or visit number on a trial is registered incorrectly because of DICOM UID or date issues. The clinical trials use case is very different from the UID randomisation that is needed when publishing data in an open access repository like TCIA, precisely because the risk balance is very different.]
Best wishes,
Simon