Skip to content

Commit

Permalink
adding on-the-fly compression
Browse files Browse the repository at this point in the history
  • Loading branch information
knopkem committed Apr 8, 2021
1 parent 9a89e2c commit 58a3570
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 13 deletions.
16 changes: 15 additions & 1 deletion config/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,21 @@ config.target = {
port: "5678"
};

// transfer syntax (e.g. compression of dicom files) used for transmission via wado

/*
Supported Transfer Syntaxes:
1.2.840.10008.1.2 Implicit VR Endian: Default Transfer Syntax for DICOM
1.2.840.10008.1.2.1 Explicit VR Little Endian
1.2.840.10008.1.2.2 Explicit VR Big Endian
1.2.840.10008.1.2.4.50 JPEG Baseline (Process 1) - Lossy JPEG 8-bit Image Compression
1.2.840.10008.1.2.4.51 JPEG Baseline (Processes 2 & 4) - Lossy JPEG 12-bit Image Compression
1.2.840.10008.1.2.4.70 JPEG Lossless, Nonhierarchical, First- Order Prediction
1.2.840.10008.1.2.4.80 JPEG-LS Lossless Image Compression <-- recommended
1.2.840.10008.1.2.4.81 JPEG-LS Lossy (Near- Lossless) Image Compression
1.2.840.10008.1.2.5 RLE Lossless
*/

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

// log directory
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.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dicomweb-proxy",
"version": "1.0.18",
"version": "1.1.0",
"description": "A proxy to translate between dicomweb and dimse",
"main": "app.js",
"scripts": {
Expand Down Expand Up @@ -28,7 +28,7 @@
"dependencies": {
"config": "^3.3.4",
"dicom-data-dictionary": "^0.3.1",
"dicom-dimse-native": "^1.2.11",
"dicom-dimse-native": "^1.2.12",
"dicom-parser": "^1.8.7",
"fastify": "^3.12.0",
"fastify-cors": "^4.1.0",
Expand Down
2 changes: 1 addition & 1 deletion src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ fastify.get('/viewer/wadouri', async (req, reply) => {
}
const storagePath = config.get('storagePath');
const studyPath = path.join(storagePath, studyUid)
const pathname = path.join(storagePath, studyUid, imageUid);
const pathname = path.join(studyPath, imageUid);
try {
await utils.fileExists(pathname);
} catch (error) {
Expand Down
10 changes: 8 additions & 2 deletions src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ const fetchData = async (studyUid, seriesUid) => {
};

// set source and target from config
const ts = config.get('transferSyntax');
j.netTransferPrefer = ts;
j.netTransferPropose = ts;
j.writeTransfer = ts;
j.source = config.get("source");
j.target = config.get("target");
j.verbose = config.get("verboseLogging");
Expand Down Expand Up @@ -123,10 +127,14 @@ const utils = {
await storage.init({ dir: storagePath });
},
startScp: () => {
const ts = config.get('transferSyntax');
const j = {};
j.source = config.get("source");
j.storagePath = config.get("storagePath");
j.verbose = config.get("verboseLogging");
j.netTransferPrefer = ts;
j.netTransferPropose = ts;
j.writeTransfer = ts;
j.peers = [config.get("target")];
j.permissive = false;

Expand Down Expand Up @@ -215,8 +223,6 @@ const utils = {
verbose: config.get('verboseLogging'),
};

console.log(j);

// run find scu and return json response
return new Promise((resolve, reject) => {
dimse.recompress(JSON.stringify(j), (result) => {
Expand Down

0 comments on commit 58a3570

Please sign in to comment.