Skip to content

Commit

Permalink
Adding some updates to the webservice
Browse files Browse the repository at this point in the history
  • Loading branch information
wayfarer3130 committed Feb 11, 2022
1 parent bf1f8d7 commit 0fbeb24
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
7 changes: 7 additions & 0 deletions bin/dicomwebserver.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

import DicomWebServer from '../src/webserver/index.mjs'

// TODO - load params from file, or default to local file instance if not available
const params = {
loadPaths: {
..
}
};

const server = DicomWebServer();

server.addDicomWeb('/users/wayfa/dicomweb');
Expand Down
1 change: 1 addition & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 12 additions & 2 deletions src/webserver/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const otherJsonMap = (req,res,next) => {
const missingMap = (req,res,next) => {
console.log('Not found', req.path)
res.status(404).send(`Couldn't find ${req.path} in studyUID ${req.params.studyUID} - TODO, query remote with params=${JSON.stringify(req.params)} and query=${JSON.stringify(req.query)}`)
next();
}

const gzipHeaders = (res, path, stat) => {
Expand All @@ -33,7 +34,11 @@ const methods = {
const router = express.Router();
this.use(path,router);

router.get('/studies', qidoMap);
if( this.plugins.retrievePreCheck ) {
router.use('/studies/:studyUID',this.plugins.retrievePreCheck);
}

router.get('/studies', this.plugins.studyQuery || qidoMap);
router.get('/studies/:studyUID/series',qidoMap);
router.get('/studies/:studyUID/series/metadata',otherJsonMap);
router.get('/studies/:studyUID/series/:seriesUID/instances',qidoMap);
Expand All @@ -47,7 +52,9 @@ const methods = {
fallthrough: true,
}));

router.use('/studies/:studyUID/', missingMap);
if( this.plugins.retrieveMissing ) {
router.use('/studies/:studyUID/', this.plugins.retrieveMissing);
}
},

addClient: function(dir, params = {}) {
Expand All @@ -74,6 +81,9 @@ const DicomWebServer = (params) => {

app.use(logger("combined"))
app.params = params || {};
app.plugins = loadPlugins(params);

// Iterate through params, add webservices based on params

const superListen = app.listen;
app.listen = (port) => {
Expand Down

0 comments on commit 0fbeb24

Please sign in to comment.