2022-07-27 18:39:04 +02:00
|
|
|
import React from 'react';
|
2023-09-22 16:23:44 +02:00
|
|
|
import { Input, Label, Select, LegacyButton, LegacyButtonGroup } from '@ohif/ui';
|
2022-07-27 18:39:04 +02:00
|
|
|
import { useTranslation } from 'react-i18next';
|
|
|
|
|
|
|
|
|
|
export const ROI_STAT = 'roi_stat';
|
|
|
|
|
const RANGE = 'range';
|
|
|
|
|
|
|
|
|
|
const options = [
|
|
|
|
|
{ value: ROI_STAT, label: 'Max', placeHolder: 'Max' },
|
|
|
|
|
{ value: RANGE, label: 'Range', placeHolder: 'Range' },
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
function ROIThresholdConfiguration({ config, dispatch, runCommand }) {
|
|
|
|
|
const { t } = useTranslation('ROIThresholdConfiguration');
|
|
|
|
|
|
|
|
|
|
return (
|
2024-04-03 05:33:04 +02:00
|
|
|
<div className="bg-primary-dark flex flex-col space-y-4">
|
2022-07-27 18:39:04 +02:00
|
|
|
<div className="flex items-end space-x-2">
|
2023-09-01 22:19:39 +02:00
|
|
|
<div className="flex w-1/2 flex-col">
|
2022-07-27 18:39:04 +02:00
|
|
|
<Select
|
|
|
|
|
label={t('Strategy')}
|
|
|
|
|
closeMenuOnSelect={true}
|
2023-09-01 22:19:39 +02:00
|
|
|
className="border-primary-main mr-2 bg-black text-white "
|
2022-07-27 18:39:04 +02:00
|
|
|
options={options}
|
2023-09-01 22:19:39 +02:00
|
|
|
placeholder={options.find(option => option.value === config.strategy).placeHolder}
|
2022-07-27 18:39:04 +02:00
|
|
|
value={config.strategy}
|
|
|
|
|
onChange={({ value }) => {
|
|
|
|
|
dispatch({
|
|
|
|
|
type: 'setStrategy',
|
|
|
|
|
payload: {
|
|
|
|
|
strategy: value,
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
<div className="w-1/2">
|
2023-09-22 16:23:44 +02:00
|
|
|
{/* TODO Revisit design of LegacyButtonGroup later - for now use LegacyButton for its children.*/}
|
|
|
|
|
<LegacyButtonGroup>
|
2023-06-15 18:58:21 +02:00
|
|
|
<LegacyButton
|
2022-09-20 02:02:53 +02:00
|
|
|
size="initial"
|
|
|
|
|
className="px-2 py-2 text-base text-white"
|
|
|
|
|
color="primaryLight"
|
|
|
|
|
variant="outlined"
|
2022-07-27 18:39:04 +02:00
|
|
|
onClick={() => runCommand('setStartSliceForROIThresholdTool')}
|
|
|
|
|
>
|
|
|
|
|
{t('Start')}
|
2023-06-15 18:58:21 +02:00
|
|
|
</LegacyButton>
|
|
|
|
|
<LegacyButton
|
2022-09-20 02:02:53 +02:00
|
|
|
size="initial"
|
|
|
|
|
color="primaryLight"
|
|
|
|
|
variant="outlined"
|
|
|
|
|
className="px-2 py-2 text-base text-white"
|
2022-07-27 18:39:04 +02:00
|
|
|
onClick={() => runCommand('setEndSliceForROIThresholdTool')}
|
|
|
|
|
>
|
|
|
|
|
{t('End')}
|
2023-06-15 18:58:21 +02:00
|
|
|
</LegacyButton>
|
2023-09-22 16:23:44 +02:00
|
|
|
</LegacyButtonGroup>
|
2022-07-27 18:39:04 +02:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
{config.strategy === ROI_STAT && (
|
|
|
|
|
<Input
|
|
|
|
|
label={t('Percentage of Max SUV')}
|
2024-04-03 05:33:04 +02:00
|
|
|
labelClassName="text-[13px] font-inter text-white"
|
|
|
|
|
className="border-primary-main bg-black"
|
2022-07-27 18:39:04 +02:00
|
|
|
type="text"
|
|
|
|
|
containerClassName="mr-2"
|
|
|
|
|
value={config.weight}
|
|
|
|
|
onChange={e => {
|
|
|
|
|
dispatch({
|
|
|
|
|
type: 'setWeight',
|
2023-04-06 20:05:46 +02:00
|
|
|
payload: {
|
|
|
|
|
weight: e.target.value,
|
|
|
|
|
},
|
2022-07-27 18:39:04 +02:00
|
|
|
});
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
)}
|
|
|
|
|
{config.strategy !== ROI_STAT && (
|
2023-09-01 22:19:39 +02:00
|
|
|
<div className="mr-2 text-sm">
|
2023-03-08 04:47:16 +01:00
|
|
|
<table>
|
|
|
|
|
<tbody>
|
|
|
|
|
<tr className="mt-2">
|
2023-09-01 22:19:39 +02:00
|
|
|
<td
|
2024-04-03 05:33:04 +02:00
|
|
|
className="pr-4"
|
2023-09-01 22:19:39 +02:00
|
|
|
colSpan="3"
|
|
|
|
|
>
|
2023-03-08 04:47:16 +01:00
|
|
|
<Label
|
2024-04-03 05:33:04 +02:00
|
|
|
className="font-inter text-[13px] text-white"
|
2023-03-08 04:47:16 +01:00
|
|
|
text="Lower & Upper Ranges"
|
|
|
|
|
></Label>
|
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
<tr className="mt-2">
|
2023-09-01 22:19:39 +02:00
|
|
|
<td className="pr-4 pt-2 text-center">
|
|
|
|
|
<Label
|
|
|
|
|
className="text-white"
|
|
|
|
|
text="CT"
|
|
|
|
|
></Label>
|
2023-03-08 04:47:16 +01:00
|
|
|
</td>
|
|
|
|
|
<td>
|
|
|
|
|
<div className="flex justify-between">
|
|
|
|
|
<Input
|
|
|
|
|
label={t('')}
|
|
|
|
|
labelClassName="text-white"
|
2023-09-01 22:19:39 +02:00
|
|
|
className="border-primary-main mt-2 bg-black"
|
2023-03-08 04:47:16 +01:00
|
|
|
type="text"
|
|
|
|
|
containerClassName="mr-2"
|
|
|
|
|
value={config.ctLower}
|
|
|
|
|
onChange={e => {
|
|
|
|
|
dispatch({
|
|
|
|
|
type: 'setThreshold',
|
|
|
|
|
payload: {
|
|
|
|
|
ctLower: e.target.value,
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
<Input
|
|
|
|
|
label={t('')}
|
|
|
|
|
labelClassName="text-white"
|
2023-09-01 22:19:39 +02:00
|
|
|
className="border-primary-main mt-2 bg-black"
|
2023-03-08 04:47:16 +01:00
|
|
|
type="text"
|
|
|
|
|
containerClassName="mr-2"
|
|
|
|
|
value={config.ctUpper}
|
|
|
|
|
onChange={e => {
|
|
|
|
|
dispatch({
|
|
|
|
|
type: 'setThreshold',
|
|
|
|
|
payload: {
|
|
|
|
|
ctUpper: e.target.value,
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
<tr>
|
2023-09-01 22:19:39 +02:00
|
|
|
<td className="pr-4 pt-2 text-center">
|
|
|
|
|
<Label
|
|
|
|
|
className="text-white"
|
|
|
|
|
text="PT"
|
|
|
|
|
></Label>
|
2023-03-08 04:47:16 +01:00
|
|
|
</td>
|
|
|
|
|
<td>
|
|
|
|
|
<div className="flex justify-between">
|
|
|
|
|
<Input
|
|
|
|
|
label={t('')}
|
|
|
|
|
labelClassName="text-white"
|
2023-09-01 22:19:39 +02:00
|
|
|
className="border-primary-main mt-2 bg-black"
|
2023-03-08 04:47:16 +01:00
|
|
|
type="text"
|
|
|
|
|
containerClassName="mr-2"
|
|
|
|
|
value={config.ptLower}
|
|
|
|
|
onChange={e => {
|
|
|
|
|
dispatch({
|
|
|
|
|
type: 'setThreshold',
|
|
|
|
|
payload: {
|
|
|
|
|
ptLower: e.target.value,
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
<Input
|
|
|
|
|
label={t('')}
|
|
|
|
|
labelClassName="text-white"
|
2023-09-01 22:19:39 +02:00
|
|
|
className="border-primary-main mt-2 bg-black"
|
2023-03-08 04:47:16 +01:00
|
|
|
type="text"
|
|
|
|
|
containerClassName="mr-2"
|
|
|
|
|
value={config.ptUpper}
|
|
|
|
|
onChange={e => {
|
|
|
|
|
dispatch({
|
|
|
|
|
type: 'setThreshold',
|
|
|
|
|
payload: {
|
|
|
|
|
ptUpper: e.target.value,
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
</tbody>
|
|
|
|
|
</table>
|
2022-07-27 18:39:04 +02:00
|
|
|
</div>
|
|
|
|
|
)}
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default ROIThresholdConfiguration;
|