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 = {
|
const WADO_IMAGE_LOADER = {
|
||||||
imagePlaneModule: instance => {
|
imagePlaneModule: instance => {
|
||||||
const { ImageOrientationPatient } = instance;
|
const { ImageOrientationPatient, ImagePositionPatient } = instance;
|
||||||
|
|
||||||
// Fallback for DX images.
|
// Fallback for DX images.
|
||||||
// TODO: We should use the rest of the results of this function
|
// TODO: We should use the rest of the results of this function
|
||||||
@ -525,14 +525,33 @@ const WADO_IMAGE_LOADER = {
|
|||||||
let rowCosines;
|
let rowCosines;
|
||||||
let columnCosines;
|
let columnCosines;
|
||||||
|
|
||||||
|
let usingDefaultValues = false;
|
||||||
|
let isDefaultValueSetForRowCosine = false;
|
||||||
|
let isDefaultValueSetForColumnCosine = false;
|
||||||
|
let imageOrientationPatient;
|
||||||
if (PixelSpacing) {
|
if (PixelSpacing) {
|
||||||
rowPixelSpacing = PixelSpacing[0];
|
[rowPixelSpacing, columnPixelSpacing] = PixelSpacing;
|
||||||
columnPixelSpacing = PixelSpacing[1];
|
} else {
|
||||||
|
rowPixelSpacing = columnPixelSpacing = 1;
|
||||||
|
usingDefaultValues = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ImageOrientationPatient) {
|
if (ImageOrientationPatient) {
|
||||||
rowCosines = ImageOrientationPatient.slice(0, 3);
|
rowCosines = ImageOrientationPatient.slice(0, 3);
|
||||||
columnCosines = ImageOrientationPatient.slice(3, 6);
|
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 {
|
return {
|
||||||
@ -540,17 +559,18 @@ const WADO_IMAGE_LOADER = {
|
|||||||
rows: toNumber(instance.Rows),
|
rows: toNumber(instance.Rows),
|
||||||
columns: toNumber(instance.Columns),
|
columns: toNumber(instance.Columns),
|
||||||
spacingBetweenSlices: toNumber(instance.SpacingBetweenSlices),
|
spacingBetweenSlices: toNumber(instance.SpacingBetweenSlices),
|
||||||
imageOrientationPatient: toNumber(ImageOrientationPatient) || [0, 1, 0, 0, 0, -1],
|
imageOrientationPatient,
|
||||||
rowCosines: toNumber(rowCosines || [0, 1, 0]),
|
rowCosines,
|
||||||
isDefaultValueSetForRowCosine: toNumber(rowCosines) ? false : true,
|
isDefaultValueSetForRowCosine,
|
||||||
columnCosines: toNumber(columnCosines || [0, 0, -1]),
|
columnCosines,
|
||||||
isDefaultValueSetForColumnCosine: toNumber(columnCosines) ? false : true,
|
isDefaultValueSetForColumnCosine,
|
||||||
imagePositionPatient: toNumber(instance.ImagePositionPatient || [0, 0, 0]),
|
imagePositionPatient,
|
||||||
sliceThickness: toNumber(instance.SliceThickness),
|
sliceThickness: toNumber(instance.SliceThickness),
|
||||||
sliceLocation: toNumber(instance.SliceLocation),
|
sliceLocation: toNumber(instance.SliceLocation),
|
||||||
pixelSpacing: toNumber(PixelSpacing || 1),
|
pixelSpacing: toNumber(PixelSpacing || 1),
|
||||||
rowPixelSpacing: rowPixelSpacing ? toNumber(rowPixelSpacing) : null,
|
rowPixelSpacing,
|
||||||
columnPixelSpacing: columnPixelSpacing ? toNumber(columnPixelSpacing) : null,
|
columnPixelSpacing,
|
||||||
|
usingDefaultValues,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user