fix: catch errors in getPTImageIdInstanceMetadata (#3897)
This commit is contained in:
parent
94f40192f5
commit
a47aeb8bd7
@ -63,6 +63,9 @@ const handlePETImageMetadata = ({ SeriesInstanceUID, StudyInstanceUID }) => {
|
|||||||
|
|
||||||
const imageIds = instances.map(instance => instance.imageId);
|
const imageIds = instances.map(instance => instance.imageId);
|
||||||
const instanceMetadataArray = [];
|
const instanceMetadataArray = [];
|
||||||
|
|
||||||
|
// try except block to prevent errors when the metadata is not correct
|
||||||
|
try {
|
||||||
imageIds.forEach(imageId => {
|
imageIds.forEach(imageId => {
|
||||||
const instanceMetadata = getPTImageIdInstanceMetadata(imageId);
|
const instanceMetadata = getPTImageIdInstanceMetadata(imageId);
|
||||||
if (instanceMetadata) {
|
if (instanceMetadata) {
|
||||||
@ -74,19 +77,15 @@ const handlePETImageMetadata = ({ SeriesInstanceUID, StudyInstanceUID }) => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// try except block to prevent errors when the metadata is not correct
|
const suvScalingFactors = calculateSUVScalingFactors(instanceMetadataArray);
|
||||||
let suvScalingFactors;
|
instanceMetadataArray.forEach((instanceMetadata, index) => {
|
||||||
try {
|
metadataProvider.addCustomMetadata(
|
||||||
suvScalingFactors = calculateSUVScalingFactors(instanceMetadataArray);
|
imageIds[index],
|
||||||
|
'scalingModule',
|
||||||
|
suvScalingFactors[index]
|
||||||
|
);
|
||||||
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!suvScalingFactors) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
instanceMetadataArray.forEach((instanceMetadata, index) => {
|
|
||||||
metadataProvider.addCustomMetadata(imageIds[index], 'scalingModule', suvScalingFactors[index]);
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user