XNAT 1.8 OHIF 3.0 proper way to upload scans?

207 views
Skip to first unread message

Stefan Zink

unread,
Mar 16, 2021, 12:11:10 PM3/16/21
to xnat_discussion

I'm starting to use XNAT 1.8 with the latest OHIF plugin 3.0.

When I use the compressed uploader via the UI I can view the scan via the OHIF plugin.

However when I use the REST API to upload, I get an error that "There are no scans in this session compatible with the OHIF Viewer." All files seem to be there and I can work with them normally when I download them from the XNAT and view them with an external viewer. The problem seems to be that there is some kind of information missing for the OHIF viewer but I couldn't find anything in the logs.

What is the cause of this? I've tried to refresh the catalog. Do I need to do anything else?

Details on what I've done so far:

Create a project:
(PUT) /data/projects/DICOM_Upload_Test

Create a subject:
(PUT) /data/projects/DICOM_Upload_Test/subjects/TCGA-BP-4761?gender=M&handedness=Left&weight=81.647

Create an experiment:
(PUT) /data/projects/DICOM_Upload_Test/subjects/XNAT11_S00002/experiments/TCGA-BP-4761?xnat:mrSessionData/date=1988-05-04&fieldStrength=1.5&date=1988-05-04&project=DICOM_Upload_Test&dcmPatientWeight=81.647&subject_ID=XNAT11_S00002&dcmPatientName=TCGA-BP-4761&dcmPatientId=TCGA-BP-4761&dcmAccessionNumber=TCGA-BP-4761

Create a Scan:
(PUT) /data/projects/DICOM_Upload_Test/subjects/XNAT11_S00002/experiments/XNAT11_E00002/scans/7?xsiType=xnat:mrScanData&xnat:mrScanData/type=T1

Upload DICOM (for 88 files):
(PUT) '/data/projects/DICOM_Upload_Test/subjects/XNAT11_S00002/experiments/XNAT11_E00002/scans/7/resources/DICOM/files/000000.dcm'
with 'application/octet-stream' as the Content-Type and the file as data.


Moore, Charlie

unread,
Mar 16, 2021, 12:48:28 PM3/16/21
to xnat_di...@googlegroups.com
Hello,

"The problem seems to be that there is some kind of information missing for the OHIF viewer" - spot on, you are correct. When you upload data through any of XNAT's standard importers (for example the compressed uploader (DICOM-zip), C-STORE (Gradual DICOM Importer), etc.), XNAT automatically extracts a lot of important metadata from the DICOM headers. However, if you manually construct a session/scans and upload DICOM files as resources like this, you bypass the session building process.

I'm not sure of the exact required fields for the OHIF viewer to work properly, but I do know that at minimum the Study/Series Instance UIDs have to be specified. Try this:
  1. Set "UID" on the session/experiment equal to the value in (0020,000D) Study Instance UID in the DICOM, and
  2. For each scan, set "UID" equal to the value in (0020,000E) Series Instance UID in the DICOM (for the corresponding series)
Let me know if that's sufficient to get the viewer working. If not, I can take a closer look.

Thanks,
Charlie

From: xnat_di...@googlegroups.com <xnat_di...@googlegroups.com> on behalf of Stefan Zink <stefanz...@gmail.com>
Sent: Tuesday, March 16, 2021 9:59 AM
To: xnat_discussion <xnat_di...@googlegroups.com>
Subject: [XNAT Discussion] XNAT 1.8 OHIF 3.0 proper way to upload scans?
 

* 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/4819bcf4-4fd7-43b7-a05c-d7f96e0a70bfn%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.

Simon Doran

