Merge pull request #2363 from OHIF/fix/window-level-issues
fix(MetadataProvider): Update metadata provider to resolve issues after dicomweb update/new return value
This commit is contained in:
commit
29afddb3a6
@ -48,12 +48,12 @@ jobs:
|
|||||||
- checkout:
|
- checkout:
|
||||||
post:
|
post:
|
||||||
- git fetch --all
|
- git fetch --all
|
||||||
- restore_cache:
|
# - restore_cache:
|
||||||
name: Restore Yarn and Cypress Package Cache
|
# name: Restore Yarn and Cypress Package Cache
|
||||||
keys:
|
# keys:
|
||||||
# when lock file changes, use increasingly general patterns to restore cache
|
# # when lock file changes, use increasingly general patterns to restore cache
|
||||||
- yarn-packages-{{ checksum "yarn.lock" }}
|
# - yarn-packages-{{ checksum "yarn.lock" }}
|
||||||
- yarn-packages-
|
# - yarn-packages-
|
||||||
- run:
|
- run:
|
||||||
name: Install Dependencies
|
name: Install Dependencies
|
||||||
command: yarn install --frozen-lockfile
|
command: yarn install --frozen-lockfile
|
||||||
@ -107,12 +107,12 @@ jobs:
|
|||||||
post:
|
post:
|
||||||
- git fetch --all
|
- git fetch --all
|
||||||
|
|
||||||
- restore_cache:
|
# - restore_cache:
|
||||||
name: Restore Yarn and Cypress Package Cache
|
# name: Restore Yarn and Cypress Package Cache
|
||||||
keys:
|
# keys:
|
||||||
# when lock file changes, use increasingly general patterns to restore cache
|
# # when lock file changes, use increasingly general patterns to restore cache
|
||||||
- yarn-packages-{{ checksum "yarn.lock" }}
|
# - yarn-packages-{{ checksum "yarn.lock" }}
|
||||||
- yarn-packages-
|
# - yarn-packages-
|
||||||
|
|
||||||
- run:
|
- run:
|
||||||
name: Install Dependencies
|
name: Install Dependencies
|
||||||
@ -143,12 +143,12 @@ jobs:
|
|||||||
- checkout:
|
- checkout:
|
||||||
post:
|
post:
|
||||||
- git fetch --all
|
- git fetch --all
|
||||||
- restore_cache:
|
# - restore_cache:
|
||||||
name: Restore Yarn and Cypress Package Cache
|
# name: Restore Yarn and Cypress Package Cache
|
||||||
keys:
|
# keys:
|
||||||
# when lock file changes, use increasingly general patterns to restore cache
|
# # when lock file changes, use increasingly general patterns to restore cache
|
||||||
- yarn-packages-{{ checksum "yarn.lock" }}
|
# - yarn-packages-{{ checksum "yarn.lock" }}
|
||||||
- yarn-packages-
|
# - yarn-packages-
|
||||||
- run:
|
- run:
|
||||||
name: Install Dependencies
|
name: Install Dependencies
|
||||||
command: yarn install --frozen-lockfile
|
command: yarn install --frozen-lockfile
|
||||||
@ -237,11 +237,11 @@ jobs:
|
|||||||
post:
|
post:
|
||||||
- git fetch --all
|
- git fetch --all
|
||||||
# Use increasingly general patterns to restore cache
|
# Use increasingly general patterns to restore cache
|
||||||
- restore_cache:
|
# - restore_cache:
|
||||||
name: Restore Yarn and Cypress Package Cache
|
# name: Restore Yarn and Cypress Package Cache
|
||||||
keys:
|
# keys:
|
||||||
- yarn-packages-{{ checksum "yarn.lock" }}
|
# - yarn-packages-{{ checksum "yarn.lock" }}
|
||||||
- yarn-packages-
|
# - yarn-packages-
|
||||||
- run:
|
- run:
|
||||||
name: Install Dependencies
|
name: Install Dependencies
|
||||||
command: yarn install --frozen-lockfile
|
command: yarn install --frozen-lockfile
|
||||||
@ -346,7 +346,9 @@ workflows:
|
|||||||
record: true
|
record: true
|
||||||
store_artifacts: true
|
store_artifacts: true
|
||||||
working_directory: platform/viewer
|
working_directory: platform/viewer
|
||||||
build: npx cross-env QUICK_BUILD=true APP_CONFIG=config/dicomweb-server.js yarn run build
|
build:
|
||||||
|
npx cross-env QUICK_BUILD=true APP_CONFIG=config/dicomweb-server.js
|
||||||
|
yarn run build
|
||||||
start: yarn run test:e2e:serve
|
start: yarn run test:e2e:serve
|
||||||
spec: 'cypress/integration/common/**/*,cypress/integration/pwa/**/*'
|
spec: 'cypress/integration/common/**/*,cypress/integration/pwa/**/*'
|
||||||
wait-on: 'http://localhost:3000'
|
wait-on: 'http://localhost:3000'
|
||||||
@ -372,7 +374,9 @@ workflows:
|
|||||||
record: true
|
record: true
|
||||||
store_artifacts: true
|
store_artifacts: true
|
||||||
working_directory: platform/viewer
|
working_directory: platform/viewer
|
||||||
build: npx cross-env QUICK_BUILD=true APP_CONFIG=config/dicomweb-server.js yarn run build:package
|
build:
|
||||||
|
npx cross-env QUICK_BUILD=true APP_CONFIG=config/dicomweb-server.js
|
||||||
|
yarn run build:package
|
||||||
start: yarn run test:e2e:serve
|
start: yarn run test:e2e:serve
|
||||||
spec: 'cypress/integration/common/**/*,cypress/integration/script-tag/**/*'
|
spec: 'cypress/integration/common/**/*,cypress/integration/script-tag/**/*'
|
||||||
wait-on: 'http://localhost:3000'
|
wait-on: 'http://localhost:3000'
|
||||||
@ -403,7 +407,9 @@ workflows:
|
|||||||
yarn: true
|
yarn: true
|
||||||
store_artifacts: false
|
store_artifacts: false
|
||||||
working_directory: platform/viewer
|
working_directory: platform/viewer
|
||||||
build: npx cross-env QUICK_BUILD=true APP_CONFIG=config/dicomweb-server.js yarn run build
|
build:
|
||||||
|
npx cross-env QUICK_BUILD=true APP_CONFIG=config/dicomweb-server.js
|
||||||
|
yarn run build
|
||||||
# start server --> verify running --> percy + chrome + cypress
|
# start server --> verify running --> percy + chrome + cypress
|
||||||
command: yarn run test:e2e:dist
|
command: yarn run test:e2e:dist
|
||||||
cache-key: 'yarn-packages-{{ checksum "yarn.lock" }}'
|
cache-key: 'yarn-packages-{{ checksum "yarn.lock" }}'
|
||||||
@ -480,7 +486,9 @@ workflows:
|
|||||||
yarn: true
|
yarn: true
|
||||||
store_artifacts: false
|
store_artifacts: false
|
||||||
working_directory: platform/viewer
|
working_directory: platform/viewer
|
||||||
build: npx cross-env QUICK_BUILD=true APP_CONFIG=config/dicomweb-server.js yarn run build
|
build:
|
||||||
|
npx cross-env QUICK_BUILD=true APP_CONFIG=config/dicomweb-server.js
|
||||||
|
yarn run build
|
||||||
# start server --> verify running --> percy + chrome + cypress
|
# start server --> verify running --> percy + chrome + cypress
|
||||||
command: yarn run test:e2e:dist
|
command: yarn run test:e2e:dist
|
||||||
cache-key: 'yarn-packages-{{ checksum "yarn.lock" }}'
|
cache-key: 'yarn-packages-{{ checksum "yarn.lock" }}'
|
||||||
|
|||||||
@ -4,6 +4,7 @@ import dicomParser from 'dicom-parser';
|
|||||||
import getPixelSpacingInformation from '../utils/metadataProvider/getPixelSpacingInformation';
|
import getPixelSpacingInformation from '../utils/metadataProvider/getPixelSpacingInformation';
|
||||||
import fetchPaletteColorLookupTableData from '../utils/metadataProvider/fetchPaletteColorLookupTableData';
|
import fetchPaletteColorLookupTableData from '../utils/metadataProvider/fetchPaletteColorLookupTableData';
|
||||||
import fetchOverlayData from '../utils/metadataProvider/fetchOverlayData';
|
import fetchOverlayData from '../utils/metadataProvider/fetchOverlayData';
|
||||||
|
import validNumber from '../utils/metadataProvider/validNumber';
|
||||||
|
|
||||||
class MetadataProvider {
|
class MetadataProvider {
|
||||||
constructor() {
|
constructor() {
|
||||||
@ -284,7 +285,7 @@ class MetadataProvider {
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
case WADO_IMAGE_LOADER_TAGS.VOI_LUT_MODULE:
|
case WADO_IMAGE_LOADER_TAGS.VOI_LUT_MODULE:
|
||||||
const { WindowCenter, WindowWidth } = instance;
|
let { WindowCenter, WindowWidth } = instance;
|
||||||
|
|
||||||
const windowCenter = Array.isArray(WindowCenter)
|
const windowCenter = Array.isArray(WindowCenter)
|
||||||
? WindowCenter
|
? WindowCenter
|
||||||
@ -294,15 +295,17 @@ class MetadataProvider {
|
|||||||
: [WindowWidth];
|
: [WindowWidth];
|
||||||
|
|
||||||
metadata = {
|
metadata = {
|
||||||
windowCenter,
|
windowCenter: validNumber(windowCenter),
|
||||||
windowWidth,
|
windowWidth: validNumber(windowWidth),
|
||||||
};
|
};
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case WADO_IMAGE_LOADER_TAGS.MODALITY_LUT_MODULE:
|
case WADO_IMAGE_LOADER_TAGS.MODALITY_LUT_MODULE:
|
||||||
|
const rescaleSlope = validNumber(instance.RescaleSlope);
|
||||||
|
const rescaleIntercept = validNumber(instance.RescaleIntercept);
|
||||||
metadata = {
|
metadata = {
|
||||||
rescaleIntercept: instance.RescaleIntercept,
|
rescaleIntercept,
|
||||||
rescaleSlope: instance.RescaleSlope,
|
rescaleSlope,
|
||||||
rescaleType: instance.RescaleType,
|
rescaleType: instance.RescaleType,
|
||||||
};
|
};
|
||||||
break;
|
break;
|
||||||
|
|||||||
9
platform/core/src/utils/metadataProvider/validNumber.js
Normal file
9
platform/core/src/utils/metadataProvider/validNumber.js
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
const validNumber = val => {
|
||||||
|
if (Array.isArray(val)) {
|
||||||
|
return val.map(v => (v !== undefined ? Number(v) : v));
|
||||||
|
} else {
|
||||||
|
return val !== undefined ? Number(val) : val;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export default validNumber;
|
||||||
Loading…
Reference in New Issue
Block a user