If you upload an image session that has the same project, subject and session ID, XNAT will either overwrite the old session with the new one, or attempt to merge the two sessions together, depending on your Project image upload settings. (See: Project Data Import and Anonymization Settings.)
There are two possible methods for merging sessions together.
Transactional Import (uploads files and updates session as one transaction)
In a transactional import, new scans can be added to existing sessions. This requires merging the new scan data with the existing session XML. There is also support for adding files to existing scans. The existing scan catalog and new scan catalog are parsed and compared for duplicates. If 'overwrite' is set to true in your project settings, then duplicates are overridden. If not, the new files are copied in and the catalog is updated.
For imports where the destination is set to "Prearchive," the cache status is updated to "receiving" and the new files are added to a new or existing session directory. Then the restructurer is run, the resulting directories are merged into the destination using catalog comparison, and the session builder is run. Duplicate instanceUID with different classUID will be ignored. Then the SessionBuilder is run and a cache refresh is triggered.
When the destination is set to "archive," the files are first put in a temporary location (the prearchive). The new scans are added to the existing session without a compatibility check. If compatible, this will succeed. The files will be moved to the archive and the xml for the session will be updated. If incompatible, it will fail, but the files will remain in the prearchive for admin followup.
Gradual Import (uploads files/scans one at a time without rebuilding session on each request)
For imports where the destination is set to "prearchive," files are added one at a time (or scan by scan) to an existing prearchive directory. The cache is updated to show the time of last file add and the status of receiving. There is now support for adding files via a special session URL or via DICOM attributes. There is a timer that rebuilds session XML for sessions that are receiving but inactive.
For imports where the destination is set to 'archive', the files are added gradually and then DCM Refresh is run.
Gradual Import can be specified via a POST to the following REST URI: