Skip to content

Commit

Permalink
Make canGetSuvFactor return undef if ok
Browse files Browse the repository at this point in the history
  • Loading branch information
ivmartel committed Dec 15, 2023
1 parent 770ae24 commit 48b4a15
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions src/dicom/dicomElementsWrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,8 @@ function checkTag(element, name, values) {
* Do the input elements allow for PET SUV calculation.
*
* @param {object} elements The DICOM elements to check.
* @returns {string} A warning if the elements are not as expected.
* @returns {string|undefined} A warning if the elements are not as expected,
* undefined if all good.
*/
export function canGetSuvFactor(elements) {
let warning = '';
Expand Down Expand Up @@ -648,10 +649,11 @@ export function canGetSuvFactor(elements) {
}
}

let res;
if (warning.length !== 0) {
warning = 'Cannot calculate PET SUV:' + warning;
res = 'Cannot calculate PET SUV:' + warning;
}
return warning;
return res;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/image/imageFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ export class ImageFactory {
if (typeof meta.Modality !== 'undefined' &&
meta.Modality === 'PT') {
const warn = canGetSuvFactor(dataElements);
if (warn.length === 0) {
if (typeof warn === 'undefined') {
isPetWithSuv = true;
} else {
logger.warn(warn);
Expand Down

0 comments on commit 48b4a15

Please sign in to comment.