-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
11 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
}; |