fix: dicom json launch and documentation (#2642)

* fix: typo in metadataProvider class name

* docs: Add dicom-json documentation

* fix: documentation with s3 links
This commit is contained in:
Alireza 2022-01-10 21:27:24 -05:00 committed by GitHub
parent c2bbfc2cac
commit 987eceb40a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 211 additions and 46 deletions

View File

@ -3,7 +3,7 @@ import OHIF from '@ohif/core';
import getImageId from '../DicomWebDataSource/utils/getImageId';
const metadataProvider = OHIF.classes.metadataProvider;
const metadataProvider = OHIF.classes.MetadataProvider;
const mappings = {
studyInstanceUid: 'StudyInstanceUID',
@ -93,7 +93,7 @@ function createDicomJSONApi(dicomJsonConfig) {
},
query: {
studies: {
mapParams: () => { },
mapParams: () => {},
search: async param => {
const [key, value] = Object.entries(param)[0];
const mappedParam = mappings[key];

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 646 KiB

View File

@ -0,0 +1,4 @@
{
"label": "Data Sources",
"position": 2
}

View File

@ -0,0 +1,155 @@
---
sidebar_position: 3
sidebar_label: DICOM JSON
---
# DICOM JSON
You can launch the OHIF Viewer with a JSON file which points to a DICOMWeb
server as well as a list of study and series instance UIDs along with metadata.
An example would look like
`https://v3-demo.ohif.org/viewer/dicomjson?url=https://ohif-dicom-json-example.s3.amazonaws.com/LIDC-IDRI-0001.json`
As you can see the url to the location of the JSON file is passed in the query
after the `dicomjson` string, which is
`https://ohif-dicom-json-example.s3.amazonaws.com/LIDC-IDRI-0001.json` (this
json file has been generated by OHIF team and stored in an amazon s3 bucket for
the purpose of the guide).
## DICOM JSON sample
Here we are using the LIDC-IDRI-0001 case which is a sample of the LIDC-IDRI
dataset. Let's have a look at the JSON file:
### Metadata
JSON file stores the metadata for the study level, series level and instance
level. A JSON launch file should follow the same structure as the one below.
Note that at the instance level metadata we are storing both the `metadata` and
also the `url` for the dicom file on the dicom server. In this case we are
referring to
`dicomweb:https://ohif-dicom-json-example.s3.amazonaws.com/LIDC-IDRI-0001/01-01-2000-30178/3000566.000000-03192/1-001.dcm`
which is stored in another directory in our s3. (You can actually try
downloading the dicom file by opening the url in your browser).
```json
{
"studies": [
// first study metadata
{
"StudyInstanceUID": "1.3.6.1.4.1.14519.5.2.1.6279.6001.298806137288633453246975630178",
"StudyDate": "20000101",
"StudyTime": "",
"PatientName": "",
"PatientID": "LIDC-IDRI-0001",
"AccessionNumber": "",
"PatientAge": "",
"PatientSex": "",
"series": [
// first series metadata
{
"SeriesInstanceUID": "1.3.6.1.4.1.14519.5.2.1.6279.6001.179049373636438705059720603192",
"SeriesNumber": 3000566,
"Modality": "CT",
"SliceThickness": 2.5,
"instances": [
// first instance metadata
{
"metadata": {
"Columns": 512,
"Rows": 512,
"InstanceNumber": 1,
"SOPClassUID": "1.2.840.10008.5.1.4.1.1.2",
"PhotometricInterpretation": "MONOCHROME2",
"BitsAllocated": 16,
"BitsStored": 16,
"PixelRepresentation": 1,
"SamplesPerPixel": 1,
"PixelSpacing": [0.703125, 0.703125],
"HighBit": 15,
"ImageOrientationPatient": [1, 0, 0, 0, 1, 0],
"ImagePositionPatient": [-166, -171.699997, -10],
"FrameOfReferenceUID": "1.3.6.1.4.1.14519.5.2.1.6279.6001.229925374658226729607867499499",
"ImageType": ["ORIGINAL", "PRIMARY", "AXIAL"],
"Modality": "CT",
"SOPInstanceUID": "1.3.6.1.4.1.14519.5.2.1.6279.6001.262721256650280657946440242654",
"SeriesInstanceUID": "1.3.6.1.4.1.14519.5.2.1.6279.6001.179049373636438705059720603192",
"StudyInstanceUID": "1.3.6.1.4.1.14519.5.2.1.6279.6001.298806137288633453246975630178",
"WindowCenter": -600,
"WindowWidth": 1600,
"SeriesDate": "20000101"
},
"url": "dicomweb:https://ohif-dicom-json-example.s3.amazonaws.com/LIDC-IDRI-0001/01-01-2000-30178/3000566.000000-03192/1-001.dcm"
},
// second instance metadata
{
"metadata": {
"Columns": 512,
"Rows": 512,
"InstanceNumber": 2,
"SOPClassUID": "1.2.840.10008.5.1.4.1.1.2",
"PhotometricInterpretation": "MONOCHROME2",
"BitsAllocated": 16,
"BitsStored": 16,
"PixelRepresentation": 1,
"SamplesPerPixel": 1,
"PixelSpacing": [0.703125, 0.703125],
"HighBit": 15,
"ImageOrientationPatient": [1, 0, 0, 0, 1, 0],
"ImagePositionPatient": [-166, -171.699997, -12.5],
"FrameOfReferenceUID": "1.3.6.1.4.1.14519.5.2.1.6279.6001.229925374658226729607867499499",
"ImageType": ["ORIGINAL", "PRIMARY", "AXIAL"],
"Modality": "CT",
"SOPInstanceUID": "1.3.6.1.4.1.14519.5.2.1.6279.6001.512235483218154065970649917292",
"SeriesInstanceUID": "1.3.6.1.4.1.14519.5.2.1.6279.6001.179049373636438705059720603192",
"StudyInstanceUID": "1.3.6.1.4.1.14519.5.2.1.6279.6001.298806137288633453246975630178",
"WindowCenter": -600,
"WindowWidth": 1600,
"SeriesDate": "20000101"
},
"url": "dicomweb:https://ohif-dicom-json-example.s3.amazonaws.com/LIDC-IDRI-0001/01-01-2000-30178/3000566.000000-03192/1-002.dcm"
}
// ..... other instances metadata
]
}
// ... other series metadata
],
"NumInstances": 133,
"Modalities": "CT"
}
// second study metadata
]
}
```
![](../../assets/img/dicom-json.png)
### Local Demo
You can run OHIF with a JSON data source againts you local datasets (given that
their JSON metadata is extracted).
First you need to put the JSON file and the folder containing the dicom files
inside your `public` folder. Since files are served from your local server the
`url` for the JSON file will be `http://localhost:3000/LIDC-IDRI-0001.json` and
the dicom files will be
`dicomweb:http://localhost:3000/LIDC-IDRI-0001/01-01-2000-30178/3000566.000000-03192/1-001.dcm`.
After `yarn install` and running `yarn dev` and opening the browser at
`http://localhost:3000/viewer/dicomjson?url=http://localhost:3000/LIDC-IDRI-0001.json`
will display the viewer.
Download JSON file from
[here](https://www.dropbox.com/sh/zvkv6mrhpdze67x/AADLGK46WuforD2LopP99gFXa?dl=0)
Sample DICOM files can be downloaded from
[TCIA](https://wiki.cancerimagingarchive.net/display/Public/LIDC-IDRI) or
directly from
[here](https://www.dropbox.com/sh/zvkv6mrhpdze67x/AADLGK46WuforD2LopP99gFXa?dl=0)
Your public folder should look like this:
![](../../assets/img/dicom-json-public.png)

View File

@ -1,9 +1,9 @@
---
sidebar_position: 2
sidebar_label: Data Sources
sidebar_position: 1
sidebar_label: DICOMweb
---
# Data Sources
# DICOMweb
## Set up a local DICOM server
@ -97,7 +97,7 @@ yarn run dev:orthanc
#### Configuration: Learn More
> For more configuration fun, check out the
> [Essentials Configuration](./index.md) guide.
> [Essentials Configuration](../index.md) guide.
Let's take a look at what's going on under the hood here. `yarn run dev:orthanc`
is running the `dev:orthanc` script in our project's `package.json` (inside
@ -154,7 +154,7 @@ window.config = {
```
To learn more about how you can configure the OHIF Viewer, check out our
[Configuration Guide](./index.md).
[Configuration Guide](../index.md).
### Running DCM4CHEE
@ -189,42 +189,3 @@ below:
https://github.com/OHIF/Viewers/tree/master/platform/viewer/public/html-templates
[config-files]:
https://github.com/OHIF/Viewers/tree/master/platform/viewer/public/config
## Static Files
There is a binay DICOM to static file generator, which provides easily served
binary files. The files are all compressed in order to reduce space signifcantly,
and are pre-computed for the files required for OHIF, so that the performance
of serving the files is just the read from disk/write to http stream time, without
any extra processing time.
The project for the static wado files is located here:
[static-wado]: https://github.com/wayfarer3130/static-wado
It can be compiled with Java and Gradle, and then run against a set of dicom,
in the example located in /dicom/study1 outputting to /dicomweb, and then a
server run against that data, like this:
```
git clone https://github.com/wayfarer3130/static-wado.git
cd static-wado
./gradlew installDist
StaticWado/build/install/StaticWado/bin/StaticWado -d /dicomweb /dicom/study1
cd /dicomweb
npx http-server -p 5000 --cors -g
```
There is then a dev environment in the platform/viewer directory which can be run
against those files, like this:
```
cd platform/viewer
yarn dev:static
```
Additional studies can be added to the dicomweb by re-running the StaticWado command.
It will create a single studies.gz index file (JSON DICOM file, compressed)
containing an index of all studies created. There is then a small extension
to OHIF which performs client side indexing.
The StaticWado command also knows how to deploy a client and dicomweb directory
to Amazon s3, which can then server files up directly. There is another
build setup build:aws in the viewer package.json to create such a deployment.

View File

@ -0,0 +1,45 @@
---
sidebar_position: 2
sidebar_label: Static Files
---
# Static Files
There is a binary DICOM to static file generator, which provides easily served
binary files. The files are all compressed in order to reduce space
significantly, and are pre-computed for the files required for OHIF, so that the
performance of serving the files is just the read from disk/write to http stream
time, without any extra processing time.
The project for the static wado files is located here: [static-wado]:
https://github.com/wayfarer3130/static-wado
It can be compiled with Java and Gradle, and then run against a set of dicom, in
the example located in /dicom/study1 outputting to /dicomweb, and then a server
run against that data, like this:
```
git clone https://github.com/wayfarer3130/static-wado.git
cd static-wado
./gradlew installDist
StaticWado/build/install/StaticWado/bin/StaticWado -d /dicomweb /dicom/study1
cd /dicomweb
npx http-server -p 5000 --cors -g
```
There is then a dev environment in the platform/viewer directory which can be
run against those files, like this:
```
cd platform/viewer
yarn dev:static
```
Additional studies can be added to the dicomweb by re-running the StaticWado
command. It will create a single studies.gz index file (JSON DICOM file,
compressed) containing an index of all studies created. There is then a small
extension to OHIF which performs client side indexing.
The StaticWado command also knows how to deploy a client and dicomweb directory
to Amazon s3, which can then server files up directly. There is another build
setup build:aws in the viewer package.json to create such a deployment.