From 883bdab581392dee8a385749c32aae2c3694d4ea Mon Sep 17 00:00:00 2001 From: Jake Wagoner Date: Wed, 26 Jun 2024 12:32:00 -0600 Subject: [PATCH] Add image viewer toggle --- web/shapeworks/src/components/DataList.vue | 23 ++++++++++++++----- .../src/components/RenderControls.vue | 22 +++++++++++++++++- web/shapeworks/src/store/index.ts | 4 +++- 3 files changed, 41 insertions(+), 8 deletions(-) diff --git a/web/shapeworks/src/components/DataList.vue b/web/shapeworks/src/components/DataList.vue index cb32888a..8d470f2f 100644 --- a/web/shapeworks/src/components/DataList.vue +++ b/web/shapeworks/src/components/DataList.vue @@ -9,9 +9,11 @@ import { allSubjectsForDataset, allDataObjectsInDataset, anatomies, + selectedAnatomies, selectedDataObjects, loadingState, loadReconstructedSamplesForProject, +imageViewMode, } from '@/store'; @@ -31,8 +33,6 @@ export default { } }, setup(props) { - - const selectedAnatomies = ref([]); const selectedSubjects = ref([]) const headers = [ {text: 'ID', value: 'id'}, @@ -60,7 +60,10 @@ export default { )).flat() loadReconstructedSamplesForProject('', 0) anatomies.value = Object.keys( - groupBy(allDataObjectsInDataset.value, 'anatomy_type') + { + ...groupBy(allDataObjectsInDataset.value, 'anatomy_type'), + ...groupBy(allDataObjectsInDataset.value, 'modality'), + } ).filter((key) => key !== 'undefined') selectedAnatomies.value = anatomies.value; if(allSubjectsForDataset.value.length > 0) { @@ -83,7 +86,8 @@ export default { return ( ( !selectedAnatomies.value.length || - selectedAnatomies.value.includes(dataObject.anatomy_type) + selectedAnatomies.value.includes(dataObject.anatomy_type) || + selectedAnatomies.value.includes(dataObject.modality) ) && selectedSubjects.value.includes(dataObject.subject) ) } @@ -91,7 +95,13 @@ export default { } function selectedObjectsUpdated() { - const uniqueAnatomies = [...new Set(selectedDataObjects.value.map(item => item.anatomy_type))] + const uniqueAnatomies = [...new Set(selectedDataObjects.value.map(item => { + // if the item is an image, it will have "modality" instead of anatomy_type + if (item.modality && imageViewMode.value) { + return item.modality + } + return item.anatomy_type + }))].filter((anatomy) => anatomy !== undefined); const uniqueSubjects = [...new Set(selectedDataObjects.value.map(item => item.subject))] if (JSON.stringify(uniqueAnatomies) !== JSON.stringify(selectedAnatomies.value)) { selectedAnatomies.value = uniqueAnatomies @@ -133,8 +143,9 @@ export default { ANATOMIES + include 'anatomy_mri', False -> exclude 'anatomy_mri' + if (value) { + selectedAnatomies.value = [...selectedAnatomies.value, 'anatomy_mri'] + } else { + const modality = allDataObjectsInDataset.value[0].modality + selectedAnatomies.value = selectedAnatomies.value.filter((anatomy) => anatomy !== modality) + } + } + function changeAxisSystem(newSystemValue: string){ const newSystem = axisSystemOptions.find( (system) => system.value == newSystemValue @@ -272,6 +285,7 @@ export default { imageViewWindowRange, changeImageViewSlice, changeAxisSystem, + changeImageViewMode, resetView, selectedDataObjects, captureThumbnail, @@ -331,7 +345,13 @@ export default { :items="axisSystemOptions" @change="changeAxisSystem" label="Axis System" - style="width: 150px" + style="width: 100px" + /> + ([]) export const anatomies = ref([]); -export const selectedDataObjects = ref([]) +export const selectedAnatomies = ref([]); + +export const selectedDataObjects = ref([]); export const orientationIndicator = ref(vtkAnnotatedCubeActor.newInstance())