-
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.
- Loading branch information
1 parent
54b2965
commit 137ac44
Showing
2 changed files
with
45 additions
and
1 deletion.
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,43 @@ | ||
function getQueryVariable_xnat(variable) { | ||
var query = window.location.search.substring(1); | ||
var vars = query.split("&"); | ||
for (var i = 0; i < vars.length; i++) { | ||
var pair = vars[i].split("="); | ||
if (pair[0] == variable) { | ||
return pair[1]; | ||
} | ||
} | ||
return false; | ||
} | ||
|
||
function readXNATRequest() { | ||
var experiments = (getQueryVariable_xnat('experiments')); | ||
var scans = (getQueryVariable_xnat('scans')); | ||
var format = (getQueryVariable_xnat('format')); | ||
if (experiments != false && scans != false) { | ||
if (format == false) format = "json"; | ||
var url = window.location.protocol + "//" + window.location.hostname + ":" + window.location.port + "/data/experiments/" | ||
+ experiments + "/scans/" + scans + "/files/" + "?format=" + format; | ||
readJson_xnat(url); | ||
} | ||
} | ||
|
||
function readJson_xnat(url) { | ||
var requestURL = url; | ||
var request = new XMLHttpRequest(); | ||
request.open('GET', requestURL); | ||
request.responseType = 'json'; | ||
request.send(); | ||
request.onload = function () { | ||
var response = request.response; | ||
for (var i = 0; i < response["ResultSet"]["Result"].length; i++) { | ||
if (response["ResultSet"]["Result"][i]["collection"] == "DICOM" || response["ResultSet"]["Result"][i]["collection"] == "DCM") { | ||
var uri = window.location.protocol + "//" + window.location.hostname + ":" + window.location.port + response["ResultSet"]["Result"][i]["URI"]; | ||
url = "wadouri:" + uri; | ||
series = loadAndViewImage(url); | ||
} | ||
} | ||
} | ||
} | ||
|
||
readXNATRequest(); |