Skip to content

Code style improvements #40

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

Merged
merged 7 commits into from
Apr 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 3 additions & 4 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ if (navigator.hardwareConcurrency) {
maxWebWorkers = Math.min(navigator.hardwareConcurrency, 7)
}

var config = {
const config = {
maxWebWorkers,
startWebWorkersOnDemand: true,
taskConfiguration: {
Expand Down Expand Up @@ -281,7 +281,7 @@ export default defineComponent({
console.error('Error initalizing cornerstone core', e)
}
},
addWadouriPrefix(url: string) {
addWadouriPrefix(url: string): string {
return 'wadouri:' + url
},
async fetchVipMetadataInformation(imageId) {
Expand Down Expand Up @@ -419,7 +419,7 @@ export default defineComponent({
} else {
// image information from viewport have already been added
// storing elements in temp variable
var tempImageInformation = this.imageInformation
const tempImageInformation = this.imageInformation
// adding image information elements from viewport (tempImageInformation) in proper order
this.imageInformation = tempImageInformation
.slice(0, 1)
Expand Down Expand Up @@ -626,7 +626,6 @@ export default defineComponent({
},
setRotation(newRotation) {
this.currentImageRotation = newRotation
const { rotation } = this.viewport.getProperties()
this.viewport.setProperties({ rotation: this.currentImageRotation })
this.viewport.render()
},
Expand Down
2 changes: 1 addition & 1 deletion src/components/MetadataSidebarTableRow.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<tr class="dicom-metadata-section">
<th colspan="2">
<th colspan="2" scope="colgroup">
<p
class="oc-py-s oc-font-semibold dicom-metadata-section-title"
:class="isFirstSection ? 'dicom-metadata-first-section' : ''"
Expand Down
9 changes: 0 additions & 9 deletions src/helper/defaultPlugins.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//import DesignSystem from 'design-system'
import { createGettext } from 'vue3-gettext'
import { h } from 'vue'
import { abilitiesPlugin } from '@casl/vue'
Expand Down Expand Up @@ -51,14 +50,6 @@ export const defaultPlugins = ({
}
})

/*
TODO: check if this is needed, if so, try to fix import

if (designSystem) {
plugins.push(DesignSystem)
}
*/

if (gettext) {
plugins.push(createGettext({ translations: {}, silent: true }))
} else {
Expand Down
16 changes: 8 additions & 8 deletions src/helper/extractMetadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,28 +20,28 @@ export const findDicomTagByValue = (value: string): string | undefined => {
}

export const formatDateTagChecker = (tag: string): boolean => {
return tag.endsWith('_formatDate') ? true : false
return tag.endsWith('_formatDate')
}

export const formatTimeTagChecker = (tag: string): boolean => {
return tag.endsWith('_formatTime') ? true : false
return tag.endsWith('_formatTime')
}

export const addSopTagChecker = (tag: string): boolean => {
return tag.endsWith('_addSOPuids') ? true : false
return tag.endsWith('_addSOPuids')
}

export const extractDicomMetadata = async (imageData: object, tags: string[], language = 'en') => {
const extractedData: { label: string; value: string }[] = []

// extracting data
for (let i = 0; i < tags.length; ++i) {
for (const tag of tags) {
// check if tag contains an extension for date or time or SOP formatting
const isDate = formatDateTagChecker(tags[i])
const isTime = formatTimeTagChecker(tags[i])
const isSOP = addSopTagChecker(tags[i])
const isDate = formatDateTagChecker(tag)
const isTime = formatTimeTagChecker(tag)
const isSOP = addSopTagChecker(tag)

let metadataLabel = tags[i]
let metadataLabel = tag
if (isDate || isTime || isSOP) {
metadataLabel = metadataLabel.slice(0, -11) // cutting off the add-on (_formatDate or _formatTime or _addSOPuids) from the label
}
Expand Down