Skip to content

Commit

Permalink
Correct VolumeAnnotation story
Browse files Browse the repository at this point in the history
  • Loading branch information
denishov committed Jul 6, 2024
1 parent b765642 commit a030591
Showing 1 changed file with 11 additions and 43 deletions.
54 changes: 11 additions & 43 deletions src/components/project/VolumeAnnotations.stories.js
Original file line number Diff line number Diff line change
@@ -1,71 +1,39 @@
import { action } from '@storybook/addon-actions';
import { get, forEach } from 'lodash-es';

import brainboxProject from '@/components/project/TextAnnotations.brainbox.fixtures.json';
import microdrawFiles from '@/components/project/TextAnnotations.microdraw.fixtures.json';
import TextAnnotations from '@/components/project/TextAnnotations.vue';
import VolumeAnnotations from '@/components/project/VolumeAnnotations.vue';


export default {
title: 'Project/VolumeAnnotations',
component: TextAnnotations
component: VolumeAnnotations
};

const Template = (args) => ({
components: { TextAnnotations },
components: { VolumeAnnotations },
setup () {
return {
...args
};
},
template: `
<TextAnnotations
projectName="bcprimates3"
:extractKeys="extractKeys"
currentFileID="624eafaa6c930bb4648d0550"
@value-change="valueChange"
@select-file="selectFile"
:files="files" />
<VolumeAnnotations
:extract-keys="extractKeys"
:annotations="volumeAnnotations"
@select-annotation="selectVolumeAnnotation" />
`
});

export const Brainbox = Template.bind({});
export const Microdraw = Template.bind({});

const defaultArgs = {
valueChange: action('value changed'),
selectFile: action('file selected')
};

Brainbox.args = {
...defaultArgs,
extractKeys: (files) => {
const keys = new Map();
keys.set('Name', 'name');
keys.set('File', 'source');
files.forEach((file) => {
const annotations = get(file, ['mri', 'annotations', brainboxProject]);
if (annotations == null) { return; }
forEach(annotations, (_value, key) => {
keys.set(key, ['mri', 'annotations', brainboxProject, key, 'data']);
});
});

return keys;
},

files: brainboxProject.files.list
};

Microdraw.args = {
...defaultArgs,
extractKeys: () => {
const keys = new Map();
keys.set('Name', 'name');
keys.set('File', 'source');
keys.set('Labels sets', 'labels');

return keys;
},

files: microdrawFiles
};
selectVolumeAnnotation: action('select annotation'),
volumeAnnotations: brainboxProject.files.list[0].mri.atlas
};

0 comments on commit a030591

Please sign in to comment.