Skip to content

Commit

Permalink
using on-the-fly compression (wip)
Browse files Browse the repository at this point in the history
  • Loading branch information
knopkem committed Apr 7, 2021
1 parent 0e670ba commit 9a89e2c
Show file tree
Hide file tree
Showing 5 changed files with 154 additions and 104 deletions.
3 changes: 3 additions & 0 deletions config/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ config.target = {
port: "5678"
};

// transfer syntax (e.g. compression of dicom files) used for transmission via wado
config.transferSyntax = '1.2.840.10008.1.2.4.80';

// log directory
config.logDir = "./logs";

Expand Down
14 changes: 7 additions & 7 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"dependencies": {
"config": "^3.3.4",
"dicom-data-dictionary": "^0.3.1",
"dicom-dimse-native": "^1.2.9",
"dicom-dimse-native": "^1.2.11",
"dicom-parser": "^1.8.7",
"fastify": "^3.12.0",
"fastify-cors": "^4.1.0",
Expand Down
12 changes: 11 additions & 1 deletion src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ fastify.get('/viewer/wadouri', async (req, reply) => {
return;
}
const storagePath = config.get('storagePath');
const studyPath = path.join(storagePath, studyUid)
const pathname = path.join(storagePath, studyUid, imageUid);

try {
await utils.fileExists(pathname);
} catch (error) {
Expand All @@ -130,6 +130,16 @@ fastify.get('/viewer/wadouri', async (req, reply) => {
return;
}

try {
await utils.compressFile(pathname, studyPath);
} catch (error) {
logger.error(error);
const msg = `failed to compress ${pathname}`;
reply.code(500);
reply.send(msg);
return;
}

// if the file is found, set Content-type and send data
reply.header(
'Content-Type',
Expand Down
Loading

0 comments on commit 9a89e2c

Please sign in to comment.