Created
December 21, 2018 23:59
-
-
Save birm/4555a37c573002fd3ad3f578ce8aee5e to your computer and use it in GitHub Desktop.
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
var http = require('http'); | |
var fs = require('fs'); | |
var fetch = require('node-fetch'); | |
const exec = require('child_process').exec; | |
var sourceUrl = "http://172.20.11.223:9099/services/Camic_TCIA/Image/query/find" | |
function freeze(time) { | |
const stop = new Date().getTime() + time; | |
while(new Date().getTime() < stop); | |
} | |
fetch(sourceUrl).then(x=>x.json()).then(x=>{ | |
for(i in x){ | |
a = x[i] | |
let prefix = "http://tcia-path-a1/fcgi-bin/iipsrv.fcgi?FIF=" | |
let location = a['file-location'] | |
var url = prefix + location + "&WID=200&CVT=png" | |
// get it | |
// if it's new | |
if (a['timestamp']> 1543696493){ | |
console.log(url) | |
exec("curl \"" + url +"\" > " + a['case_id']+".png") | |
freeze(5000) | |
} | |
}}) | |
//"http://tcia-path-a1/fcgi-bin/iipsrv.fcgi?FIF=/data/cptac/images/test8/test8/101437.svs&WID=400&CVT=png" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment