Skip to content

Commit

Permalink
feat(SEG): convert a loaded image to labelmap/segmentGroup
Browse files Browse the repository at this point in the history
  • Loading branch information
jadh4v committed Nov 30, 2023
1 parent 86981a1 commit 193206a
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/components/ImageDataBrowser.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import ItemGroup from '@/src/components/ItemGroup.vue';
import GroupableItem from '@/src/components/GroupableItem.vue';
import ImageListCard from '@/src/components/ImageListCard.vue';
import { createVTKImageThumbnailer } from '@/src/core/thumbnailers/vtk-image';
import { useSegmentGroupStore } from '@/src/store/segmentGroups';
import { useImageStore } from '../store/datasets-images';
import { useDICOMStore } from '../store/datasets-dicom';
import {
Expand All @@ -30,6 +31,7 @@ export default defineComponent({
const dicomStore = useDICOMStore();
const dataStore = useDatasetStore();
const layersStore = useLayersStore();
const segmentGroupStore = useSegmentGroupStore();
const primarySelection = computed(() => dataStore.primarySelection);
Expand Down Expand Up @@ -132,6 +134,15 @@ export default defineComponent({
selected.value = [];
}
function convertToLabelMap(key: string) {
if (primarySelection.value) {
segmentGroupStore.convertImageToLabelmap(
{ type: 'image', dataID: key },
primarySelection.value
);
}
}
function removeData(id: string) {
imageStore.deleteData(id);
}
Expand All @@ -143,6 +154,7 @@ export default defineComponent({
toggleSelectAll,
removeSelection,
removeData,
convertToLabelMap,
images,
thumbnails,
primarySelection,
Expand Down Expand Up @@ -244,6 +256,9 @@ export default defineComponent({
<span v-else>Add as layer</span>
</template>
</v-list-item>
<v-list-item @click="convertToLabelMap(image.id)">
Convert to LabelMap
</v-list-item>
<v-list-item @click="removeData(image.id)">
Delete
</v-list-item>
Expand Down
16 changes: 16 additions & 0 deletions src/components/PatientStudyVolumeBrowser.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { computed, defineComponent, reactive, toRefs, watch } from 'vue';
import { Image } from 'itk-wasm';
import type { PropType } from 'vue';
import GroupableItem from '@/src/components/GroupableItem.vue';
import { useSegmentGroupStore } from '@/src/store/segmentGroups';
import { getDisplayName, useDICOMStore } from '../store/datasets-dicom';
import {
DataSelection,
Expand Down Expand Up @@ -74,6 +75,7 @@ export default defineComponent({
const dicomStore = useDICOMStore();
const datasetStore = useDatasetStore();
const layersStore = useLayersStore();
const segmentGroupStore = useSegmentGroupStore();
const volumes = computed(() => {
const { volumeInfo } = dicomStore;
Expand Down Expand Up @@ -166,6 +168,16 @@ export default defineComponent({
const { selected, selectedAll, selectedSome, toggleSelectAll } =
useMultiSelection(volumeKeys);
const convertToLabelMap = (key: string) => {
const { primarySelection } = datasetStore;
if (primarySelection) {
segmentGroupStore.convertImageToLabelmap(
{ type: 'dicom', volumeKey: key },
primarySelection
);
}
};
const removeData = (key: string) => {
dicomStore.deleteVolume(key);
};
Expand All @@ -185,6 +197,7 @@ export default defineComponent({
toggleSelectAll,
thumbnailCache,
volumes,
convertToLabelMap,
removeData,
removeSelectedDICOMVolumes,
};
Expand Down Expand Up @@ -308,6 +321,9 @@ export default defineComponent({
<span v-else>Add as layer</span>
</template>
</v-list-item>
<v-list-item @click="convertToLabelMap(volume.key)">
Convert to LabelMap
</v-list-item>
<v-list-item @click="removeData(volume.key)">
Delete
</v-list-item>
Expand Down

0 comments on commit 193206a

Please sign in to comment.