Skip to content

Demo images on flatmap [Updated] #178

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 40 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
3a7ade4
Add view images area in popup
akhuoa Apr 8, 2024
7154d79
Add sample image viewer
akhuoa Apr 9, 2024
c6c5b61
Create demo for images on flatmap
Tehsurfer Apr 11, 2024
ac7d0e1
Add file to make requests for all images from scicrunch
Tehsurfer Apr 26, 2024
fbbd5c9
Add markers for the images to the flatmap
Tehsurfer May 2, 2024
97caa8c
Fix issue with out of date gallery
Tehsurfer May 3, 2024
6398728
Now able to pass thumbnails from biolucida
Tehsurfer May 3, 2024
b8f75c3
Now can view images in the gallery from flatmap
Tehsurfer May 9, 2024
c686807
Add tags to filter on species
Tehsurfer May 21, 2024
084f50d
Update dependencies
akhuoa Jul 10, 2024
4eaaf72
Merge branch 'main' into feature/images-on-flatmap-updated
akhuoa Jul 11, 2024
f9d576f
Add missing variable from commit b8f75c3
akhuoa Jul 11, 2024
ab52200
Move tooltip and other popups to map-utilities package
akhuoa Jul 11, 2024
33d9e33
Sync package-lock.json with main
akhuoa Jul 11, 2024
aeb9c18
Split some flatmap mixins into map-utilities
akhuoa Jul 11, 2024
109a604
Update to beta version of map-utilities package
akhuoa Jul 18, 2024
8b64198
Fix getting images from scicrunch response error
akhuoa Jul 18, 2024
e49e39a
Move API to env
akhuoa Jul 19, 2024
dbc1347
Merge remote-tracking branch 'aung/feature/images-on-flatmap-updated'…
alan-wu Aug 7, 2024
16925d7
Fixed some issues found in the implementation.
alan-wu Aug 8, 2024
8bd134f
Merge pull request #11 from alan-wu/feature/images-on-flatmap-updated
akhuoa Aug 8, 2024
3733a0b
Merge branch 'feature/images-on-flatmap-updated' of github.com:akhuoa…
akhuoa Aug 8, 2024
0a47d66
Move flatmap api endpoint to env file
akhuoa Aug 8, 2024
a818e41
Updatte variable name
akhuoa Aug 8, 2024
2b287b1
Update vite env variables
akhuoa Aug 12, 2024
586bd61
Commit current changes.
alan-wu Aug 15, 2024
0fa9432
Get initial image loading going.
alan-wu Aug 19, 2024
bf60498
Removed unused codes.
alan-wu Aug 19, 2024
1d35c5a
Supports biolucida images.
alan-wu Aug 20, 2024
8c09a05
Merge branch 'feature/images-on-flatmap-updated' of github.com:alan-w…
akhuoa Aug 21, 2024
f03844e
Merge branch 'main' into feature/images-on-flatmap-updated
akhuoa Aug 21, 2024
cc9d528
Update map utilities version
akhuoa Aug 21, 2024
5f8df55
Merge branch 'main' into feature/images-on-flatmap-updated
akhuoa Aug 22, 2024
ec43dc4
Move flatmapAPI to env
akhuoa Aug 22, 2024
7d8d3e4
Remove unused codes
akhuoa Aug 22, 2024
0975833
Remove unused codes
akhuoa Aug 22, 2024
698d58c
Remove unnused codes
akhuoa Aug 22, 2024
e5e87db
Emit show flatmap images with images data
akhuoa Aug 27, 2024
accde23
Merge branch 'ABI-Software:main' into feature/images-on-flatmap-updated
akhuoa Sep 2, 2024
504c195
Merge branch 'feature/images-on-flatmap-updated' of github.com:akhuoa…
akhuoa Sep 2, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ docs/.vitepress/cache
docs/components
.DS_Store
/.vitepress
.env
.env.local
56 changes: 45 additions & 11 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
},
"dependencies": {
"@abi-software/flatmap-viewer": "3.1.4",
"@abi-software/map-utilities": "1.1.0",
"@abi-software/map-utilities": "^1.1.1-beta.0",
"@abi-software/sparc-annotation": "0.3.1",
"@abi-software/svg-sprite": "1.0.0",
"@element-plus/icons-vue": "^2.3.1",
Expand Down
8 changes: 6 additions & 2 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
:displayMinimap="true"
:enableOpenMapUI="true"
:flatmapAPI="flatmapAPI"
:sparcAPI="sparcAPI"
:disableUI="disableUI"
@open-pubmed-url="onOpenPubmedUrl"
@pathway-selection-changed="onPathwaySelectionChanged"
Expand Down Expand Up @@ -145,6 +146,7 @@ export default {
if (this.consoleOn) console.log(component)
let taxon = component.mapImp.describes
let id = component.mapImp.addMarker('UBERON:0000948')

window.flatmapImp = component.mapImp
component.enablePanZoomEvents(true)
//component.showPathwaysDrawer(false);
Expand Down Expand Up @@ -285,14 +287,16 @@ export default {
useHelpModeDialog: true,
multiflatmapRef: null,
mapSettings: [],
sparcAPI: import.meta.env.VITE_SPARC_API,
flatmapAPI: import.meta.env.VITE_FLATMAP_API,
//flatmapAPI: "https://mapcore-demo.org/current/flatmap/v2/"
//flatmapAPI: "https://mapcore-demo.org/devel/flatmap/v3/"
flatmapAPI: "https://mapcore-demo.org/current/flatmap/v3/",
//flatmapAPI: "https://mapcore-demo.org/current/flatmap/v3/",
//flatmapAPI: 'https://mapcore-demo.org/devel/flatmap/v4/',
//flatmapAPI: 'https://mapcore-demo.org/curation/flatmap/',
//flatmapAPI: "https://mapcore-demo.org/fccb/flatmap/"
//flatmapAPI: "https://mapcore-demo.org/staging/flatmap/v1/"
// flatmapAPI: "https://mapcore-demo.org/devel/flatmap/v1/",
//flatmapAPI: "https://mapcore-demo.org/devel/flatmap/v1/",
ElIconSetting: shallowRef(ElIconSetting)
}
},
Expand Down
111 changes: 106 additions & 5 deletions src/components/FlatmapVuer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,30 @@ Please use `const` to assign meaningful names to them...
{{ viewingModes[viewingMode] }}
</el-row>
</el-row>
<template v-if="viewingMode === 'Exploration' && !isFC">
<el-row class="backgroundText">Images Display</el-row>
<el-row class="backgroundControl">
<el-select
:teleported="false"
v-model="imageType"
placeholder="Select"
class="select-box"
popper-class="flatmap_dropdown"
@change="setImageType"
>
<el-option
v-for="item in imageTypes"
:key="item"
:label="item"
:value="item"
>
<el-row>
<el-col :span="12">{{ item }}</el-col>
</el-row>
</el-option>
</el-select>
</el-row>
</template>
<template v-if="viewingMode === 'Annotation' && userInformation">
<el-row class="backgroundText">Drawn By*</el-row>
<el-row class="backgroundControl">
Expand Down Expand Up @@ -604,9 +628,17 @@ Please use `const` to assign meaningful names to them...
v-show="tooltipDisplay"
:annotationEntry="annotationEntry"
:tooltipEntry="tooltipEntry"
:tooltipType="tooltipType"
:galleryItems="galleryItems"
:annotationDisplay="viewingMode === 'Annotation'"
@viewImage="viewIframeImage"
@annotation="commitAnnotationEvent"
/>
<IframeImageDialog
:imageIframeURL="imageIframeURL"
:imageIframeOpen="imageIframeOpen"
@closeImageIframe="closeImageIframe"
/>
</div>
</div>
</template>
Expand Down Expand Up @@ -639,13 +671,15 @@ import {
FlatmapQueries,
findTaxonomyLabel,
} from '../services/flatmapQueries.js'
import scicrunchMixin from '../services/scicrunchMixin.js'
import flatmapImageMixin from '../mixins/flatmapImageMixin.js'
import yellowstar from '../icons/yellowstar'
import ResizeSensor from 'css-element-queries/src/ResizeSensor'
import * as flatmap from '@abi-software/flatmap-viewer'
import { AnnotationService } from '@abi-software/sparc-annotation'
import { mapState } from 'pinia'
import { useMainStore } from '@/store/index'
import { DrawToolbar, Tooltip, TreeControls } from '@abi-software/map-utilities'
import { DrawToolbar, Tooltip, TreeControls, IframeImageDialog } from '@abi-software/map-utilities'
import '@abi-software/map-utilities/dist/style.css'

const centroid = (geometry) => {
Expand Down Expand Up @@ -735,6 +769,7 @@ const createUnfilledTooltipData = function () {
*/
export default {
name: 'FlatmapVuer',
mixins: [scicrunchMixin, flatmapImageMixin],
components: {
Button,
Col,
Expand All @@ -754,7 +789,8 @@ export default {
ElIconWarningFilled,
ElIconArrowDown,
ElIconArrowLeft,
DrawToolbar
DrawToolbar,
IframeImageDialog
},
beforeCreate: function () {
//The state watcher may triggered before
Expand Down Expand Up @@ -1669,7 +1705,12 @@ export default {
}
if (
data &&
data.type !== 'marker' &&
(
data.type !== 'marker' ||
(
data.type === 'marker' && (this.imageType === 'Segmentations' || this.imageType === 'Images')
)
) &&
eventType === 'click' &&
!(this.viewingMode === 'Neuron Connection') &&
// Disable popup when drawing
Expand Down Expand Up @@ -1703,13 +1744,25 @@ export default {
* @arg data
*/
checkAndCreatePopups: async function (data) {
console.log("checkandcreate")
if (data.feature.type === 'marker') {
this.tooltipType = 'image-gallery'
console.log('marker data', data)
console.log('saved images', this.images)
let filteredImages = this.findImagesForAnatomy(this.images, data.resource[0])
console.log('filtered images:',filteredImages)
this.galleryItems = filteredImages
this.displayTooltip(data.feature.models)
} else {

// Call flatmap database to get the connection data
if (this.viewingMode === 'Annotation') {
if (data.feature) {
this.annotationEntry = {
...data.feature,
resourceId: this.serverURL,
}
this.tooltipType = 'annotation'
if (data.feature.featureId && data.feature.models) {
this.displayTooltip(data.feature.models)
} else if (data.feature.feature) {
Expand Down Expand Up @@ -1743,9 +1796,11 @@ export default {
results[1] ||
(data.feature.hyperlinks && data.feature.hyperlinks.length > 0)
) {
this.tooltipType = 'provenance'
this.resourceForTooltip = data.resource[0]
data.resourceForTooltip = this.resourceForTooltip
this.createTooltipFromNeuronCuration(data)
}
}
}
},
Expand Down Expand Up @@ -2001,6 +2056,23 @@ export default {
}
this.$emit('connectivity-info-open', this.tooltipEntry);
}

// Images on Flatmap
if (this.imageType === 'Segmentations' || this.imageType === 'Images') {
// Images in Sidebar
if (this.connectivityInfoSidebar && this.viewingMode !== 'Annotation') {
this.$emit('show-flatmap-images', this.galleryItems);
}
// Images in popup
else {
this.tooltipDisplay = true;
this.$nextTick(() => {
this.mapImp.showPopup(featureId, this.$refs.tooltip.$el, options);
this.popUpCssHacks();
});
}
}

// If UI is not disabled,
// And connectivityInfoSidebar is not set (default) or set to `false`
// Provenance popup will be shown on map
Expand Down Expand Up @@ -2334,9 +2406,9 @@ export default {
this.addResizeButtonToMinimap()
this.loading = false
this.computePathControlsMaximumHeight()
this.drawerOpen = !this.isCentreLine
this.drawerOpen = !this.isCentreLine
this.mapResize()
this.handleMapClick();
this.handleMapClick()
/**
* This is ``onFlatmapReady`` event.
* @arg ``this`` (Component Vue Instance)
Expand Down Expand Up @@ -2431,6 +2503,29 @@ export default {
if (this.mapImp) return this.mapImp.search(term)
return []
},
viewIframeImage: function (url) {
this.imageIframeURL = url
this.imageIframeOpen = true
},
closeImageIframe: function () {
this.imageIframeURL = ''
this.imageIframeOpen = false
},
setImageType: async function (type) {
if (this.mapImp) {
this.mapImp.clearMarkers()
const anatomicalIdentifiers = this.mapImp.anatomicalIdentifiers
if (type === "Segmentations") {
let images = await this.getSegmentationsThumbnails("id", anatomicalIdentifiers)
this.images = images
this.populateFlatmapWithImages(this.mapImp, images, type)
} else if (type === "Images") {
let images = await this.getBiolucidaThumbnails("id", anatomicalIdentifiers)
this.images = images
this.populateFlatmapWithImages(this.mapImp, images, type)
}
}
},
},
props: {
/**
Expand Down Expand Up @@ -2639,6 +2734,10 @@ export default {
serverURL: undefined,
layers: [],
pathways: [],
imageIframeOpen: false,
imageIframeURL: '',
galleryItems: [],
tooltipType: 'provenance',
sckanDisplay: [
{
label: 'Display Path with SCKAN',
Expand Down Expand Up @@ -2704,6 +2803,8 @@ export default {
},
drawnType: 'All tools',
drawnTypes: ['All tools', 'Point', 'LineString', 'Polygon', 'None'],
imageType: 'None',
imageTypes: ['Segmentations', 'Images', 'None'],
annotatedType: 'Anyone',
annotatedTypes: ['Anyone', 'Me', 'Others'],
openMapRef: undefined,
Expand Down
Loading
Loading