Questions about naming and the conventions followed in xnat for the data

114 views
Skip to first unread message

Sanket Gupte

unread,
Nov 23, 2011, 11:49:50 AM11/23/11
to xnat_discussion
Hi
The following are my questions.

1) When the data goes from Pre-Archive to Archive, it asks me to enter
a few details about the patient (If I want). I already, have patient
details in my dicom-header. Is there a way I can automatically get
those details, from specific felds, for e.g 0010 0020 //Subject ID,
0010 0030// subject birthdate, 0010 0040 //subject sex. Can these
fields be directly assigned, in some way. Like modifying some xml
file. Like it assigns Date added, Accession #, Date, Time, Operator,
Scanner..... etc fields automatically.

2) When I look at the details of a specific subject for a session, it
shows all sets of scans in a table like format. The second attribute
is 'Type'. Now I believe it takes this attribute from (value of)
0008,103e of my header. Is there a way I can change, (value of) which
hex number of the header should be assigned to the 'Type' attribute.
meaning, instead of 0008,103e , say I want to assign 0018,1030 to the
type field. Which file would I have to modify?

3) Lastly, when all the images/scans come into xnat, their names are
changed, and they have a specific pre-defined format. For e.g names
that I get are like 123-222233.MR.A890_EVENING.
11.1.20091212.0890765.dkjfm2.dcm
I am not exactly sure how this naming is done, but I have a few
guesses, based on my header.
<subject-id>.<0008,0060>.<some field of header giving date>.<field of
header giving time>.<I have no idea what that field is>.dcm
Is there a way I could change this naming convention too? We have a
specific naming convention that is being followed here since the last
10 years, it would be difficult to change it completely. People will
not just access the data from the front (web app) end. The will
require to access it often at the back end, like looking into the
ARCHIVE directory.

Thank you very much in advance

Archie, Kevin

unread,
Nov 23, 2011, 12:13:31 PM11/23/11
to <xnat_discussion@googlegroups.com>
Hi, Sanket,

1. A couple of years ago, Yong Gao wrote some code to automatically pull subject information -- this was in DicomServer, back when the C-STORE SCP was a separate application. We haven't incorporated it (in large part because of the big 1.5 restructuring) but I think it would be a useful feature. Which is to say: we don't have any way of doing that automatically yet, but I'll add it as a feature request, and it should be straightforward to implement because there's code to start from.

None of that helps you today. One approach would be to hack up a script that loops over sessions, downloads a DICOM file for each of them, pulls the subject information, and pushes those fields back up to the subject. It seems like that could probably be done in a day or two by someone who knows pyxnat well, and wouldn't require changes to XNAT itself.

2. The rules for converting between DICOM and XNAT metadata are expressed in Java code, in the dicom-xnat-mx library. You'd need to change the code and then replace the jar in plugin-resources/repository.

3. This also requires a code change, but it's a little more straightforward because it doesn't require a jar replacement. You'll need to write a class that implements org.nrg.dcm.DicomFileNamer (from dicom-xnat-util), and then set dicom.file.namer=your.full.class.name in WEB-INF/conf/dicom-importer.properties. Look here: http://groups.google.com/group/xnat_discussion/search?group=xnat_discussion&q=DicomFileNamer&qt_g=Search+this+group for details on how to make this work.

- Kevin

> --
> You received this message because you are subscribed to the Google Groups "xnat_discussion" group.
> To post to this group, send email to xnat_di...@googlegroups.com.
> To unsubscribe from this group, send email to xnat_discussi...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/xnat_discussion?hl=en.
>


________________________________

The material in this message is private and may contain Protected Healthcare Information (PHI). 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.

Olsen, Tim

unread,
Nov 28, 2011, 5:29:55 PM11/28/11
to xnat_di...@googlegroups.com
Regarding 2)

The scan type field is actually not pulled directly from the DICOM. The dicom value is stored in the series_description field. The type is populated when you archive the session, and is set based on the history of the series in your project.

Take a look at my second post on the following thread to see if it helps at all.

http://groups.google.com/group/xnat_discussion/browse_thread/thread/51f7663d0f36b93f/024a5a7cee037daf?lnk=gst&q=Custom+Variables+at+SCAN+level#024a5a7cee037daf

Tim

Sanket Gupte

unread,
Nov 30, 2011, 4:25:00 PM11/30/11
to xnat_di...@googlegroups.com
Hey Tim,
Thanks. That post did clear a few things for me. I am planning to play around with the type field soon.

I need to finish the DicomFileNamer first. Point #2 in my first post.

Hey Kevin
I started trying out the DicomFileNamer. Like you mentioned I found it in org/nrg/dcm.
I am explaining a bit, of what I understood from all those posts and your reply, can you please let me know if its right.

I created a directory 'custom' in ~org/nrg.
I (have to) make a java class CustomFileNamer.java which implements that interface. (viz DicomFileNamer)
Now I didnt find the file 'dicom-importer.properties', so I believe I have to make it.
So, I made file 'dicom-importer.properties'  in <$TOMCAT_HOME>/webapps/<xnat-project-name>/WEB-INF/conf
I wrote "dicom.file.namer=<dicom-xnat-util-home>/src/main/java/org/nrg/custom/CustomFileNamer.class"   in that file
Then I restart the tomcat server.
So, thats the theoretical part. Can you please let me know if I am making a mistake in any of the steps.

