Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XNAT Connection #11

Closed
Braisly opened this issue Dec 15, 2022 · 5 comments · Fixed by #24
Closed

XNAT Connection #11

Braisly opened this issue Dec 15, 2022 · 5 comments · Fixed by #24
Assignees
Labels
enhancement New feature or request

Comments

@Braisly
Copy link

Braisly commented Dec 15, 2022

Hi!

I would like to know how it is possible the connection with XNAT. I see the way to connect to Orthanc but no way to see the solution for XNAT. Could you help me on that?

Great work with bluelight!

@cylien cylien added the enhancement New feature or request label Dec 16, 2022
@cylien
Copy link
Member

cylien commented Dec 19, 2022

We did not wrap this feature as an XNAT plugin. So we will release a document to describe how to integrate BlueLight into XANT.
We replaced the DICOM web protocol with XNAT API so that users can open the DICOM file stored in an XNAT repository.

@Braisly
Copy link
Author

Braisly commented Dec 26, 2022

Thank you @cylien look forward to see the updates.

@cylien
Copy link
Member

cylien commented Jan 27, 2023

  1. Step1: copy BlueLight to XNAT deployment folder
  2. Step 2: modified the function downloadSelectedScans in XNAT source code: "\scripts\xnat\app\scanTable\scanTable.js",
    // download all selected scans
    function downloadSelectedScans(){
        var selectedScans = [];
        scanTable.dataTable$.find('input.selectable-select-one:checked').each(function(){
            selectedScans.push(this.value);
        });    
        /* add those two lines to open a new windows with XNAT API  */ 
        var url = "/bluelight/html/start.html?experiments=" + exptId + "&scans=" + scanId + "&format=json";
        window.open(url);
        downloadIframe(url);
    }
  1. Step 3 : add codes to deal with XNAT API in BlueLight (code should be refined)
function readXNATRequest() {
  var experiments = (getQueryVariable('experiments'));
  var scans = (getQueryVariable('scans'));
  var format = (getQueryVariable('format'));
  if (experiments != false && scans != false && format != false) {
    var url = window.location.protocol + "//" + window.location.hostname + ":" + window.location.port + "/data/experiments/"
      + experiments + "/scans/" + scans + "/files/" + "?format=json";
    readJson2(url);
  }
}

function readJson2(url) {
  var requestURL = url;
  var request = new XMLHttpRequest();
  request.open('GET', requestURL);
  request.responseType = 'json';
  request.send();
  request.onload = function () {
    var superHeroes = request.response;
    for (var i = 0; i < superHeroes["ResultSet"]["Result"].length; i++) {
      if (superHeroes["ResultSet"]["Result"][i]["collection"] == "DICOM") {
        var uri = window.location.protocol + "//" + window.location.hostname + ":" + window.location.port + superHeroes["ResultSet"]["Result"][i]["URI"];
        url = "wadouri:" + uri;
        series = virtualLoadImage(url, 0);  // launch viewer, should be refined.
      }
    }
  }
}

@cylien
Copy link
Member

cylien commented Feb 27, 2023

add xnat.js as a plugin for this issue. 137ac44
Step1: copy BlueLight to XNAT deployment folder
Step2: type URL: https://{XNAT's hostname}/bluelight/search/html/start.html?experiments={XNAT expID}&scans={scanID}&format=json

BlueLight will query the XNAT's API to get the XML and retrieve the DICOM stored in experiments and its scans.

http://{XNAT's hostname}/REST/projects/test/subjects/XNAT_S00001/experiments/XNAT_E00002/scans/1/files?format=json

the XML looks like
圖片

@cylien
Copy link
Member

cylien commented Mar 1, 2023

Here is a video for the integration of BlueLight with XNAT
media

We add the following two lines in the function of displayScanDetails in ScanTable.js i.e., in "scripts/xnat/app/scanTable" of the XNAT.

// inline scan table functions
    scanTable.displayScanDetails = function(scanId){

        if (!scanId) return false;

        var BLurl = "/bluelight/bluelight/html/start.html?experiments=" + exptId + "&scans=" + scanId + "&format=json";
        window.open(BLurl);
...

@cylien cylien closed this as completed Mar 1, 2023
@cylien cylien linked a pull request Mar 8, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants