Skip to content

Commit

Permalink
Merge pull request #33 from dcmjs-org/mediatypes-dwc
Browse files Browse the repository at this point in the history
fix(api.js): Update DICOMWebClient usage to use mediatypes array format
  • Loading branch information
hackermd authored Jul 20, 2019
2 parents c706f91 + f248c32 commit b17d396
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
8 changes: 4 additions & 4 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": "dicom-microscopy-viewer",
"version": "0.5.0",
"version": "0.6.0",
"description": "Interactive web-based viewer for DICOM Microscopy Images",
"main": "build/dicom-microscopy-viewer.js",
"scripts": {
Expand Down Expand Up @@ -39,7 +39,7 @@
"rollup-plugin-node-resolve": "^3.3.0"
},
"dependencies": {
"dicomweb-client": "^0.4.2",
"dicomweb-client": "^0.5.1",
"ol": "^5.3.0"
}
}
12 changes: 6 additions & 6 deletions src/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -474,31 +474,31 @@ class VLWholeSlideMicroscopyImageViewer {
const frameNumbers = DICOMwebClient.utils.getFrameNumbersFromUri(src);
const img = tile.getImage();
if (options.retrieveRendered) {
const mimeType = 'image/png';
const mediaType = 'image/png';
const retrieveOptions = {
studyInstanceUID,
seriesInstanceUID,
sopInstanceUID,
frameNumbers,
mimeType
mediaTypes: [{ mediaType }]
};
options.client.retrieveInstanceFramesRendered(retrieveOptions).then((renderedFrame) => {
const blob = new Blob([renderedFrame], {type: mimeType});
const blob = new Blob([renderedFrame], {type: mediaType});
img.src = window.URL.createObjectURL(blob);
});
} else {
// TODO: support "image/jp2" and "image/jls"
const mimeType = 'image/jpeg';
const mediaType = 'image/jpeg';

const retrieveOptions = {
studyInstanceUID,
seriesInstanceUID,
sopInstanceUID,
frameNumbers,
mimeType: `${mimeType}; transfer-syntax=1.2.840.10008.1.2.4.50`
mediaTypes: [{mediaType, transferSyntaxUID: '1.2.840.10008.1.2.4.50'}]
};
options.client.retrieveInstanceFrames(retrieveOptions).then((rawFrames) => {
const blob = new Blob(rawFrames, {type: mimeType});
const blob = new Blob(rawFrames, {type: mediaType});
img.src = window.URL.createObjectURL(blob);
});
}
Expand Down

0 comments on commit b17d396

Please sign in to comment.