fix(metadata): change the default values for cosines (#4863)
This commit is contained in:
parent
ec71721d49
commit
b7fbf04230
@ -512,7 +512,7 @@ export default metadataProvider;
|
||||
|
||||
const WADO_IMAGE_LOADER = {
|
||||
imagePlaneModule: instance => {
|
||||
const { ImageOrientationPatient } = instance;
|
||||
const { ImageOrientationPatient, ImagePositionPatient } = instance;
|
||||
|
||||
// Fallback for DX images.
|
||||
// TODO: We should use the rest of the results of this function
|
||||
@ -525,14 +525,33 @@ const WADO_IMAGE_LOADER = {
|
||||
let rowCosines;
|
||||
let columnCosines;
|
||||
|
||||
let usingDefaultValues = false;
|
||||
let isDefaultValueSetForRowCosine = false;
|
||||
let isDefaultValueSetForColumnCosine = false;
|
||||
let imageOrientationPatient;
|
||||
if (PixelSpacing) {
|
||||
rowPixelSpacing = PixelSpacing[0];
|
||||
columnPixelSpacing = PixelSpacing[1];
|
||||
[rowPixelSpacing, columnPixelSpacing] = PixelSpacing;
|
||||
} else {
|
||||
rowPixelSpacing = columnPixelSpacing = 1;
|
||||
usingDefaultValues = true;
|
||||
}
|
||||
|
||||
if (ImageOrientationPatient) {
|
||||
rowCosines = ImageOrientationPatient.slice(0, 3);
|
||||
columnCosines = ImageOrientationPatient.slice(3, 6);
|
||||
imageOrientationPatient = ImageOrientationPatient;
|
||||
} else {
|
||||
rowCosines = [1, 0, 0];
|
||||
columnCosines = [0, 1, 0];
|
||||
imageOrientationPatient = [1, 0, 0, 0, 1, 0];
|
||||
usingDefaultValues = true;
|
||||
isDefaultValueSetForRowCosine = true;
|
||||
isDefaultValueSetForColumnCosine = true;
|
||||
}
|
||||
|
||||
const imagePositionPatient = ImagePositionPatient || [0, 0, 0];
|
||||
if (!ImagePositionPatient) {
|
||||
usingDefaultValues = true;
|
||||
}
|
||||
|
||||
return {
|
||||
@ -540,17 +559,18 @@ const WADO_IMAGE_LOADER = {
|
||||
rows: toNumber(instance.Rows),
|
||||
columns: toNumber(instance.Columns),
|
||||
spacingBetweenSlices: toNumber(instance.SpacingBetweenSlices),
|
||||
imageOrientationPatient: toNumber(ImageOrientationPatient) || [0, 1, 0, 0, 0, -1],
|
||||
rowCosines: toNumber(rowCosines || [0, 1, 0]),
|
||||
isDefaultValueSetForRowCosine: toNumber(rowCosines) ? false : true,
|
||||
columnCosines: toNumber(columnCosines || [0, 0, -1]),
|
||||
isDefaultValueSetForColumnCosine: toNumber(columnCosines) ? false : true,
|
||||
imagePositionPatient: toNumber(instance.ImagePositionPatient || [0, 0, 0]),
|
||||
imageOrientationPatient,
|
||||
rowCosines,
|
||||
isDefaultValueSetForRowCosine,
|
||||
columnCosines,
|
||||
isDefaultValueSetForColumnCosine,
|
||||
imagePositionPatient,
|
||||
sliceThickness: toNumber(instance.SliceThickness),
|
||||
sliceLocation: toNumber(instance.SliceLocation),
|
||||
pixelSpacing: toNumber(PixelSpacing || 1),
|
||||
rowPixelSpacing: rowPixelSpacing ? toNumber(rowPixelSpacing) : null,
|
||||
columnPixelSpacing: columnPixelSpacing ? toNumber(columnPixelSpacing) : null,
|
||||
rowPixelSpacing,
|
||||
columnPixelSpacing,
|
||||
usingDefaultValues,
|
||||
};
|
||||
},
|
||||
};
|
||||
|
||||
Loading…
Reference in New Issue
Block a user