feat(tmtv): add ct ranges for thresholding (#3225)

* Add CT volume in PET ROI Thresholding (#3053)

* Add CT volume in PET ROI Thresholding

* Change UI ROI Threshold config

* Refactoring ROI Threshold configuration Panel

* fix menus

* try to fix build preview

* try to fix build preview

---------

Co-authored-by: rodrigobasilio2022 <114958722+rodrigobasilio2022@users.noreply.github.com>
This commit is contained in:
Alirezaandrodrigobasilio2022 authored and GitHub committed 2023-03-07 22:47:16 -05:00
1 parent f14e23cb8b
commit 7a591b87a2
5 files changed
+240 -156

No files matched your search

+29 -19
View File
@@ -1,19 +1,7 @@
import * as csTools from '@cornerstonejs/tools';
function getThresholdValues(
annotationUIDs,
referencedVolume,
config
): { lower: number; upper: number } {
if (config.strategy === 'range') {
return {
lower: Number(config.lower),
upper: Number(config.upper),
};
}
function getRoiStats(referencedVolume, annotations) {
// roiStats
const { weight } = config;
const { imageData } = referencedVolume;
const values = imageData
.getPointData()
@@ -24,10 +12,6 @@ function getThresholdValues(
const { fn, baseValue } = _getStrategyFn('max');
let value = baseValue;
const annotations = annotationUIDs.map(annotationUID =>
csTools.annotation.state.getAnnotation(annotationUID)
);
const boundsIJK = csTools.utilities.rectangleROITool.getBoundsIJKFromRectangleAnnotations(
annotations,
referencedVolume
@@ -43,10 +27,36 @@ function getThresholdValues(
}
}
}
return value;
}
function getThresholdValues(
annotationUIDs,
referencedVolumes,
config
): { ptLower: number; ptUpper: number; ctLower: number; ctUpper: number } {
if (config.strategy === 'range') {
return {
ptLower: Number(config.ptLower),
ptUpper: Number(config.ptUpper),
ctLower: Number(config.ctLower),
ctUpper: Number(config.ctUpper),
};
}
const { weight } = config;
const annotations = annotationUIDs.map(annotationUID =>
csTools.annotation.state.getAnnotation(annotationUID)
);
const ptValue = getRoiStats(referencedVolumes[0], annotations);
const ctValue = getRoiStats(referencedVolumes[1], annotations);
return {
lower: weight * value,
upper: +Infinity,
ctLower: weight * ctValue,
ctUpper: +Infinity,
ptLower: weight * ptValue,
ptUpper: +Infinity,
};
}