Skip to content

Commit

Permalink
Merge branch 'master' of github:dcmjs-org/dicomweb-client
Browse files Browse the repository at this point in the history
  • Loading branch information
hackermd committed Jun 2, 2021
2 parents 30de1ee + db93d2c commit 1c3219f
Show file tree
Hide file tree
Showing 7 changed files with 415 additions and 248 deletions.
8 changes: 5 additions & 3 deletions examples/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ <h1>
Example
</h1>
<hr>
<a href='/retry'>Request hooks</a>
<hr>
<div class="row">
<div id='contents' class="col-xs-12">
</div>
Expand All @@ -17,7 +19,7 @@ <h1>
</body>

<!-- include the cornerstone library -->
<script src="../../build/dicomweb-client.js"></script>
<script src="../build/dicomweb-client.js"></script>
<script>
if (!window.DICOMwebClient) {
console.warn('Failed to load dicomweb-client from build directory. Using unpkg instead.');
Expand All @@ -28,11 +30,11 @@ <h1>
<script>
const dwc = DICOMwebClient.api.DICOMwebClient;
const options = {
url: "https://dicomcloud.azurewebsites.net/wadors"
url: "https://server.dcmjs.org/dcm4chee-arc/aets/DCM4CHEE/rs"
};

const dicomweb = new dwc(options)
const studyInstanceUID = '1.2.826.0.1.3680043.8.1055.1.20111103111148288.98361414.79379639'
const studyInstanceUID = '1.2.392.200140.2.1.1.1.2.799008771.2156.1519721160.421'
const promise = dicomweb.retrieveStudyMetadata({studyInstanceUID});

promise.then(studyMetadata => {
Expand Down
72 changes: 72 additions & 0 deletions examples/retry.html
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>
2 changes: 1 addition & 1 deletion karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module.exports = function(config) {

// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ['mocha', 'chai'],
frameworks: ['jasmine'],


// list of files / patterns to load in the browser
Expand Down
149 changes: 17 additions & 132 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,17 @@
"devDependencies": {
"@babel/core": "^7.1.0",
"@babel/preset-env": "^7.1.0",
"chai": "^4.1.2",
"eslint": "^5.16.0",
"eslint-config-airbnb-base": "^13.1.0",
"eslint-plugin-import": "^2.16.0",
"karma": "^4.2.0",
"karma-chai": "^0.1.0",
"karma-chrome-launcher": "^2.2.0",
"karma-mocha": "^1.3.0",
"mocha": "^5.2.0",
"karma-jasmine": "^4.0.1",
"prettier": "^1.16.4",
"puppeteer": "^1.18.1",
"rollup": "^0.63.2",
"rollup-plugin-babel": "^4.0.3"
}
},
"dependencies": {}
}
Loading

0 comments on commit 1c3219f

Please sign in to comment.