Just for the testing purpose, I downloaded the CustomFileNamer.java  (and CustomFileNamer.class) from your post in April 2010, into this directory.
and tried to use it. But turns out a lot of things have changed in the dicom-xnat-util ever since you made that CustomFileNamer.java. There are a few errors, most of which are because it cannot find the specific package.

Has anyone recently made a CustomFileNamer , that they could share. I am having a hard time understanding a few things in that sample class file.
All I want to do is, make up the custom file name, by combining a few attributes of the scans, such as patient_id, date, type and the hash.
If someone could instruct me, how to make the CustomFileNamer.java (from that earlier thread) working, then that would suffice too...

Thanks a lot for your help

Archie, Kevin

unread,
Dec 7, 2011, 11:04:13 AM12/7/11
to <xnat_discussion@googlegroups.com>
Hi, Sanket,

Sorry about the delay in responding. I've attached an updated CustomFileNamer; many of the utility classes that we used in the earlier code have been reorganized or eliminated. This one compiles in my 1.5 development XNAT (I put it in projects/xnat/src/main/java/org/nrg/custom/) though I haven't tested it. Do please let me know if you have any problems or questions.

  - Kevin


--
You received this message because you are subscribed to the Google Groups "xnat_discussion" group.
To view this discussion on the web visit https://groups.google.com/d/msg/xnat_discussion/-/iTB-QTPpxgwJ.

To post to this group, send email to xnat_di...@googlegroups.com.
To unsubscribe from this group, send email to xnat_discussi...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/xnat_discussion?hl=en.
CustomFileNamer.java

Sanket Gupte

unread,
Dec 8, 2011, 10:06:13 AM12/8/11
to xnat_di...@googlegroups.com
Hi Kevin,
Thanks for the File.
But I am still getting similar error. I am pretty sure, I downloaded the correct version of your dicom-xnat repository but thats the source. Because I am not able to clone it using mercurial  For the https it gives error "abort: error: _ssl.c:336: error:00000000:lib(0):func(0):reason(0)"
Whereas for ssh I get "remote: Permission denied (publickey).
abort: no suitable response from remote hg!"
So, I downloaded the source, and I am trying to compile everything.
The first thing that I tried to compile was the java file in dcm4che2. Since I that class is mainly required by many others. I got a few errors and many of them were  'com.google.common.*' package missing. So I installed google collections package. But the errors have not gone completely. Seems like there is interdependency of packages in the dicom-xnat repository. I dont know which package to compile first.
Can you please tell me, how to get your compiled version of the dicom-xnat repo. Or if you know what the problem is, with my mercurial download. (As I mentioned the problems with download in my first line)
Thanks a lot
I really appreciate the efforts of all of you..

Archie, Kevin

unread,
Dec 8, 2011, 10:18:38 AM12/8/11
to <xnat_discussion@googlegroups.com>
Sankat,

There's something of a web of dependencies. By far the easiest way to get this set up would be to compile it in the context of an XNAT, since the dicom-xnat jar is already included there. The best place to put this code would be in a subdirectory of $XNAT_HOME/projects/$PROJECT/src/main/java ; if the fully qualified class name is org.nrg.custom.CustomFileNamer (as I used), then you'd put it in .../src/main/java/org/nrg/custom/CustomFileNamer.java .

If you put your class there, it should get built and installed when you do an update. You can use a plain old text editor to edit the file, or if you want to use an IDE, there are instructions for getting Eclipse working with XNAT here: http://docs.xnat.org/XNAT+Eclipse+Integration . (I know people have done similar things with NetBeans and IntelliJ IDEA.)

  - Kevin

--
You received this message because you are subscribed to the Google Groups "xnat_discussion" group.
To view this discussion on the web visit https://groups.google.com/d/msg/xnat_discussion/-/z6144dx192gJ.

To post to this group, send email to xnat_di...@googlegroups.com.
To unsubscribe from this group, send email to xnat_discussi...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/xnat_discussion?hl=en.

Olsen, Tim

unread,
Dec 8, 2011, 10:33:18 AM12/8/11
to xnat_di...@googlegroups.com

One minor correction…

 

The file would go in

 

$XNAT_HOME/projects/$PROJECT/src/java

 

Rather than

 

$XNAT_HOME/projects/$PROJECT/src/main/java

 

Having a main subdirectory would have been proper, but its not there.  That will be fixed in XNAT 2.0 J.

 

Tim

 

From: xnat_di...@googlegroups.com [mailto:xnat_di...@googlegroups.com] On Behalf Of Archie, Kevin
Sent: Thursday, December 08, 2011 9:19 AM
To: <xnat_di...@googlegroups.com>
Subject: Re: [XNAT Discussion] Questions about naming and the conventions followed in xnat for the data

 

Sankat,

Archie, Kevin

unread,
Dec 8, 2011, 10:38:13 AM12/8/11
to <xnat_discussion@googlegroups.com>
Oops. Thanks Tim.

  - k

Sanket Gupte

unread,
Dec 8, 2011, 11:02:58 AM12/8/11
to xnat_di...@googlegroups.com
Thanks a lot Kevin and Tim. That worked.
(Atleast thats what I think). There is a CustomFileNamer.class file at the following places now..

/tomcat/webapps/$PROJECT/WEB-INF/classes/org/nrg/custom/CustomFileNamer.class
./$XNAT_HOME/deployments/$PROJECT/target/classes/org/nrg/custom/CustomFileNamer.class

and I believe it means that it got compiled.
Reply all
Reply to author
Forward
0 new messages