dicom-web-client
Simple dicom client with typescript types to interact with dicom-web REST API
WORK IN PROGRESS
Github
API
There are 3 levels in this api:
- Study
- Series
- Intance
Each of them has their own interfaces and slightly different types available. They try to representate the levels specified in the official DICOM specifications. However this API was built for a personal project with limited need for support of DICOM-Tags, so it is not nearly complete.
This package uses the fetch API (https://developer.mozilla.org/de/docs/Web/API/Fetch_API)
You will need to import the DicomClient class on which ou can modify the fetch function with the DicomClient.setFetchFunction(fetchFn). If you are using the DicomClient in Node, you will need to pass a baseUrl to the constructor as node-fetch does not support relative URLs.
DicomClass
new DicomClass({ baseUrl?: string, auth: string})
- creates DicomClass on which all other functions are available, basUrl will be prepended on all requests, auth will be used to populate the Authorization header on requests.
Study
getUserStudies() : DicomStudyResponse[]
- calls to dicom-web/studies and returns array of studys
Series
getSeriesInStudy(studyUID : string) : DicomSeriesResponse[]
- calls to dicom-web/studies/{studyId} and returns array of DicomSeriesResponse
Instances
getInstancesInSeries(studyUID : string, seriesUID : string)
- calls to dicom-web/studies/{studyId}/series/{seriesUID} and returns instances in series
getInstanceMetadata(studyUID : string, seriesUID : string, instanceUID : string)
- calls to dicom-web/studies/{studyId}/series/{seriesUID}/instanes/{instanceUID}/metadata and returns metadata of series
Models
DicomStudyResponse
Tags included: http://dicom.nema.org/medical/dicom/current/output/chtml/part18/sect_10.6.3.3.html
DicomSeriesResponse
Tags included: http://dicom.nema.org/medical/dicom/current/output/chtml/part18/sect_10.6.3.3.2.html
studyUID : string
getThumbnail() : null | string
- calls to dicom-web/studies/{this.StudyInstanceUID}/series/{this.SeriesInstanceUID}/thumbnail and creates blobURL to be used as image source in browser
Scheduled "ProcedureStepID" and "RequestedProcedureID" is changed to optional due to it missing often
DicomInstanceResponse
Tags included: http://dicom.nema.org/medical/dicom/current/output/chtml/part18/sect_10.6.3.3.3.html
studyUID : string
seriesUID : string
Tags
Tags and their settings are defined in tags.ts.
If you encounter a problem with a tag you can look up the settings for that tag and change the type to optional if you dont need the tag. In that case a default value of "undefined" is returned if it is a date or string or -1 if it is a number.
If the tag in the server response has a weird format you can specify customGetters : ((e : unknown)=>unknown)[] on the tag, then the parser(getTag()) will try all customGetters, passing in the value of incomingObject[{tag}]["Value"] in the order specified until one customGetter returns a value with the correct return type.