unread,
Mar 16, 2021, 7:37:02 PM3/16/21
to xnat_discussion
Hi Stefan and Charlie,

  This is not unexpected behaviour. To understand why, you need a bit of background on how the "vanilla", i.e., non-XNAT-integrated OHIF viewer works. It's primarily intended to work with database backends that support the DICOMWeb protocol. In particular, the viewer assumes that it can query the backend with things like DICOM StudyInstanceUIDs and SOPInstanceUIDs to retrieve data. Unfortunately, XNAT doesn't (yet) support this method of retrieving data (not least because of incompatibilities between the XNAT data model - which, for instance, allows a given image to be stored in multiple different projects and hence locations on disk - and the DICOM information model). 

  In order to overcome this, we use a secondary mode of access of OHIF, which allows the necessary information to be stored in a "sidecar" JSON file - typically, one associated with each session. Originally, we stored this information in the archive directory, so that if you knew what you were doing, you could go searching on the filesytem and take a look. From v 3.0.0 onwards, this is now part of the XNAT configuration service.

  Again, a bit of background/history. In version 1 of the XNAT integration, this sidecar file was created at the time of first viewing of the file. However, since the process was quite long, it used to lead to a quite a substantial delay, which we rapidly discovered was unacceptable, before the first view of any session. Hence, what happens now if that upload of an imaging session triggers the compilation of this information. Everything happens in the background and nobody notices.

  I strongly suspect that the reason you are unable to view your data uploaded via REST is that this metadata- creation call is never triggered. Happily, as long as you have admin privileges (and we might have to reconsider what happens if you don't) you can do this either manually or as part of the script that uploads your data.

  Head to the Swagger page on your XNAT (Administer -> Site Administation -> Miscellaneous -> View the Swagger page) and check out the OHIF viewer API:

Screenshot 2021-03-16 at 23.30.28.png
 To create the metadata for one of the sessions where you have uploaded data, try out this call (might be slightly different in 1.8 - this is a screenshot from 1.7) and see what happens.

  If you are still experiencing problems, let us know, but bear with us, as the programmer who coded this xapi is on leave this week.

  Best wishes,

Simon

Stefan Zink

unread,
Mar 17, 2021, 6:32:05 AM3/17/21
to xnat_discussion
Hi Simon and Charlie

Thank you for your suggestions. The addition of the UID has helped in a sense that I can now view the DICOM tags for the scan. Sadly the OHIF viewer does still refuse to show the images.
I've also included the modality, series description, quality, type, frames and a note but to no avail.

(PUT) /data/projects/DICOM_Upload/subjects/XNAT11_S00009/experiments/XNAT11_E00011/scans/22?xsiType=xnat:ctScanData&UID=1.3.6.1.4.1.14519.5.2.1.9203.4004.217404615701211915150587583605&modality=CT&series_description=trullala&quality=usable&type=CT&frames=417&note=test

I've run
(POST) /xapi/viewer/generate-all-metadata
to generate the metadata but this did not change the results after waiting for some minutes to let it finish creating the metadata.

When downloading the XML structure of the (working) experiment I noticed that the scan has an additional structure simply called "parameters" that might correlate to the viewer. Should these be created by the call to "generate-all-metadata" or does this only affect said json?

Here is an extracted example of the scan/parameters of a working experiment. I don't know how I would PUT this to the scan however. Could this be related?

...
<xnat:parameters>
  <xnat:voxelRes x="0.703125" y="0.703125" z="3.0"/>
  <xnat:orientation>Cor</xnat:orientation>
  <xnat:fov x="512" y="512"/>
  <xnat:tr>3.7</xnat:tr>
  <xnat:te>0.8360000253</xnat:te>
  <xnat:ti>25.0</xnat:ti>
  <xnat:flip>15</xnat:flip>
  <xnat:imageType>ORIGINAL\\PRIMARY\\OTHER</xnat:imageType>
  <xnat:scanSequence>GR</xnat:scanSequence>
  <xnat:seqVariant>SS\\SP\\SK</xnat:seqVariant>
  <xnat:scanOptions>FAST_GEMS\\SAT_GEMS\\VB_GEMS\\PFF\\FS</xnat:scanOptions>
  <xnat:acqType>3D</xnat:acqType>
  <xnat:pixelBandwidth>244.140625</xnat:pixelBandwidth>
</xnat:parameters>
...

Thanks,
Stefan

Moore, Charlie

unread,
Mar 17, 2021, 11:17:51 AM3/17/21
to xnat_di...@googlegroups.com
Hi Stefan,

The "parameters" section contains more bits of metadata extracted by XNAT during the standard import process. It shouldn't really be critical for the viewer. Assuming the data that isn't working isn't sensitive (which seems like a good guess as the labels make it look like TCIA data), can you post the JSON the viewer is trying to use? You should be able to access it at URL/xapi/viewer/projects/$PROJECT_ID/experiments/$SESSION_ID .

Thanks,
Charlie

Sent: Wednesday, March 17, 2021 5:32 AM
To: xnat_discussion <xnat_di...@googlegroups.com>
Subject: Re: [XNAT Discussion] XNAT 1.8 OHIF 3.0 proper way to upload scans?
 

* External Email - Caution *

Hi Simon and Charlie
--
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.
Reply all
Reply to author
Forward
0 new messages