-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This creates a new DICOMweb assetstore that is used to track resources on a DICOMweb server. The user provides the DICOMweb server URL and optionally QIDO and WADO prefixes (if the server requires them). The user is then able to import references to the objects on the DICOMweb server. The files that are created via this assetstore are able to be viewed with the dicom tile source, which has been extended to handle files on a DICOMweb server. A test was also added that utilizes the public DICOMweb server located [here](https://imagingdatacommons.github.io/slim/). There is still more work to do in future PRs, including: * Adding a search/filter capability * Adding authentication for non-public servers * Query and store metadata from the DICOMweb objects Fixes: #1204 Signed-off-by: Patrick Avery <patrick.avery@kitware.com>
- Loading branch information
Showing
27 changed files
with
1,106 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
85 changes: 85 additions & 0 deletions
85
sources/dicom/large_image_source_dicom/assetstore/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
from girder import events | ||
from girder.api import access | ||
from girder.api.v1.assetstore import Assetstore as AssetstoreResource | ||
from girder.constants import AssetstoreType | ||
from girder.models.assetstore import Assetstore | ||
from girder.utility.assetstore_utilities import setAssetstoreAdapter | ||
|
||
from .dicomweb_assetstore_adapter import DICOMWEB_META_KEY, DICOMwebAssetstoreAdapter | ||
from .rest import DICOMwebAssetstoreResource | ||
|
||
__all__ = [ | ||
'DICOMWEB_META_KEY', | ||
'DICOMwebAssetstoreAdapter', | ||
'load', | ||
] | ||
|
||
|
||
@access.admin | ||
def createAssetstore(event): | ||
""" | ||
When an assetstore is created, make sure it has a well-formed DICOMweb | ||
information record. | ||
:param event: Girder rest.post.assetstore.before event. | ||
""" | ||
params = event.info['params'] | ||
|
||
if params.get('type') == AssetstoreType.DICOMWEB: | ||
event.addResponse(Assetstore().save({ | ||
'type': AssetstoreType.DICOMWEB, | ||
'name': params.get('name'), | ||
DICOMWEB_META_KEY: { | ||
'url': params['url'], | ||
'qido_prefix': params.get('qido_prefix'), | ||
'wado_prefix': params.get('wado_prefix'), | ||
'auth_type': params.get('auth_type'), | ||
}, | ||
})) | ||
event.preventDefault() | ||
|
||
|
||
def updateAssetstore(event): | ||
""" | ||
When an assetstore is updated, make sure the result has a well-formed set | ||
of DICOMweb information. | ||
:param event: Girder assetstore.update event. | ||
""" | ||
params = event.info['params'] | ||
store = event.info['assetstore'] | ||
|
||
if store['type'] == AssetstoreType.DICOMWEB: | ||
store[DICOMWEB_META_KEY] = { | ||
'url': params['url'], | ||
'qido_prefix': params.get('qido_prefix'), | ||
'wado_prefix': params.get('wado_prefix'), | ||
'auth_type': params.get('auth_type'), | ||
} | ||
|
||
|
||
def load(info): | ||
""" | ||
Load the plugin into Girder. | ||
:param info: a dictionary of plugin information. The name key contains the | ||
name of the plugin according to Girder. | ||
""" | ||
AssetstoreType.DICOMWEB = 'dicomweb' | ||
setAssetstoreAdapter(AssetstoreType.DICOMWEB, DICOMwebAssetstoreAdapter) | ||
events.bind('assetstore.update', 'dicomweb_assetstore', updateAssetstore) | ||
events.bind('rest.post.assetstore.before', 'dicomweb_assetstore', | ||
createAssetstore) | ||
|
||
(AssetstoreResource.createAssetstore.description | ||
.param('url', 'The base URL for the DICOMweb server (for DICOMweb)', | ||
required=False) | ||
.param('qido_prefix', 'The QIDO URL prefix for the server, if needed (for DICOMweb)', | ||
required=False) | ||
.param('wado_prefix', 'The WADO URL prefix for the server, if needed (for DICOMweb)', | ||
required=False) | ||
.param('auth_type', | ||
'The authentication type required for the server, if needed (for DICOMweb)', | ||
required=False)) | ||
|
||
info['apiRoot'].dicomweb_assetstore = DICOMwebAssetstoreResource() |
Oops, something went wrong.