Skip to content

Commit

Permalink
Fix an issue with neurolucida 360.
Browse files Browse the repository at this point in the history
  • Loading branch information
alan-wu committed Mar 19, 2024
1 parent ffb34b6 commit b279bec
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 18 deletions.
34 changes: 32 additions & 2 deletions components/BiolucidaViewer/BiolucidaViewer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,43 @@ export default {
default: () => {}
},
},
data() {
return {
webNeurolucidaLink: '',
}
},
async fetch() {
try {
const image_identifier = this.data.biolucida_image_id
const [
view_info,
image_info,
] = await Promise.all([
biolucida.decodeViewParameter(this.viewId),
biolucida.getImageInfo(image_identifier),
])
const BASE_URL = `blv:${process.env.BL_SERVER_URL}`
const queryParameters = `image_id=${image_identifier}&type=${view_info[1]}${view_info[2]}&filename=${image_info.name}`
const webNeurolucidaLink = BASE_URL + '/image_view?' + queryParameters
this.webNeurolucidaLink = webNeurolucidaLink
} catch (e) {
console.log(e)
}
},
mounted() {
window.addEventListener('message', this.receiveMessage)
},
beforeDestroy() {
window.removeEventListener('message', this.receiveMessage)
},
computed: {
viewId() {
return this.data.share_link.replace(
process.env.BL_SHARE_LINK_PREFIX,
''
)
},
},
methods: {
launchViewer() {
window.open(this.data.blv_link, '_blank')
Expand All @@ -102,7 +132,7 @@ export default {
.fetchNeurolucida360Url({
applicationRequest: 'NL360',
userID: 'SPARCPortal',
sessionContext: this.data.web_neurolucida_link
sessionContext: this.webNeurolucidaLink
})
.then(response => {
if (response.data.url) {
Expand Down
16 changes: 0 additions & 16 deletions components/ViewersMetadata/BiolucidaViewerMetadata.vue
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ export default {
share_link: '',
status: '',
location: '',
web_neurolucida_link: ''
}
}
},
Expand All @@ -119,9 +118,6 @@ export default {
data() {
return {
data_collection: '',
blv_link: '',
web_neurolucida_link: '',
image_info: '',
xmp_metadata: '',
}
},
Expand All @@ -130,29 +126,17 @@ export default {
try {
const image_identifier = this.biolucidaData.biolucida_image_id
const [
blv_info,
view_info,
image_info,
xmp_metadata,
readme_markdown
] = await Promise.all([
biolucida.getBLVLink(image_identifier),
biolucida.decodeViewParameter(this.viewId),
biolucida.getImageInfo(image_identifier),
biolucida.getXMPInfo(image_identifier),
fetch(this.datasetInfo.readme).then((response) => {
return response.text()
})
])
const BASE_URL = `blv:${process.env.BL_SERVER_URL}`
const queryParameters = `image_id=${image_identifier}&type=${view_info[1]}${view_info[2]}&filename=${image_info.name}`
const webNeurolucidaLink = BASE_URL + '/image_view?' + queryParameters
const html = this.parseMarkdown(readme_markdown)
this.data_collection = extractSection(/data collect[^:]+:/i, html)
this.blv_link = blv_info['link']
this.web_neurolucida_link = webNeurolucidaLink
this.image_info = image_info
this.xmp_metadata = xmp_metadata
} catch (e) {
console.log(e)
Expand Down

0 comments on commit b279bec

Please sign in to comment.