Skip to content

Commit

Permalink
Merge pull request #16 from tunglt1810/feature/dicomloaderservice-cus…
Browse files Browse the repository at this point in the history
…tom-mediatypes

Add support for multiple displaySets returned by SopClassHandlerModules
  • Loading branch information
triet12369 authored Mar 26, 2021
2 parents 39a0306 + 957edb3 commit c4eff60
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 16 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [1.2.2] - 2021-03-26
### Added
- Add support for multiple displaySets returned by SopClassHandlerModules - [@triet12369]
## [1.2.1] - 2021-03-25
### Added
- Add support for custom mediaTypes in dicom loader service - [@triet12369]
Expand Down
2 changes: 1 addition & 1 deletion dist/index.umd.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/index.umd.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "viewer-core",
"version": "1.2.1",
"version": "1.2.2",
"description": "Generic business logic for web-based medical imaging applications - edited by Tung LT",
"author": "OHIF Core Team",
"editor": "Tung LT",
Expand Down
43 changes: 30 additions & 13 deletions src/classes/metadata/StudyMetadata.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,15 +130,23 @@ export class StudyMetadata extends Metadata {
const sopClassUIDs = getSopClassUIDs(series);

if (sopClassHandlerModules && sopClassHandlerModules.length > 0) {
const displaySet = _getDisplaySetFromSopClassModule(sopClassHandlerModules, series, study, sopClassUIDs);

if (displaySet) {
displaySet.sopClassModule = true;

displaySet.isDerived ? this._addDerivedDisplaySet(displaySet) : displaySets.push(displaySet);
displaySet.combinedId = series.combinedId;
const sopClassDisplaySets = _getDisplaySetFromSopClassModule(sopClassHandlerModules, series, study, sopClassUIDs);
if (sopClassDisplaySets) {
for (let i = 0; i < sopClassDisplaySets.length; i++) {
sopClassDisplaySets[i].sopClassModule = true;
sopClassDisplaySets[i].isDerived ? this._addDerivedDisplaySet(sopClassDisplaySets[i]) : displaySets.push(sopClassDisplaySets[i]);
// FIXME: need universal ID generation for displaySets
sopClassDisplaySets[i].combinedId = `${series.combinedId}_${i}`;
}
return displaySets;
}
// if (displaySet) {
// displaySet.sopClassModule = true;

// displaySet.isDerived ? this._addDerivedDisplaySet(displaySet) : displaySets.push(displaySet);
// displaySet.combinedId = series.combinedId;
// return displaySets;
// }
}

// WE NEED A BETTER WAY TO NOTE THAT THIS IS THE DEFAULT BEHAVIOR FOR LOADING
Expand Down Expand Up @@ -827,12 +835,21 @@ function _getDisplaySetFromSopClassModule(
errorInterceptor
});

let displaySet = plugin.getDisplaySetFromSeries(series, study, dicomWebClient, headers);
if (displaySet && !displaySet.Modality) {
const instance = series.getFirstInstance();
displaySet.Modality = instance.getTagValue('Modality');
}
return displaySet;
const addModalityToDisplaySet = (displaySet) => {
if (displaySet && !displaySet.Modality) {
const instance = series.getFirstInstance();
displaySet.Modality = instance.getTagValue('Modality');
}
return displaySet;
};

let displaySets = plugin.getDisplaySetFromSeries(series, study, dicomWebClient, headers);
if (displaySets.length) {
for (let i = 0; i < displaySets.length; i++) {
displaySets[i] = addModalityToDisplaySet(displaySets[i]);
}
} else if (displaySets) displaySets = [addModalityToDisplaySet(displaySets)];
return displaySets;
}

/**
Expand Down

0 comments on commit c4eff60

Please sign in to comment.