determine MR session length?

30 views
Skip to first unread message

Daniel Drucker

unread,
Sep 17, 2021, 3:24:33 PM9/17/21
to xnat_discussion
In our old (osirix-based) system, when you look at an MR session you can see its duration:

Untitled.png

What would be the best way to allow users to see something similar in XNAT?  I can imagine creating a container which grabs the start/end times from the dicom files, but is there a much easier way to get that information and display it within xnat somewhere?

Daniel

Daniel Drucker

unread,
Sep 17, 2021, 3:49:13 PM9/17/21
to xnat_discussion
(To be explicit, what I'm interested in is the time difference between the MR Sessions's latest and earliest InstanceCreationTime.)

Moore, Charlie

unread,
Sep 17, 2021, 3:51:24 PM9/17/21
to xnat_discussion
Hi Daniel,

There's two main considerations that come to mind when looking at this:
  1. XNAT: once you have a way of getting this, a decent way of getting it into XNAT would be putting it into a custom variable on the session. If you want to go down this route, make sure you get some input from Matt as I believe he's worked recently on making container service support custom variable output. The complication here is that custom variables only show up on the session report page if they have been registered on the project​.
    1. If you have a small number of projects, registering the variable on every project where you want this feature would be reasonable, but this doesn't scale well. Unfortunately, this is one area of XNAT where there isn't a convenient API to use as well.
    2. The alternative would be customizing the MR session report page in a plugin to display the value (which is stored in a custom variable) for all projects.
  2. Calculation: what does "Duration" even mean? Calculating it in a container which reads all of the files for a session is a good idea, but I don't think the information to pin it down exactly is even available in the DICOM. Even if we assume that all of the DICOM type 3 elements are provided correctly, all of the elements like Series Time, Acquisition Time, etc. are all for the start​ of the relevant event, so the closest you could do was the earliest start time vs latest start time.
Thanks,
Charlie

From: xnat_di...@googlegroups.com <xnat_di...@googlegroups.com> on behalf of Daniel Drucker <ddru...@mclean.harvard.edu>
Sent: Friday, September 17, 2021 2:24 PM
To: xnat_discussion <xnat_di...@googlegroups.com>
Subject: [XNAT Discussion] determine MR session length?
 

* External Email - Caution *

--
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 on the web visit https://groups.google.com/d/msgid/xnat_discussion/e038a2b7-51aa-41a0-813e-6d0531bd9c4cn%40googlegroups.com.

 


The materials in this message are private and may contain Protected Healthcare Information or other information of a sensitive nature. 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.

Moore, Charlie

unread,
Sep 17, 2021, 4:01:30 PM9/17/21
to xnat_discussion
Oh, you beat me to number 2. It looks like you've got that all figured out, so the XNAT part is the only complication. Let me know if what I said makes sense. I will say that "worst case" for setting the value of a custom variable, even if container service won't support it natively, you can still do it within the container with a REST call. Hence, I suspect displaying it in a way that meets all of your requirements (TBD) will be the tricky part.

Thanks,
Charlie

From: xnat_di...@googlegroups.com <xnat_di...@googlegroups.com> on behalf of Moore, Charlie <moo...@wustl.edu>
Sent: Friday, September 17, 2021 2:51 PM
To: xnat_discussion <xnat_di...@googlegroups.com>
Subject: Re: [XNAT Discussion] determine MR session length?
 

Daniel Drucker

unread,
Sep 17, 2021, 5:53:32 PM9/17/21
to xnat_discussion
Does XNAT cache any of that in its database? If not, this'll be reaaaal slow - to determine the length of the scan will require retrieving the entire (multi-gigabyte) study over NFS. Any way around that? (Or should I do this in Orthanc...)

Daniel Drucker

unread,
Sep 19, 2021, 3:46:56 PM9/19/21
to xnat_discussion
Hi Charlie,

I'm having some trouble with my first time creating a container command. As a first step, I've created a docker images (dmd3eorg/xnat-dicom-tools), which right now is simply:

FROM pydicom/dicom
ADD studylen.py /

and studylen.py is a script which expects a MR session to be mounted at /input, and will write the study duration to the text file /output/study_duration.txt

So, I need to create a json to define a command on that image which will let me run it and have it create that text file in the session. 
Ideally later I'd have a way to add it as a variable, but even just having it in a text file would be a good start. I found the documentation for creating these json command a bit inscrutable...

kel...@wustl.edu

unread,
Sep 20, 2021, 10:25:46 AM9/20/21
to xnat_discussion
Hi Daniel,
I've attached a sample command JSON that I think will get you started. Note especially:

line 7: specify your Docker image name here
line 9: specify your command line (e.g. `python studylen.py`)
lines 17 & 46: maps the session archive folder to the input mount `in` at /input
lines 22, 30 & 73: maps the files in the container folder /output to a session resource named `DEBUG_OUTPUT`
lines 51-68 are not required, but show an example of how to derive other XNAT values from your selected session.

Best,
Matt
study-duration.json
Reply all
Reply to author
Forward
0 new messages