-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add retrieve study's series' instances
- Add, `getZipOfSeriesDICOMFiles` - Fix, missing the `instancePath` field name when path.join in `getSeriesImagesPath` and `WADOZip.js` - Docs(openapi), move openapi documentation into router index.js file - Docs(openapi), add query parameters of study's series' instances - Docs(openapi), add response of Multipart related with DICOM
- Loading branch information
1 parent
dcd90ca
commit 1b0f235
Showing
12 changed files
with
257 additions
and
143 deletions.
There are no files selected for viewing
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
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
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
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
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
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
49 changes: 49 additions & 0 deletions
49
api/dicom-web/controller/WADO-RS/retrieveStudy-Series-Instances.js
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
const { logger } = require("../../../../utils/log"); | ||
const wadoService = require("./service/WADO-RS.service"); | ||
const { WADOZip } = require("./service/WADOZip"); | ||
const errorResponse = require("../../../../utils/errorResponse/errorResponseMessage"); | ||
/** | ||
* | ||
* @param {import("http").IncomingMessage} req | ||
* @param {import("http").ServerResponse} res | ||
*/ | ||
module.exports = async function(req, res) { | ||
try { | ||
logger.info(`[WADO-RS] [Get study's series' instances, study UID: ${req.params.studyUID}, series UID: ${req.params.seriesUID}] [Request Accept: ${req.headers.accept}]`); | ||
if (req.headers.accept.toLowerCase() === "application/zip") { | ||
let wadoZip = new WADOZip(req.params, res); | ||
let zipResult = await wadoZip.getZipOfSeriesDICOMFiles(); | ||
if (zipResult.status) { | ||
return res.end(); | ||
} | ||
} else if (req.headers.accept.includes("multipart/related")) { | ||
let type = wadoService.getAcceptType(req); | ||
let isSupported = wadoService.supportInstanceMultipartType.indexOf(type) > -1; | ||
if (!isSupported) { | ||
let errorMessage = errorResponse.getNotSupportedErrorMessage(`The type ${type} is not supported, server supported multipart/related; type="application/dicom", multipart/related; type="application/octet-stream" and application/zip`); | ||
res.writeHead(errorMessage.HttpStatus, { | ||
"Content-Type": "application/dicom+json" | ||
}); | ||
return res.end(JSON.stringify(errorMessage)); | ||
} | ||
let writeMultipartResult = await wadoService.multipartFunc[type].getSeriesDICOMFiles(req.params, req, res, type); | ||
if (!writeMultipartResult.status) { | ||
res.writeHead(writeMultipartResult.code, { | ||
"Content-Type": "application/dicom+json" | ||
}); | ||
return res.end(JSON.stringify(writeMultipartResult)); | ||
} | ||
} | ||
return res.end(); | ||
} catch(e) { | ||
let errorStr = JSON.stringify(e, Object.getOwnPropertyNames(e)); | ||
logger.error(`[WADO-RS] [Error: ${errorStr}]`); | ||
res.writeHead(500, { | ||
"Content-Type": "application/dicom+json" | ||
}); | ||
res.end(JSON.stringify({ | ||
code: 500, | ||
message: errorStr | ||
})); | ||
} | ||
}; |
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
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
Oops, something went wrong.