-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github:dcmjs-org/dicomweb-client
- Loading branch information
Showing
7 changed files
with
415 additions
and
248 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
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,72 @@ | ||
<!DOCTYPE HTML> | ||
<html> | ||
<head> | ||
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet"> | ||
</head> | ||
<body> | ||
<div class="container"> | ||
<h1> | ||
Example: Request Hooks | ||
</h1> | ||
<hr> | ||
<pre> | ||
const options = { | ||
url: "https://server.dcmjs.org/dcm4chee-arc/aets/DCM4CHEE/rs", | ||
requestHooks: [ | ||
(request, metadata) => { | ||
const requestMetadata = document.createElement('div'); | ||
requestMetadata.innerHTML = `Method: ${metadata.method} URL: ${metadata.url}`; | ||
document.getElementById('requests').append(requestMetadata); | ||
return request; | ||
} | ||
], | ||
}; | ||
</pre> | ||
<hr> | ||
<h3>Requests:</h3> | ||
<h5>(Logged using request hooks)</h5> | ||
<pre id='requests'></pre> | ||
<hr> | ||
<div class="row"> | ||
<div id='contents' class="col-xs-12"> | ||
</div> | ||
</div> | ||
</div> | ||
</body> | ||
|
||
<!-- include the cornerstone library --> | ||
<script src="../build/dicomweb-client.js"></script> | ||
<script> | ||
if (!window.DICOMwebClient) { | ||
console.warn('Failed to load dicomweb-client from build directory. Using unpkg instead.'); | ||
document.write('<script src="https://unpkg.com/dicomweb-client">\x3C/script>') | ||
} | ||
</script> | ||
|
||
<script> | ||
const dwc = DICOMwebClient.api.DICOMwebClient; | ||
const options = { | ||
url: "https://server.dcmjs.org/dcm4chee-arc/aets/DCM4CHEE/rs", | ||
requestHooks: [ | ||
(request, metadata) => { | ||
const requestMetadata = document.createElement('div'); | ||
requestMetadata.innerHTML = `Method: ${metadata.method} URL: ${metadata.url}`; | ||
document.getElementById('requests').append(requestMetadata); | ||
return request; | ||
} | ||
], | ||
}; | ||
|
||
const dicomweb = new dwc(options) | ||
const studyInstanceUID = '1.2.392.200140.2.1.1.1.2.799008771.2156.1519721160.421' | ||
const promise = dicomweb.retrieveStudyMetadata({studyInstanceUID}); | ||
|
||
promise.then(studyMetadata => { | ||
const div = document.getElementById('contents'); | ||
div.innerText = JSON.stringify(studyMetadata, null, 2); | ||
console.log(studyMetadata); | ||
}, error => { | ||
throw new Error(error); | ||
}); | ||
</script> | ||
</html> |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Oops, something went wrong.