Skip to content

Instantly share code, notes, and snippets.

@birm
Created December 21, 2018 23:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save birm/4555a37c573002fd3ad3f578ce8aee5e to your computer and use it in GitHub Desktop.
Save birm/4555a37c573002fd3ad3f578ce8aee5e to your computer and use it in GitHub Desktop.
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