ImFusion C++ SDK 4.4.0
ImFusion::Dicom::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 Dicom::DatasetCache for loading image or Dicom::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 downloadInstance (DcmItem &instance)
 Returns a single instance (e.g.
DcmDatasetsResult downloadInstances (std::string instanceRetrieveUrl, Progress::Task *progress=nullptr)
 Downloads one or multiple instances.

Constructor & Destructor Documentation

◆ WebClient()

ImFusion::Dicom::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 ImFusion::Dicom::WebClient::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 ImFusion::Dicom::WebClient::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 ImFusion::Dicom::WebClient::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 ImFusion::Dicom::WebClient::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 ImFusion::Dicom::WebClient::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 ImFusion::Dicom::WebClient::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 ImFusion::Dicom::WebClient::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.

◆ downloadInstance()

DcmDatasetsResult ImFusion::Dicom::WebClient::downloadInstance ( 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.

◆ downloadInstances()

DcmDatasetsResult ImFusion::Dicom::WebClient::downloadInstances ( std::string instanceRetrieveUrl,
Progress::Task * progress = nullptr )

Downloads one or multiple instances.

This downloads the full DICOM dataset including the pixel data. The URL can either be a study, series or instance URL. In case of a study or series, all instances of that study or series are downloaded.


The documentation for this class was generated from the following file:
  • ImFusion/Dicom/WebClient.h
Search Tab / S to search, Esc to close