Skip to content
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

feat (pocus): new video classifier #487

Merged
merged 1 commit into from
Sep 25, 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
10 changes: 7 additions & 3 deletions src/adonisjs/public/author/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -449,9 +449,13 @@ <h6 style="color:#808080;">Created by {{author_grade}}: {{username}} ({{institut
<div id="case-artifacts"></div>
<div id="progress-artifacts"></div>
<div id="artifact-controls">
<input type="file" id="artifacts-select" name="artifacts-select" multiple="multiple"
accept="image/png, image/jpeg, image/svg+xml, audio/mpeg, video/mp4, video/webm, video/quicktime, video/x-msvideo">
<dcc-button xstyle="in" topic="generator/activate/artifact-knot" label="PLACE IN KNOTS"></dcc-button>
<input type="file" id="artifacts-select" name="artifacts-select" multiple="multiple"
accept="image/png, image/jpeg, image/svg+xml, audio/mpeg, video/mp4, video/webm, video/quicktime, video/x-msvideo">
<div class="form-check" style="background-color: lightgray; padding: 10px;">
<input type="checkbox" id="auto-classify" name="auto-classify">
<label for="auto-classify">Automatically Classify (may take time)</label>
</div>
<dcc-button xstyle="in" topic="generator/activate/artifact-knot" label="PLACE IN KNOTS"></dcc-button>
</div>
</div>
</div>
Expand Down
13 changes: 10 additions & 3 deletions src/adonisjs/public/author/js/artifacts.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ class Artifacts {
}

async _uploadArtifacts () {
this._artifactClass = {}
let files = document.querySelector('#artifacts-select').files
let progSpace = document.querySelector('#progress-artifacts')
const classify = document.querySelector('#auto-classify').checked
let a = 0
for (let f of files) {
let art = document.createElement('div')
Expand All @@ -39,11 +41,15 @@ class Artifacts {
{
file: f,
caseid: Basic.service.currentCaseId,
classify: (classify) ? 'true' : 'false',
progress: prMsg
}, null, true)
ref.innerHTML = '<a href="' + artifact.message.url + '" target="_blank">' +
f.name + '</a>'
const html = `<a href="${artifact.message.url}" target="_blank">${f.name}</a>`
ref.innerHTML = html

this._insertArtifactReference(artifact.message.filename, f.name)
if (artifact.message.classification != null)
this._artifactClass[artifact.message.filename] = artifact.message.classification
}
progSpace.innerHTML = ''
this.showArtifacts()
Expand Down Expand Up @@ -103,7 +109,8 @@ class Artifacts {
document.querySelector('#artifact-controls').style.display = 'none'
ArtifactKnotGenerator.activate(
compiled.artifacts, compiled.generators['artifact-knot'],
document.querySelector('#case-artifacts'))
document.querySelector('#case-artifacts'),
this._artifactClass)
}
}

Expand Down
1 change: 1 addition & 0 deletions src/adonisjs/public/author/js/dcc-author-server-proxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,7 @@ class DCCAuthorServer {
data.append('image', this.b64toBlob(message.b64))
}
data.append('caseId', message.caseid)
data.append('classify', message.classify)
const config = {
method: 'POST',
url: DCCCommonServer.managerAddressAPI + 'artifact',
Expand Down
22 changes: 18 additions & 4 deletions src/adonisjs/public/author/js/generator/artifact-knot.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
*/

class ArtifactKnotGenerator {
static activate (artifacts, candidates, html) {
static activate (artifacts, candidates, html, classification) {
if (ArtifactKnotGenerator.i == null)
ArtifactKnotGenerator.i = new ArtifactKnotGenerator()

ArtifactKnotGenerator.i.buildGenerator(artifacts, candidates, html)
ArtifactKnotGenerator.i.buildGenerator(artifacts, candidates, html, classification)
}

buildGenerator (artifacts, candidates, html) {
buildGenerator (artifacts, candidates, html, classification) {
MessageBus.i.publish('control/elements/wide')

this._prepareSubgroup = this._prepareSubgroup.bind(this)
Expand Down Expand Up @@ -42,7 +42,10 @@ class ArtifactKnotGenerator {
'<option value="_empty_" selected></option>'
for (let c in candidates)
artHTML += '<option value="' + c + '">' + candidates[c].description + '</option>'
artHTML += '</select></td>'
artHTML += '</select>'
if (classification[a] != null)
artHTML += `<p>suggestion: ${classification[a]} - ${ArtifactKnotGenerator._classDescription[classification[a]]}</p>`
artHTML += '</td>'
artHTML += '<td><select name="s_' + id + '" id="s_' + id + '">' +
'<option value="_empty_" selected></option></select></td></tr>'
}
Expand Down Expand Up @@ -139,3 +142,14 @@ class ArtifactKnotGenerator {
MessageBus.i.publish('generator/finished/artifact-knot')
}
}

ArtifactKnotGenerator._classDescription = {
'SX': 'Sub-xifóide ou Subcostal',
'PL': 'Para-esternal Longa',
'A4': 'Apical de 4 câmaras',
'PM': 'Paraesternal curta nível mitral',
'PV': 'Paraesternal curta nível V. aortica',
'PP': 'Paraesternal curta nível papilares',
'VI': 'Other',
'UN': 'Unidentified'
}
Loading