ImFusion SDK 4.3
WebClient Class Reference

#include <ImFusion/Dicom/WebClient.h>

Interface for querying and retrieving objects from a DicomWeb compliant server. More...

Detailed Description

Interface for querying and retrieving objects from a DicomWeb compliant server.

An WebClient object will only communicate with the initial server URL. It therefore does not use the RetrieveURL of received requests directly, but only uses URLs relative to the base server URL.

All responses are automatically converted from JSON to a DcmItem. Some methods also provide a minimalParsing argument, which will only parse a fixed set of 1-3 tags instead of converting all tags returned by the JSON.

The client optionally supports authentication/authorization by setting the HTTP Authorization header.

This class provides low-level access to a DicomWeb server. For a high-level interface use DatasetCache for loading image or Scanner for search.

Public Member Functions

 WebClient (Filesystem::Url url, ErrorRecorder *recorder)
 Create a new instance that will communicate with the given DicomWeb URL.
 
const Filesystem::UrlbaseUrl () const
 Return the URL that will be used as the base for all requests.
 
void setAuthorizationHeader (std::string auth)
 Set the content of the HTTP Authorization header.
 
std::string authorizationHeader () const
 
void setAuthorizationProvider (std::shared_ptr< Network::AuthorizationProvider > authProvider)
 Set a provider for the content of the Authorization header.
 
std::shared_ptr< Network::AuthorizationProviderauthorizationProvider () const
 
DcmItemsResult getStudies (std::string query, bool minimalParsing)
 Returns a list of a studies on the server.
 
DcmItemsResult getSeries (DcmItem &study, std::string query, bool minimalParsing)
 Returns a list of a series for a given study.
 
DcmItemsResult getSeries (std::string studyRetrieveUrl, std::string query, bool minimalParsing)
 Returns a list of a series from the given path.
 
DcmItemsResult getInstances (DcmItem &series, std::string query, bool minimalParsing)
 Returns a list of a instances for a given series.
 
DcmItemsResult getInstances (std::string seriesRetrieveUrl, std::string query, bool minimalParsing)
 Returns a list of a instances from the given path.
 
DcmDatasetsResult getInstance (DcmItem &instance)
 Returns a single instance (e.g.
 
DcmDatasetsResult getInstance (std::string instanceRetrieveUrl)
 Returns a single instance (e.g.
 

Constructor & Destructor Documentation

◆ WebClient()

WebClient ( Filesystem::Url url,
ErrorRecorder * recorder )

Create a new instance that will communicate with the given DicomWeb URL.

The URL should be the base URL for all DicomWeb endpoints (e.g. for Orthanc this is http://example.com/dicom-web). The query and fragments of the URL will be removed. All errors that happen during any request are forwarded to the error recorder.

Member Function Documentation

◆ setAuthorizationHeader()

void setAuthorizationHeader ( std::string auth)

Set the content of the HTTP Authorization header.

If empty (the default), no Authorization header is send. This needs to be the full content of the header, e.g. "Basic ABCdef123" or "Bearer XYZabc123".

◆ setAuthorizationProvider()

void setAuthorizationProvider ( std::shared_ptr< Network::AuthorizationProvider > authProvider)

Set a provider for the content of the Authorization header.

The provider is also called when a requests fails with 401 to refresh the token. If setAuthorization was called with a non-empty value, the provider is not used.

◆ getStudies()

DcmItemsResult getStudies ( std::string query,
bool minimalParsing )

Returns a list of a studies on the server.

The optional query will be used directly as query in the URL, e.g. "?PatientName=Bob&00200010=2" to filter by PatientName and StudyID. See https://dicom.nema.org/dicom/2013/output/chtml/part18/sect_6.7.html#table_6.7.1-1 for supported values. The query is not validated and used as is.

If minimalParsing is true, the returned results will only contain StudyInstanceUID and RetrieveURL.

◆ getSeries() [1/2]

DcmItemsResult getSeries ( DcmItem & study,
std::string query,
bool minimalParsing )

Returns a list of a series for a given study.

The given study must contain a StudyInstanceUID (e.g. the result of getStudies). Calls the method below.

◆ getSeries() [2/2]

DcmItemsResult getSeries ( std::string studyRetrieveUrl,
std::string query,
bool minimalParsing )

Returns a list of a series from the given path.

The path should be /studies/<study_uid>, but this is not enforced.

See https://dicom.nema.org/dicom/2013/output/chtml/part18/sect_6.7.html#table_6.7.1-1a for supported query values.

If minimalParsing is true, the returned results will only contain StudyInstanceUID, SeriesInstanceUID and RetrieveURL.

◆ getInstances() [1/2]

DcmItemsResult getInstances ( DcmItem & series,
std::string query,
bool minimalParsing )

Returns a list of a instances for a given series.

The given study must contain a StudyInstanceUID and a SeriesInstanceUID (e.g. the result of getSeries). Calls the method below.

◆ getInstances() [2/2]

DcmItemsResult getInstances ( std::string seriesRetrieveUrl,
std::string query,
bool minimalParsing )

Returns a list of a instances from the given path.

The path should be /studies/<study_uid>/series/<series_uid>, but this is not enforced.

See https://dicom.nema.org/dicom/2013/output/chtml/part18/sect_6.7.html#table_6.7.1-1b for supported query values.

If minimalParsing is true, the returned results will only contain StudyInstanceUID, SeriesInstanceUID, SOPInstanceUID and RetrieveURL.

◆ getInstance() [1/2]

DcmDatasetsResult getInstance ( DcmItem & instance)

Returns a single instance (e.g.

image) from the given path.

The given study must contain a StudyInstanceUID, SeriesInstanceUID and SOPInstanceUID (e.g. the result of getInstances). Calls the method below.

◆ getInstance() [2/2]

DcmDatasetsResult getInstance ( std::string instanceRetrieveUrl)

Returns a single instance (e.g.

image) from the given path.

This downloads the full DICOM dataset including the pixel data.

The path should be /studies/<study_uid>/series/<series_uid>/instances/<instance_uid>, but this is not enforced.


The documentation for this class was generated from the following file:
Search Tab / S to search, Esc to close