From ddd2f4f005374de3f04209c0fd18ae092faff786 Mon Sep 17 00:00:00 2001 From: Jake Wagoner Date: Tue, 16 Apr 2024 10:37:42 -0600 Subject: [PATCH 1/8] Update get_contents --- shapeworks_cloud/core/models.py | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/shapeworks_cloud/core/models.py b/shapeworks_cloud/core/models.py index de6d0532..214c0d24 100644 --- a/shapeworks_cloud/core/models.py +++ b/shapeworks_cloud/core/models.py @@ -25,6 +25,9 @@ def get_contents(self): def truncate_filename(filename): return filename.split('/')[-1] + def truncate_anatomy(anatomy_type): + return anatomy_type.replace('anatomy_', '') + group_list = [ Segmentation.objects.filter(subject__dataset=self), Mesh.objects.filter(subject__dataset=self), @@ -34,12 +37,20 @@ def truncate_filename(filename): for shape_group in group_list: for shape in shape_group: - ret.append( - { + anatomy = truncate_anatomy( + (shape.anatomy_type if hasattr(shape, 'anatomy_type') else shape.modality) + ) + if (shape.subject.name in [s['name'] for s in ret]): + subject = next((s for s in ret if s['name'] == shape.subject.name), None) + subject['shape_' + anatomy] = truncate_filename(shape.file.name) + else: + subject = { 'name': shape.subject.name, # type: ignore - 'shape_1': truncate_filename(shape.file.name), # type: ignore + 'shape_' + anatomy: truncate_filename(shape.file.name), # type: ignore } - ) + ret.append(subject) + + print(ret) return ret From 1f5d3cdf9aa711ab21ee21b3ce509abb6767ecd4 Mon Sep 17 00:00:00 2001 From: Jake Wagoner Date: Tue, 16 Apr 2024 11:42:17 -0600 Subject: [PATCH 2/8] Update groom fix --- shapeworks_cloud/core/models.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/shapeworks_cloud/core/models.py b/shapeworks_cloud/core/models.py index 214c0d24..fa6da621 100644 --- a/shapeworks_cloud/core/models.py +++ b/shapeworks_cloud/core/models.py @@ -37,12 +37,15 @@ def truncate_anatomy(anatomy_type): for shape_group in group_list: for shape in shape_group: - anatomy = truncate_anatomy( - (shape.anatomy_type if hasattr(shape, 'anatomy_type') else shape.modality) - ) + if hasattr(shape, 'anatomy_type'): + anatomy = truncate_anatomy(shape.anatomy_type) + label = 'shape_' + else: + anatomy = shape.modality + label = 'image_' if (shape.subject.name in [s['name'] for s in ret]): subject = next((s for s in ret if s['name'] == shape.subject.name), None) - subject['shape_' + anatomy] = truncate_filename(shape.file.name) + subject[label + anatomy] = truncate_filename(shape.file.name) else: subject = { 'name': shape.subject.name, # type: ignore @@ -50,7 +53,6 @@ def truncate_anatomy(anatomy_type): } ret.append(subject) - print(ret) return ret From 114f7ecf7ac141949b0d9d4dd6e386a9e0b101f9 Mon Sep 17 00:00:00 2001 From: Jake Wagoner Date: Tue, 16 Apr 2024 11:51:27 -0600 Subject: [PATCH 3/8] Client side read-only --- web/shapeworks/src/components/Analysis/PCA.vue | 5 +++-- web/shapeworks/src/components/DeepSSM/DeepSSMTab.vue | 3 ++- web/shapeworks/src/views/Main.vue | 9 ++++++++- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/web/shapeworks/src/components/Analysis/PCA.vue b/web/shapeworks/src/components/Analysis/PCA.vue index 0fa62aec..e7901be7 100644 --- a/web/shapeworks/src/components/Analysis/PCA.vue +++ b/web/shapeworks/src/components/Analysis/PCA.vue @@ -192,7 +192,8 @@ import { groupBy } from '../../helper'; pcaInfo, animate, menu, - showConfirmation + showConfirmation, + selectedProject, }; }, }; @@ -230,7 +231,7 @@ import { groupBy } from '../../helper'; bottom right > -