From 0ac1518904384cd3132662a1cebbcd0557950483 Mon Sep 17 00:00:00 2001 From: yxd92326 Date: Tue, 21 Oct 2025 13:31:20 +0100 Subject: [PATCH 1/4] Add an option to turn off 3D classification --- src/components/forms.tsx | 10 ++++++++-- src/loaders/processingParameters.tsx | 4 ++++ src/routes/SessionParameters.tsx | 3 +++ src/schema/main.ts | 10 ++++++++++ 4 files changed, 25 insertions(+), 2 deletions(-) diff --git a/src/components/forms.tsx b/src/components/forms.tsx index a870318..203c9a8 100644 --- a/src/components/forms.tsx +++ b/src/components/forms.tsx @@ -22,6 +22,7 @@ const formDataSPA: { [key: string]: any } = { particle_diameter: null, extract_downscale: true, eer_fractionation: 20, + run_class3d: true, } const formDataTomo: { [key: string]: any } = { @@ -59,6 +60,7 @@ const SpaForm = (submissionCallback: (arg0: any) => void) => { ? null : formData.get('particle-diameter') formDataSPA.eer_fractionation = formData.get('eer-grouping') + formDataSPA.run_class3d = formData.get('run-class3d') callback(formDataSPA) } @@ -127,8 +129,12 @@ const SpaForm = (submissionCallback: (arg0: any) => void) => { )} - Downscale in extraction - + Run 3D classification + diff --git a/src/loaders/processingParameters.tsx b/src/loaders/processingParameters.tsx index e5159e7..486609c 100644 --- a/src/loaders/processingParameters.tsx +++ b/src/loaders/processingParameters.tsx @@ -39,6 +39,10 @@ export const updateSessionProcessingParameters = async ( dose_per_frame: params['dosePerFrame'] ?? null, eer_fractionation_file: params['eerFractionationFile'] ?? '', symmetry: params['symmetry'] ?? '', + run_class3d: + typeof params['run_class3d'] == 'boolean' + ? params['run_class3d'] + : null, } ) if (response.status !== 200) { diff --git a/src/routes/SessionParameters.tsx b/src/routes/SessionParameters.tsx index b82ff11..aca4290 100644 --- a/src/routes/SessionParameters.tsx +++ b/src/routes/SessionParameters.tsx @@ -42,6 +42,7 @@ const nameLabelMap: Map = new Map([ ['gain_ref', 'Gain Reference'], ['symmetry', 'Symmetry'], ['eer_fractionation_file', 'EER fractionation file (for motion correction)'], + ['run_class3d', 'Run 3D classification?'], ]) export const SessionParameters = () => { @@ -70,6 +71,7 @@ export const SessionParameters = () => { | 'dose_per_frame' | 'eer_fractionation_file' | 'symmetry' + | 'run_class3d' | '' const [paramName, setParamName] = React.useState('') const [paramValue, setParamValue] = React.useState('') @@ -91,6 +93,7 @@ export const SessionParameters = () => { eerFractionationFile: paramKey === 'eer_fractionation_file' ? paramValue : '', symmetry: paramKey === 'symmetry' ? paramValue : '', + run_class3d: paramKey === 'run_class3d' ? paramValue : null, } await updateSessionProcessingParameters(sessid ?? '0', data) queryClient.refetchQueries({ queryKey: ['processingParameters', sessid] }) diff --git a/src/schema/main.ts b/src/schema/main.ts index 77e0126..38b2465 100644 --- a/src/schema/main.ts +++ b/src/schema/main.ts @@ -888,6 +888,11 @@ export interface components { * @default */ symmetry?: string + /** + * Run 3D classification? + * @default + */ + run_class3d?: boolean } /** File */ File: { @@ -1557,6 +1562,11 @@ export interface components { * @default 20 */ eer_fractionation?: number + /** + * Run 3D classification? + * @default true + */ + run_class3d?: boolean } /** RSyncerInfo */ RSyncerInfo: { From daddb3f740ebff294e341f240d7ddeb68723e57b Mon Sep 17 00:00:00 2001 From: yxd92326 Date: Wed, 22 Oct 2025 10:03:37 +0100 Subject: [PATCH 2/4] Update the state on a switch change --- src/components/forms.tsx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/components/forms.tsx b/src/components/forms.tsx index 203c9a8..d31e5aa 100644 --- a/src/components/forms.tsx +++ b/src/components/forms.tsx @@ -37,12 +37,18 @@ const SpaForm = (submissionCallback: (arg0: any) => void) => { } const [symmetryType, setSymmetryType] = React.useState('C') const [particleDetection, setParticleDetection] = React.useState(true) + const [runClass3D, setRunClass3D] = React.useState(true) const handleChange = (event: React.ChangeEvent) => { setSymmetryType(event.target.value) } const handleSwitchChange = (event: React.ChangeEvent) => { setParticleDetection(!particleDetection) } + const handleClass3DSwitchChange = ( + event: React.ChangeEvent + ) => { + setRunClass3D(!runClass3D) + } const setFormElement = ( event: React.FormEvent, callback: (arg0: any) => void @@ -133,6 +139,7 @@ const SpaForm = (submissionCallback: (arg0: any) => void) => { From e051e68302c9e39c0abfd67fab643763e19d3ccc Mon Sep 17 00:00:00 2001 From: yxd92326 Date: Wed, 22 Oct 2025 10:34:24 +0100 Subject: [PATCH 3/4] Use the objects not the attributes --- src/components/forms.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/forms.tsx b/src/components/forms.tsx index d31e5aa..bbad4b3 100644 --- a/src/components/forms.tsx +++ b/src/components/forms.tsx @@ -62,11 +62,11 @@ const SpaForm = (submissionCallback: (arg0: any) => void) => { ? (formData.get('symmetry1') as string) : (((formData.get('symmetry1') as string) + formData.get('symmetry2')) as string) - formDataSPA.particle_diameter = formData.get('detect-particle-size') + formDataSPA.particle_diameter = particleDetection ? null : formData.get('particle-diameter') formDataSPA.eer_fractionation = formData.get('eer-grouping') - formDataSPA.run_class3d = formData.get('run-class3d') + formDataSPA.run_class3d = runClass3D callback(formDataSPA) } From 1144c4d902b787c36fefda02e0bac2f99e2b85b2 Mon Sep 17 00:00:00 2001 From: yxd92326 Date: Wed, 22 Oct 2025 11:14:02 +0100 Subject: [PATCH 4/4] Value is a string not a bool --- src/loaders/processingParameters.tsx | 5 +---- src/routes/SessionParameters.tsx | 3 +-- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/loaders/processingParameters.tsx b/src/loaders/processingParameters.tsx index 486609c..1ec25bb 100644 --- a/src/loaders/processingParameters.tsx +++ b/src/loaders/processingParameters.tsx @@ -39,10 +39,7 @@ export const updateSessionProcessingParameters = async ( dose_per_frame: params['dosePerFrame'] ?? null, eer_fractionation_file: params['eerFractionationFile'] ?? '', symmetry: params['symmetry'] ?? '', - run_class3d: - typeof params['run_class3d'] == 'boolean' - ? params['run_class3d'] - : null, + run_class3d: params['run_class3d'] ?? null, } ) if (response.status !== 200) { diff --git a/src/routes/SessionParameters.tsx b/src/routes/SessionParameters.tsx index aca4290..5837f78 100644 --- a/src/routes/SessionParameters.tsx +++ b/src/routes/SessionParameters.tsx @@ -79,7 +79,7 @@ export const SessionParameters = () => { Object.entries(sessionParams ? sessionParams : {}).forEach(([key, value]) => tableRows.push({ parameterName: nameLabelMap.get(key) ?? key, - parameterValue: value, + parameterValue: value.toString(), parameterKey: key, } as ProcessingRow) ) @@ -169,7 +169,6 @@ export const SessionParameters = () => { data={table.processingRows} headers={[ { key: 'parameterName', label: 'Parameter' }, - { key: 'parameterKey', label: 'Parameter internal name' }, { key: 'parameterValue', label: 'Value' }, ]} label={'sessionParameterData'}