-
-
Save milankarunarathne/77af87ed0200f50e288c to your computer and use it in GitHub Desktop.
In a Diagnostic Report, fetch `imageStudy` data from third party application and display them.
This file contains hidden or 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
angular.module('radiologyApp',[]) | |
.controller('radiologyController',function($scope,$http,$window){ | |
$http({method:'GET', | |
headers: {'Accept': 'application/json'}, | |
url: 'http://fhir.hackathon.siim.org/fhir/DiagnosticReport?subject=Patient/siimsally' | |
}). | |
success(function(data,status,headers,config){ | |
$scope.patientstudies = data | |
$scope.count= data['totalResults'] | |
//$scope.x = data['entry'][1]['id'] | |
for (i = 0; i < data['totalResults']; i++) { | |
studyname(data['entry'][i]['id']) | |
} | |
}). | |
error(function(data,status,headers,config){ | |
console.log(data) | |
}); | |
// Get name of each specific study | |
studylist =[] | |
var seriesList = [] | |
studyname = function(url){ | |
$http({method:'GET', | |
headers: {'Accept': 'application/json'}, | |
url: url | |
}). | |
success(function(data,status,headers,config){ | |
var study = {} | |
study.studyDate = data['diagnosticDateTime'] | |
study.studyName = data['name']['text'] | |
study.report = data['text']['div'] | |
study.accessionNo = data['identifier']['value'] | |
//console.log(data) | |
studylist.push(study) | |
}). | |
error(function(data,status,headers,config){ | |
console.log(data) | |
}); | |
} | |
$scope.study = studylist | |
//Handle clicking | |
$scope.setStudy = function(study){ | |
var accNo = study.accessionNo; | |
document.getElementById("report").innerHTML = study.report; | |
//imagingStudy, series, instance) | |
//console.log('bshdfbs') | |
console.log(accNo) | |
$http({method:'GET', | |
headers: {'Accept': 'application/json'}, | |
url: 'http://fhir.hackathon.siim.org/fhir/ImagingStudy/' + accNo | |
}). | |
success(function(data,status,headers,config){ | |
//console.log(data) | |
//function addImageClient(imagingStudy, series, instance) { | |
if(data.series.length>1){ | |
seriesList = [] | |
for (var j=0; j<data.series.length;j++){ | |
var series = data.series[j] | |
//console.log(series) | |
seriesList.push({ | |
'studyUid':data.uid, | |
'seriesUid':series.uid, | |
'seriesName':series.description, | |
'instanceUid':series.instance[0].uid}) | |
/*for (var k=0;series.instance.length;k++){ | |
var instance = series.instance[k] | |
console.log(series) | |
//}) | |
}*/ | |
} | |
$scope.series = seriesList | |
} | |
var image ={} | |
image.study = data.uid | |
image.series = data.series[0].uid | |
image.instance = data.series[0].instance[0].uid | |
displayImage(image); | |
//addImageClient(image.study,image.series,image.instance) | |
}). | |
error(function(data,status,headers,config){ | |
console.log(data) | |
}); | |
} | |
$scope.setSeries = function(series) { | |
displayImage({ | |
study: series.studyUid, | |
series: series.seriesUid, | |
instance: series.instanceUid | |
}) | |
} | |
function displayImage(image){ | |
var url = 'http://vna.hackathon.siim.org/dcm4chee-arc/wado/DCM4CHEE?requestType=WADO&studyUID=' + image.study + '&seriesUID=' + image.series + '&objectUID=' + image.instance;// + "&contentType=application%2Fdicom" | |
//var url = 'dicomweb://vna.hackathon.siim.org/dcm4chee-arc/wado/DCM4CHEE?requestType=WADO&studyUID=' + image.study + '&seriesUID=' + image.series + '&objectUID=' + image.instance + "&contentType=application%2Fdicom"; | |
url = url.replace(/urn:oid:/g,''); | |
//http://vna.hackathon.siim.org/dcm4chee-arc/wado/DCM4CHEE?requestType=WADO&studyUID=1.3.6.1.4.1.14519.5.2.1.4792.2001.103189108764313019491934667255&seriesUID=1.3.6.1.4.1.14519.5.2.1.4792.2001.104616474240757574154876423123&objectUID=1.3.6.1.4.1.14519.5.2.1.4792.2001.267212981954448819074140522716 | |
//http://vna.hackathon.siim.org/dcm4chee-arc/wado/DCM4CHEE?requestType=WADO&studyUID=urn:oid:1.3.6.1.4.1.14519.5.2.1.4792.2001.103189108764313019491934667255&seriesUID=urn:oid:1.3.6.1.4.1.14519.5.2.1.4792.2001.104616474240757574154876423123&objectUID=urn:oid:1.3.6.1.4.1.14519.5.2.1.4792.2001.267212981954448819074140522716&contentType=application%2Fdicom | |
//console.log(image) | |
//var url = $('#wadoURL').val(); | |
// prefix the url with dicomweb: so cornerstone can find the image loader | |
// url = "dicomweb:" + url; | |
/* | |
var element = jq('#dicomImage').get(0); | |
// image enable the dicomImage element and activate a few tools | |
cornerstone.enable(element); | |
cornerstone.loadImage(url).then(function(image) { | |
cornerstone.displayImage(element, image); | |
}); | |
*/ | |
document.getElementById("dicomImage").innerHTML = "<img src='"+url+"' style='max-width: 500px;'/>" | |
} | |
}); //end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment