New data type - ismrmrd

59 views
Skip to first unread message

Christoph Kolbitsch

unread,
Dec 29, 2022, 9:17:04 AM12/29/22
to xnat_discussion
During the XNAT workshop in London we managed to create an xnat plugin for MR raw data based on the ISMRMRD data format. I can install the plugin and add data (mrd:mrdScanData) in this format to the database. All good!

The current code can be found here: https://github.com/ckolbPTB/xnat-ismrmrd/tree/simple

Nevertheless, I still have problems with searching for this data in the database.

I get e.g. the following error for MRDs:
Bildschirmfoto 2022-12-28 um 22.08.17.png
I tried to trace the error using the logs. In xnat.log I get (the line numbers might not be exactly the same as in the main code as I added some logging statements in DisplaySearch.java):
java.lang.NullPointerException: null
   at org.nrg.xdat.search.DisplaySearch.convertToStoredSearch(DisplaySearch.java:1668)
   at org.nrg.xdat.search.DisplaySearch.convertToStoredSearch(DisplaySearch.java:1581)
   at org.nrg.xdat.om.base.BaseXnatProjectdata.getDefaultSearch(BaseXnatProjectdata.java:878)
   at org.nrg.xdat.om.base.BaseXnatProjectdata.getDefaultSearch(BaseXnatProjectdata.java:567)
   at org.nrg.xnat.restlet.resources.ProjectSearchResource.represent(ProjectSearchResource.java:71)
   at org.restlet.resource.Resource.getRepresentation(Resource.java:302)
   at org.restlet.resource.Resource.handleGet(Resource.java:464)

The error refers to this line in src/main/java/org/nrg/xdat/search/DisplaySearch.java

DisplayVersion rootdv = ed.getVersion(this.getDisplay(), "listing");

because ed is None. In line 1610 in src/main/java/org/nrg/xdat/search/DisplaySearch.java ed is created:

ElementDisplay ed = DisplayManager.GetElementDisplay(xss.getRootElementName());

The function GetElementDisplay() is defined in line 127 in src/main/java/org/nrg/xdat/display/DisplayManager.java:

public static ElementDisplay GetElementDisplay(String name) {
return (ElementDisplay) GetInstance().getElements().get(name);
}

The function GetInstance().getElements() returns a long list of all elements but "mrd:mrdScanData" is not part of it and hence
GetInstance().getElements().get(name) returns Null

Long story short, I think mrd:mrdScanData still needs to be added somewhere such that GetElementDisplay() does not return Null. Does anybody have an idea where this might be? I am also grateful for any other suggestions of where I can go digging to debug this problem further.
 

Rick Herrick

unread,
Jan 3, 2023, 11:14:01 AM1/3/23
to xnat_di...@googlegroups.com
I think the issue is that you haven’t configured your scan data type as secure, meaning it doesn’t have an element display configuration to return there. The stored searches used by the display table code requires that, as you can tell :) You can read more about this in the documentation for Working with Scan Listings.

You can test this by enabling that data type manually:
  1. Go to Administer -> Data Types in the XNAT UI
  2. Click the Setup Additional Data Type button
  3. Find your data type in the Data Type list and click Submit
  4. Make sure Is this Data Type Secure? is set to true (it’s set to that by default)
  5. Enter any other info (e.g. singular and plural names) and click Next
  6. Click Next again
Your scan data type should now be configured, so try the table view again.

Presuming that works, you can make this happen automatically with your plugin by adding a class annotated with @XnatPlugin. Specifically, you can configure your data model(s) automatically when the plugin is started and the data type added to XNAT. Yours might look something like this:

@XnatPlugin(value = "mrIsmrmrdPlugin",
            name = "XNAT MR ISMRMRD Data Type Plugin",
            version = "1.0",
            dataModels = {@XnatDataModel(value = XnatIsmrmrdMrismrmrdscandata.SCHEMA_ELEMENT_NAME,
                                         singular = "MR Raw Data",
                                         plural = "MR Raw Data",
                                         code = "MRD")})
public class MrIsmrmrdPlugin {
}

This will have the same effect as manually enabling the data type, so it’s better for production systems and distributing your plugin to other users.

Rick Herrick
Senior Software Developer


------ Original Message ------
From "Christoph Kolbitsch" <chris.k...@gmail.com>
To "xnat_discussion" <xnat_di...@googlegroups.com>
Date 12/29/2022 8:17:04 AM
Subject [XNAT Discussion] New data type - ismrmrd

--
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/fdad98ac-fec8-476a-93ba-91d3ef9805c4n%40googlegroups.com.

Christoph Kolbitsch

unread,
Jan 4, 2023, 2:20:18 PM1/4/23
to xnat_discussion
Thanks Rick for your suggestion but this does not seem to solve my problem. I already had configured the data type looking like this:

Bildschirmfoto 2023-01-04 um 20.18.12.png
and

Bildschirmfoto 2023-01-04 um 20.19.13.png

Did I maybe do something wrong there?

Rick Herrick

unread,
Jan 4, 2023, 4:19:41 PM1/4/23
to xnat_di...@googlegroups.com
Okay, try this: modify build.gradle to add the following:

sourceSets {
    main {
        java {
            srcDir "build/xnat-generated/src/main/java"
        }
        resources {
            srcDir "build/xnat-generated/src/main/resources"
        }
    }
}

tasks.withType(Jar) {
    duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}

I put these lines right before the task sourcesJar block. This causes the build to add all of the auto-generated code generated by the XNAT data builder Gradle plugin into the plugin jar, specifically the display document for your data type. Then build the plugin jar with:

./gradlew clean xnatPluginJar

Install the generated xnat-ismrmrd-1.0.0-SNAPSHOT-xpl.jar and restart XNAT. This should fix the problem.

Rick Herrick
Senior Software Developer


------ Original Message ------
From "Christoph Kolbitsch" <chris.k...@gmail.com>
To "xnat_discussion" <xnat_di...@googlegroups.com>
Date 1/4/2023 1:20:18 PM
Subject Re: [XNAT Discussion] New data type - ismrmrd

Thanks Rick for your suggestion but this does not seem to solve my problem. I already had configured the data type looking like this:

Bildschirmfoto 2023-01-04 um 20.18.12.png
and

Bildschirmfoto 2023-01-04 um 20.19.13.png

Did I maybe do something wrong there?
On Tuesday, January 3, 2023 at 5:14:01 PM UTC+1 Rick Herrick wrote:
I think the issue is that you haven’t configured your scan data type as secure, meaning it doesn’t have an element display configuration to return there. The stored searches used by the display table code requires that, as you can tell 😀 You can read more about this in the documentation for Working with Scan Listings.

Christoph Kolbitsch

unread,
Jan 5, 2023, 3:03:49 AM1/5/23
to xnat_discussion
That did the trick! Thank you so much!

Bildschirmfoto 2023-01-05 um 09.03.17.png
Reply all
Reply to author
Forward
0 new messages