Autopopulating metadata to subject listing table

40 views
Skip to first unread message

Vilma Friis

unread,
Aug 21, 2025, 8:48:49 AMAug 21
to xnat_discussion
Hello, 
I have recently installed XNAT and I want to use it to store multiple MRIs and to filter them based on different attributes, such as age and handness. I have downloaded the images via Desktop Client. The subject listing table contains fields for age and handness fields, for example, but their values are empty by default. I would like these fields to be automatically populated based on the corresponding DICOM tag values when creating a new subject and downloading an MRI.

What is the easiest way to do this? I assume I could use the Event Handlers, but I could use some help with this.

Additionally, is there any way to do this for NIfTI type images, too, if these values are stored in a separate csv file, for example?

Best regards, 
Vilma

Rick Herrick

unread,
Aug 25, 2025, 3:16:52 PM (13 days ago) Aug 25
to xnat_di...@googlegroups.com
Hi Vilma,

XNAT doesn't have a built-in way to extract values from DICOM fields in an imaging session and use the values to populate attributes on the corresponding subject. It would be great if it did, so much so that I created a ticket to track this as a possible feature addition. That probably won't happen very soon though, so in the meantime I think you have the right idea with using event handlers. The best way to start with this is the Event Service Quick Start. The basic idea is that you map some event–in this case either session or scan creation–to a container. When that event occurs, the associated container is launched. You would also need to create a container that can work with XNAT. This is described in the Building Docker Images for Container Service documentation. That container would run a script of some sort–e.g. a Python script using xnatpy, but it really depends on what you're comfortable using–to get the relevant value(s) from the data and update the subject properties based on that. It should be straightforward to make the script work with both DICOM and NIFTI data.

That might sound like a complicated process but actually each piece is simple on its own. Start by writing the script to work with a test subject and image session, then package it into a container, then associate the container with the appropriate event.

Feel free to reach out if you run into any issues!

Rick Herrick 

Senior Software Developer

ri...@xnatworks.io

https://xnatworks.io | Find us on LinkedIn



--
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 view this discussion visit https://groups.google.com/d/msgid/xnat_discussion/a9ba8ba3-40a5-4ddf-813a-58d5a1e48908n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages