Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@cornerstonejs/calculate-suv

Package Overview
Dependencies
Maintainers
6
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cornerstonejs/calculate-suv - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

20

dist/calculate-suv.cjs.development.js

@@ -354,7 +354,8 @@ 'use strict';

const bodyMassIndex = PatientWeight * PatientWeight / (PatientSize * PatientSize * 10000); // convert size in cm
// reference: https://www.medicalconnections.co.uk/kb/calculating-suv-from-pet-images/
if (PatientSex === 'F') {
LBM = 1.07 * PatientWeight - 120 * bodyMassIndex;
LBM = 1.07 * PatientWeight - 148 * bodyMassIndex;
} else if (PatientSex === 'M') {
LBM = 1.1 * PatientWeight - 148 * bodyMassIndex;
LBM = 1.1 * PatientWeight - 120 * bodyMassIndex;
} else {

@@ -454,6 +455,13 @@ throw new Error(`PatientSex is an invalid value: ${PatientSex}`);

}
/**
*
* @param a Simple value or array of simple values
* @param b Simple value or array of simple values
* @returns boolean true if the values are equal.
*/
function arrayEquals(a, b) {
return Array.isArray(a) && Array.isArray(b) && a.length === b.length && a.every((val, index) => val === b[index]);
}
const deepEquals = (a, b) => {
return a === b || Array.isArray(a) && Array.isArray(b) && a.length === b.length && a.every((val, index) => val === b[index]);
};
/**

@@ -489,3 +497,3 @@ * Calculate the SUV factor

const isSingleSeries = instances.every(instance => {
return instance.Units === Units && arrayEquals(instance.CorrectedImage, CorrectedImage) && instance.PatientWeight === PatientWeight && instance.PatientSex === PatientSex && instance.PatientSize === PatientSize && instance.RadionuclideHalfLife === instances[0].RadionuclideHalfLife && instance.RadionuclideTotalDose === instances[0].RadionuclideTotalDose && instance.DecayCorrection === instances[0].DecayCorrection && instance.SeriesDate === instances[0].SeriesDate && instance.SeriesTime === instances[0].SeriesTime;
return instance.Units === Units && deepEquals(instance.CorrectedImage, CorrectedImage) && instance.PatientWeight === PatientWeight && instance.PatientSex === PatientSex && instance.PatientSize === PatientSize && instance.RadionuclideHalfLife === instances[0].RadionuclideHalfLife && instance.RadionuclideTotalDose === instances[0].RadionuclideTotalDose && instance.DecayCorrection === instances[0].DecayCorrection && instance.SeriesDate === instances[0].SeriesDate && instance.SeriesTime === instances[0].SeriesTime;
});

@@ -492,0 +500,0 @@

@@ -1,2 +0,2 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});class e{constructor(e){this.fullDate=e}getTimeInSec(){const e=this.fullDate.substring(0,10),t=this.fullDate.substring(11,28),i=parseInt(e.substring(0,4),10),r=e.length>=7?parseInt(e.substring(5,7),10):void 0,n=e.length>=10?parseInt(e.substring(8,10),10):void 0;if(isNaN(i)||void 0!==r&&isNaN(r)||void 0!==n&&isNaN(n)||i>3e3||r&&(r<1||r>12)||n&&(n<1||n>31))throw new Error(`invalid date '${e}'`);const a=new Date(e+"T00:00:00.000000Z"),o=parseInt(t.substring(0,2),10),s=t.length>=5?parseInt(t.substring(3,5),10):void 0,l=t.length>=8?parseInt(t.substring(6,8),10):void 0,c=t.substring(9,15),u=c?parseInt(c,10)*Math.pow(10,-c.length):void 0;if(isNaN(o)||void 0!==s&&isNaN(s)||void 0!==l&&isNaN(l)||void 0!==u&&isNaN(u)||o<0||o>23||s&&(s<0||s>59)||l&&(l<0||l>59)||u&&(u<0||u>999999))throw new Error(`invalid time '${t}'`);let d=a.getTime()/1e3;return d+=3600*o,void 0!==s&&(d+=60*s),void 0!==l&&(d+=l),void 0!==u&&(d+=u),d}getTimeInMicroSec(){return 1e6*this.getTimeInSec()}}function t(t,i){const r=(""+(i.hours||"00")).padStart(2,"0"),n=(""+(i.minutes||"00")).padStart(2,"0"),a=(""+(i.seconds||"00")).padStart(2,"0"),o=(""+t.month).padStart(2,"0"),s=(""+t.day).padStart(2,"0"),l=(""+(i.fractionalSeconds||"000000")).padEnd(6,"0");return new e(`${t.year}-${o}-${s}T${r}:${n}:${a}.${l}Z`)}function i(e){if(null==e||8!==e.length||"string"!=typeof e)throw new Error(`invalid DA '${e}'`);const t=parseInt(e.substring(0,4),10),i=parseInt(e.substring(4,6),10),r=parseInt(e.substring(6,8),10);if(1!=(n=r,a=i,o=t,!isNaN(o)&&a>0&&a<=12&&n>0&&n<=function(e,t){switch(e){case 2:return t%4==0&&t%100||t%400==0?29:28;case 9:case 4:case 6:case 11:return 30;default:return 31}}(a,o)))throw new Error(`invalid DA '${e}'`);var n,a,o;return{year:t,month:i,day:r}}function r(e){if(null==e||e.length<2||"string"!=typeof e)throw new Error(`invalid TM '${e}'`);const t=parseInt(e.substring(0,2),10),i=e.length>=4?parseInt(e.substring(2,4),10):void 0,r=e.length>=6?parseInt(e.substring(4,6),10):void 0,n=e.length>=8?e.substring(7,13):void 0,a=n?parseInt(n,10)*Math.pow(10,6-n.length):void 0;if(isNaN(t)||void 0!==i&&isNaN(i)||void 0!==r&&isNaN(r)||void 0!==a&&isNaN(a)||t<0||t>23||i&&(i<0||i>59)||r&&(r<0||r>59)||a&&(a<0||a>999999))throw new Error(`invalid TM '${e}'`);return{hours:t,minutes:i,seconds:r,fractionalSeconds:a}}function n(e){if(null==e)throw new Error("dateTimeToFullDateInterface : dateTime not defined.");return t(i(e.substring(0,8)),r(e.substring(8)))}exports.calculateSUVScalingFactors=function(a){const{CorrectedImage:o,Units:s,PhilipsPETPrivateGroup:l,PatientWeight:c,PatientSex:u,PatientSize:d}=a[0];if(!o.includes("ATTN")||!o.includes("DECY"))throw new Error('CorrectedImage must contain "ATTN" and "DECY": '+o);if(!a.every(e=>{return e.Units===s&&(t=e.CorrectedImage,i=o,Array.isArray(t)&&Array.isArray(i)&&t.length===i.length&&t.every((e,t)=>e===i[t]))&&e.PatientWeight===c&&e.PatientSex===u&&e.PatientSize===d&&e.RadionuclideHalfLife===a[0].RadionuclideHalfLife&&e.RadionuclideTotalDose===a[0].RadionuclideTotalDose&&e.DecayCorrection===a[0].DecayCorrection&&e.SeriesDate===a[0].SeriesDate&&e.SeriesTime===a[0].SeriesTime;var t,i}))throw new Error("The set of instances does not appear to come from one Series. Every instance must have identical values for series-level metadata properties");if(null==c)throw new Error("PatientWeight value is missing. It is not possible to calculate the SUV factors");let v=new Array(a.length);v=function(a){const{RadionuclideTotalDose:o,RadionuclideHalfLife:s,RadiopharmaceuticalStartDateTime:l,RadiopharmaceuticalStartTime:c,SeriesDate:u}=a[0];if(null==o)throw new Error("calculateDecayCorrection : RadionuclideTotalDose value not found.");if(null==s)throw new Error("calculateDecayCorrection : RadionuclideHalfLife value not found.");const d=function(a){const{SeriesDate:o,SeriesTime:s,GEPrivatePostInjectionDateTime:l}=a[0],c=new Array(a.length),u=t(i(o),r(s));let d=new e("3000-01-01T00:00:00.000000Z"),v=d.getTimeInSec();if(a.forEach(e=>{const{AcquisitionDate:n,AcquisitionTime:a}=e,o=t(i(n),r(a));d=d.getTimeInSec()>=v||o.getTimeInSec()<d.getTimeInSec()?o:d}),d.getTimeInSec()>=v)throw new Error("Earliest acquisition time or date could not be parsed.");return u.getTimeInSec()<=d.getTimeInSec()?c.fill(u):c.fill(l?n(l):d)}(a),v=function(e){const{RadiopharmaceuticalStartDateTime:a,RadiopharmaceuticalStartTime:o,SeriesDate:s}=e;let l,c;if(a)return n(a);if(o&&s)return l=r(o),c=i(s),t(c,l);throw new Error("Invalid input: "+e)}({RadiopharmaceuticalStartDateTime:l,RadiopharmaceuticalStartTime:c,SeriesDate:u});return a.map((e,t)=>{const i=d[t].getTimeInSec()-v.getTimeInSec();if(i<0)throw new Error("Decay time cannot be less than zero");return 1/(o*Math.pow(2,-i/s))})}(a);let h=new Array(a.length);const p=1e3*c;if("BQML"===s)h=v.map((function(e){return e*p}));else if("CNTS"===s){const e=a.every(e=>{var t,i,r;return e.PhilipsPETPrivateGroup&&null!==(null===(t=e.PhilipsPETPrivateGroup)||void 0===t?void 0:t.SUVScaleFactor)&&void 0!==(null===(i=e.PhilipsPETPrivateGroup)||void 0===i?void 0:i.SUVScaleFactor)&&0!==(null===(r=e.PhilipsPETPrivateGroup)||void 0===r?void 0:r.SUVScaleFactor)}),t=a.every(e=>{var t,i,r;return e.PhilipsPETPrivateGroup&&!(null!==(t=e.PhilipsPETPrivateGroup)&&void 0!==t&&t.SUVScaleFactor)&&void 0!==(null===(i=e.PhilipsPETPrivateGroup)||void 0===i?void 0:i.ActivityConcentrationScaleFactor)&&0!==(null===(r=e.PhilipsPETPrivateGroup)||void 0===r?void 0:r.ActivityConcentrationScaleFactor)});if(e)h=a.map(e=>e.PhilipsPETPrivateGroup.SUVScaleFactor);else{if(!t)throw new Error("Units are in CNTS, but PhilipsPETPrivateGroup has invalid values: "+JSON.stringify(l));h=a.map((e,t)=>e.PhilipsPETPrivateGroup.ActivityConcentrationScaleFactor*v[t]*p)}}else{if("GML"!==s)throw new Error("Units has an invalid value: "+s);h.fill(1)}let S,f;return null==d?console.warn("PatientSize value is missing. It is not possible to calculate the SUV bsa factors"):S=function(e){const{PatientWeight:t,PatientSize:i}=e;return Math.pow(t,.425)*Math.pow(100*i,.725)*71.84}({PatientWeight:c,PatientSize:d}),null==d?console.warn("PatientSize value is missing. It is not possible to calculate the SUV lbm factors"):null==u?console.warn("PatientSex value is missing. It is not possible to calculate the SUV lbm factors"):f=function(e){const{PatientSex:t,PatientWeight:i,PatientSize:r}=e;let n;const a=i*i/(r*r*1e4);if("F"===t)n=1.07*i-120*a;else{if("M"!==t)throw new Error("PatientSex is an invalid value: "+t);n=1.1*i-148*a}return 1e3*n}({PatientWeight:c,PatientSex:u,PatientSize:d}),h.map((function(e,t){const i={suvbw:e};return S&&(i.suvbsa=v[t]*S),f&&(i.suvlbm=v[t]*f),i}))};
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});class e{constructor(e){this.fullDate=e}getTimeInSec(){const e=this.fullDate.substring(0,10),t=this.fullDate.substring(11,28),i=parseInt(e.substring(0,4),10),r=e.length>=7?parseInt(e.substring(5,7),10):void 0,n=e.length>=10?parseInt(e.substring(8,10),10):void 0;if(isNaN(i)||void 0!==r&&isNaN(r)||void 0!==n&&isNaN(n)||i>3e3||r&&(r<1||r>12)||n&&(n<1||n>31))throw new Error(`invalid date '${e}'`);const a=new Date(e+"T00:00:00.000000Z"),o=parseInt(t.substring(0,2),10),s=t.length>=5?parseInt(t.substring(3,5),10):void 0,l=t.length>=8?parseInt(t.substring(6,8),10):void 0,c=t.substring(9,15),u=c?parseInt(c,10)*Math.pow(10,-c.length):void 0;if(isNaN(o)||void 0!==s&&isNaN(s)||void 0!==l&&isNaN(l)||void 0!==u&&isNaN(u)||o<0||o>23||s&&(s<0||s>59)||l&&(l<0||l>59)||u&&(u<0||u>999999))throw new Error(`invalid time '${t}'`);let d=a.getTime()/1e3;return d+=3600*o,void 0!==s&&(d+=60*s),void 0!==l&&(d+=l),void 0!==u&&(d+=u),d}getTimeInMicroSec(){return 1e6*this.getTimeInSec()}}function t(t,i){const r=(""+(i.hours||"00")).padStart(2,"0"),n=(""+(i.minutes||"00")).padStart(2,"0"),a=(""+(i.seconds||"00")).padStart(2,"0"),o=(""+t.month).padStart(2,"0"),s=(""+t.day).padStart(2,"0"),l=(""+(i.fractionalSeconds||"000000")).padEnd(6,"0");return new e(`${t.year}-${o}-${s}T${r}:${n}:${a}.${l}Z`)}function i(e){if(null==e||8!==e.length||"string"!=typeof e)throw new Error(`invalid DA '${e}'`);const t=parseInt(e.substring(0,4),10),i=parseInt(e.substring(4,6),10),r=parseInt(e.substring(6,8),10);if(1!=(n=r,a=i,o=t,!isNaN(o)&&a>0&&a<=12&&n>0&&n<=function(e,t){switch(e){case 2:return t%4==0&&t%100||t%400==0?29:28;case 9:case 4:case 6:case 11:return 30;default:return 31}}(a,o)))throw new Error(`invalid DA '${e}'`);var n,a,o;return{year:t,month:i,day:r}}function r(e){if(null==e||e.length<2||"string"!=typeof e)throw new Error(`invalid TM '${e}'`);const t=parseInt(e.substring(0,2),10),i=e.length>=4?parseInt(e.substring(2,4),10):void 0,r=e.length>=6?parseInt(e.substring(4,6),10):void 0,n=e.length>=8?e.substring(7,13):void 0,a=n?parseInt(n,10)*Math.pow(10,6-n.length):void 0;if(isNaN(t)||void 0!==i&&isNaN(i)||void 0!==r&&isNaN(r)||void 0!==a&&isNaN(a)||t<0||t>23||i&&(i<0||i>59)||r&&(r<0||r>59)||a&&(a<0||a>999999))throw new Error(`invalid TM '${e}'`);return{hours:t,minutes:i,seconds:r,fractionalSeconds:a}}function n(e){if(null==e)throw new Error("dateTimeToFullDateInterface : dateTime not defined.");return t(i(e.substring(0,8)),r(e.substring(8)))}exports.calculateSUVScalingFactors=function(a){const{CorrectedImage:o,Units:s,PhilipsPETPrivateGroup:l,PatientWeight:c,PatientSex:u,PatientSize:d}=a[0];if(!o.includes("ATTN")||!o.includes("DECY"))throw new Error('CorrectedImage must contain "ATTN" and "DECY": '+o);if(!a.every(e=>{return e.Units===s&&((t=e.CorrectedImage)===(i=o)||Array.isArray(t)&&Array.isArray(i)&&t.length===i.length&&t.every((e,t)=>e===i[t]))&&e.PatientWeight===c&&e.PatientSex===u&&e.PatientSize===d&&e.RadionuclideHalfLife===a[0].RadionuclideHalfLife&&e.RadionuclideTotalDose===a[0].RadionuclideTotalDose&&e.DecayCorrection===a[0].DecayCorrection&&e.SeriesDate===a[0].SeriesDate&&e.SeriesTime===a[0].SeriesTime;var t,i}))throw new Error("The set of instances does not appear to come from one Series. Every instance must have identical values for series-level metadata properties");if(null==c)throw new Error("PatientWeight value is missing. It is not possible to calculate the SUV factors");let v=new Array(a.length);v=function(a){const{RadionuclideTotalDose:o,RadionuclideHalfLife:s,RadiopharmaceuticalStartDateTime:l,RadiopharmaceuticalStartTime:c,SeriesDate:u}=a[0];if(null==o)throw new Error("calculateDecayCorrection : RadionuclideTotalDose value not found.");if(null==s)throw new Error("calculateDecayCorrection : RadionuclideHalfLife value not found.");const d=function(a){const{SeriesDate:o,SeriesTime:s,GEPrivatePostInjectionDateTime:l}=a[0],c=new Array(a.length),u=t(i(o),r(s));let d=new e("3000-01-01T00:00:00.000000Z"),v=d.getTimeInSec();if(a.forEach(e=>{const{AcquisitionDate:n,AcquisitionTime:a}=e,o=t(i(n),r(a));d=d.getTimeInSec()>=v||o.getTimeInSec()<d.getTimeInSec()?o:d}),d.getTimeInSec()>=v)throw new Error("Earliest acquisition time or date could not be parsed.");return u.getTimeInSec()<=d.getTimeInSec()?c.fill(u):c.fill(l?n(l):d)}(a),v=function(e){const{RadiopharmaceuticalStartDateTime:a,RadiopharmaceuticalStartTime:o,SeriesDate:s}=e;let l,c;if(a)return n(a);if(o&&s)return l=r(o),c=i(s),t(c,l);throw new Error("Invalid input: "+e)}({RadiopharmaceuticalStartDateTime:l,RadiopharmaceuticalStartTime:c,SeriesDate:u});return a.map((e,t)=>{const i=d[t].getTimeInSec()-v.getTimeInSec();if(i<0)throw new Error("Decay time cannot be less than zero");return 1/(o*Math.pow(2,-i/s))})}(a);let h=new Array(a.length);const p=1e3*c;if("BQML"===s)h=v.map((function(e){return e*p}));else if("CNTS"===s){const e=a.every(e=>{var t,i,r;return e.PhilipsPETPrivateGroup&&null!==(null===(t=e.PhilipsPETPrivateGroup)||void 0===t?void 0:t.SUVScaleFactor)&&void 0!==(null===(i=e.PhilipsPETPrivateGroup)||void 0===i?void 0:i.SUVScaleFactor)&&0!==(null===(r=e.PhilipsPETPrivateGroup)||void 0===r?void 0:r.SUVScaleFactor)}),t=a.every(e=>{var t,i,r;return e.PhilipsPETPrivateGroup&&!(null!==(t=e.PhilipsPETPrivateGroup)&&void 0!==t&&t.SUVScaleFactor)&&void 0!==(null===(i=e.PhilipsPETPrivateGroup)||void 0===i?void 0:i.ActivityConcentrationScaleFactor)&&0!==(null===(r=e.PhilipsPETPrivateGroup)||void 0===r?void 0:r.ActivityConcentrationScaleFactor)});if(e)h=a.map(e=>e.PhilipsPETPrivateGroup.SUVScaleFactor);else{if(!t)throw new Error("Units are in CNTS, but PhilipsPETPrivateGroup has invalid values: "+JSON.stringify(l));h=a.map((e,t)=>e.PhilipsPETPrivateGroup.ActivityConcentrationScaleFactor*v[t]*p)}}else{if("GML"!==s)throw new Error("Units has an invalid value: "+s);h.fill(1)}let S,f;return null==d?console.warn("PatientSize value is missing. It is not possible to calculate the SUV bsa factors"):S=function(e){const{PatientWeight:t,PatientSize:i}=e;return Math.pow(t,.425)*Math.pow(100*i,.725)*71.84}({PatientWeight:c,PatientSize:d}),null==d?console.warn("PatientSize value is missing. It is not possible to calculate the SUV lbm factors"):null==u?console.warn("PatientSex value is missing. It is not possible to calculate the SUV lbm factors"):f=function(e){const{PatientSex:t,PatientWeight:i,PatientSize:r}=e;let n;const a=i*i/(r*r*1e4);if("F"===t)n=1.07*i-148*a;else{if("M"!==t)throw new Error("PatientSex is an invalid value: "+t);n=1.1*i-120*a}return 1e3*n}({PatientWeight:c,PatientSex:u,PatientSize:d}),h.map((function(e,t){const i={suvbw:e};return S&&(i.suvbsa=v[t]*S),f&&(i.suvlbm=v[t]*f),i}))};
//# sourceMappingURL=calculate-suv.cjs.production.min.js.map

@@ -350,7 +350,8 @@ /**

const bodyMassIndex = PatientWeight * PatientWeight / (PatientSize * PatientSize * 10000); // convert size in cm
// reference: https://www.medicalconnections.co.uk/kb/calculating-suv-from-pet-images/
if (PatientSex === 'F') {
LBM = 1.07 * PatientWeight - 120 * bodyMassIndex;
LBM = 1.07 * PatientWeight - 148 * bodyMassIndex;
} else if (PatientSex === 'M') {
LBM = 1.1 * PatientWeight - 148 * bodyMassIndex;
LBM = 1.1 * PatientWeight - 120 * bodyMassIndex;
} else {

@@ -450,6 +451,13 @@ throw new Error(`PatientSex is an invalid value: ${PatientSex}`);

}
/**
*
* @param a Simple value or array of simple values
* @param b Simple value or array of simple values
* @returns boolean true if the values are equal.
*/
function arrayEquals(a, b) {
return Array.isArray(a) && Array.isArray(b) && a.length === b.length && a.every((val, index) => val === b[index]);
}
const deepEquals = (a, b) => {
return a === b || Array.isArray(a) && Array.isArray(b) && a.length === b.length && a.every((val, index) => val === b[index]);
};
/**

@@ -485,3 +493,3 @@ * Calculate the SUV factor

const isSingleSeries = instances.every(instance => {
return instance.Units === Units && arrayEquals(instance.CorrectedImage, CorrectedImage) && instance.PatientWeight === PatientWeight && instance.PatientSex === PatientSex && instance.PatientSize === PatientSize && instance.RadionuclideHalfLife === instances[0].RadionuclideHalfLife && instance.RadionuclideTotalDose === instances[0].RadionuclideTotalDose && instance.DecayCorrection === instances[0].DecayCorrection && instance.SeriesDate === instances[0].SeriesDate && instance.SeriesTime === instances[0].SeriesTime;
return instance.Units === Units && deepEquals(instance.CorrectedImage, CorrectedImage) && instance.PatientWeight === PatientWeight && instance.PatientSex === PatientSex && instance.PatientSize === PatientSize && instance.RadionuclideHalfLife === instances[0].RadionuclideHalfLife && instance.RadionuclideTotalDose === instances[0].RadionuclideTotalDose && instance.DecayCorrection === instances[0].DecayCorrection && instance.SeriesDate === instances[0].SeriesDate && instance.SeriesTime === instances[0].SeriesTime;
});

@@ -488,0 +496,0 @@

@@ -18,3 +18,3 @@ /**

export interface InstanceMetadata {
CorrectedImage: string[];
CorrectedImage: string[] | string;
Units: string;

@@ -21,0 +21,0 @@ RadionuclideHalfLife: number;

{
"name": "@cornerstonejs/calculate-suv",
"version": "1.0.2",
"version": "1.0.3",
"license": "MIT",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -1,5 +0,5 @@

# calculate-suv
Tiny library for calculating Standardized Uptake Value for Nuclear Medicine (i.e. PET, SPECT)
# @cornerstonejs/calculate-suv
A tiny library for calculating Standardized Uptake Value (SUV) for Nuclear Medicine (i.e. PET, SPECT)
Follows the logic laid out by the Quantitative Imaging Biomarkers Alliance (QIBA) on their [Wiki page](https://qibawiki.rsna.org/index.php/Standardized_Uptake_Value_(SUV)).
This library follows the logic laid out by the [Quantitative Imaging Biomarkers Alliance (QIBA)](https://www.rsna.org/research/quantitative-imaging-biomarkers-alliance) on their [Wiki page](https://qibawiki.rsna.org/index.php/Standardized_Uptake_Value_(SUV)).

@@ -6,0 +6,0 @@ Special thanks to [Salim Kanoun MD](https://github.com/salimkanoun) from [The Cancer University Institute of Toulouse - Oncopole](https://www.oncopole-toulouse.com/en/iuct-oncopole) and [Lysarc](https://lymphoma-research-experts.org/lysarc/) for their assistance.

@@ -9,3 +9,3 @@ /**

PatientSize: number; // m
PatientSex: string; //'M' | 'F';
PatientSex: string; //'M' | 'F' | 'O';
PatientWeight: number; // Kg

@@ -22,6 +22,7 @@ }

(PatientWeight * PatientWeight) / (PatientSize * PatientSize * 10000); // convert size in cm
// reference: https://www.medicalconnections.co.uk/kb/calculating-suv-from-pet-images/
if (PatientSex === 'F') {
LBM = 1.07 * PatientWeight - 120 * bodyMassIndex;
LBM = 1.07 * PatientWeight - 148 * bodyMassIndex;
} else if (PatientSex === 'M') {
LBM = 1.1 * PatientWeight - 148 * bodyMassIndex;
LBM = 1.1 * PatientWeight - 120 * bodyMassIndex;
} else {

@@ -28,0 +29,0 @@ throw new Error(`PatientSex is an invalid value: ${PatientSex}`);

@@ -73,10 +73,20 @@ import { FullDateInterface } from './combineDateTime';

function arrayEquals(a: any[], b: any[]): boolean {
/**
*
* @param a Simple value or array of simple values
* @param b Simple value or array of simple values
* @returns boolean true if the values are equal.
*/
const deepEquals = (
a: string | number | any[],
b: string | number | any[]
): boolean => {
return (
Array.isArray(a) &&
Array.isArray(b) &&
a.length === b.length &&
a.every((val, index) => val === b[index])
a === b ||
(Array.isArray(a) &&
Array.isArray(b) &&
a.length === b.length &&
a.every((val, index) => val === b[index]))
);
}
};

@@ -117,3 +127,3 @@ /**

instance.Units === Units &&
arrayEquals(instance.CorrectedImage, CorrectedImage) &&
deepEquals(instance.CorrectedImage, CorrectedImage) &&
instance.PatientWeight === PatientWeight &&

@@ -120,0 +130,0 @@ instance.PatientSex === PatientSex &&

@@ -19,3 +19,3 @@ /**

export interface InstanceMetadata {
CorrectedImage: string[];
CorrectedImage: string[] | string; // The dcmjs naturalize produces a string value for single item arrays :-(
Units: string; // 'BQML' | 'CNTS' | 'GML'; // Units (0x0054,0x1001)

@@ -22,0 +22,0 @@ RadionuclideHalfLife: number; // RadionuclideHalfLife(0x0018,0x1075) in Radiopharmaceutical Information Sequence(0x0054,0x0016)

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc