Skip to content

Commit

Permalink
check annotation stsatus if annotation exist and added findMarks into…
Browse files Browse the repository at this point in the history
… Store
  • Loading branch information
nanli-emory committed Apr 8, 2024
1 parent afcdf56 commit 2451332
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 10 deletions.
43 changes: 33 additions & 10 deletions apps/dicom-connect/table.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,11 @@ function initialize() {
const modality = row['00080060']['Value'][0]
if (row.status !='done') return seriesId;
const slideId = row.slideId;
if (modality=='SM') return `<a href="../viewer/viewer.html?slideId=${slideId}">${seriesId}</a>`
//if (modality=='SM')
return `<a href="../viewer/viewer.html?slideId=${slideId}">${seriesId}</a>`


return `<a href="../dicom-connect/table.html?status=instances&source=${row.source}&studyId=${params.studyId}&seriesId=${seriesId}">${seriesId}</a>`;
// return `<a href="../dicom-connect/table.html?status=instances&source=${row.source}&studyId=${params.studyId}&seriesId=${seriesId}">${seriesId}</a>`;
}
function generateStatus (data, type, row) {
switch (row.status) {
Expand Down Expand Up @@ -229,17 +230,39 @@ function initialize() {
}
// ('dicomSource', 'study', 'series', 'instance'
const slides = await store.findSlide(null, null, params.studyId, null, query)
const annotationQuery = {
'provenance.image.dicom-source-url':src.url,
'provenance.image.dicom-study': params.studyId // study

}
const annotations = await store.findMarks(annotationQuery)
// update series data
datatable.data().each(function (d) {
d['0020000E']['Value'][0]
const idx = slides.findIndex(slide=>d['0020000E']['Value'][0]==slide.series)

if (idx!=-1) {
d.status = slides[idx].status
d.slideId = slides[idx]._id.$oid
} else {
d.status = 'unsync'
const modality = d['00080060']['Value'][0]
const series = d['0020000E']['Value'][0]

if (modality == 'SM'){
// match slide
const idx = slides.findIndex(slide=>series==slide.series)

if (idx!=-1) {
d.status = slides[idx].status
d.slideId = slides[idx]._id.$oid
} else {
d.status = 'unsync'
}
}
if (modality == 'ANN'){
// match annotations
const idx_annot = annotations.findIndex(annot=>annot.provenance.image['dicom-series']&&series==annot.provenance.image['dicom-series'])
if (idx_annot!=-1) {
d.status = 'done';
d.slideId = annotations[idx_annot].provenance.image.slide;
} else {
d.status = 'unsync';
}
}

});

// invalidate all rows and redraw
Expand Down
38 changes: 38 additions & 0 deletions core/Store.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,44 @@ class Store {
mode: 'cors',
});
}
findMarks(q) {
const suffix = 'Mark/find';
const url = this.base + suffix;
var query = {};
if (q) {
query = q;
}
return fetch(url + '?' + objToParamStr(query), {
credentials: 'include',
mode: 'cors',
}).then(this.errorHandler).then((x) => this.filterBroken(x, 'mark'));
}

findSlide(name, specimen, study, location, q) {
let query = {};
const suffix = 'Slide/find';
const url = this.base + suffix;
if (q) {
query = q;
} else {
if (name) {
query.name = name;
}
if (study) {
query.study = study;
}
if (specimen) {
query.specimen = specimen;
}
if (location) {
query.location = location;
}
}
return fetch(url + '?' + objToParamStr(query), {
credentials: 'include',
mode: 'cors',
}).then(this.errorHandler);
}

Check failure on line 195 in core/Store.js

View workflow job for this annotation

GitHub Actions / build (16.x)

Trailing spaces not allowed

Check failure on line 195 in core/Store.js

View workflow job for this annotation

GitHub Actions / build (18.x)

Trailing spaces not allowed
/**
* find marks matching slide and/or marktype
* will search by slide field as exactly given and by the oid slide of that name
Expand Down

0 comments on commit 2451332

Please sign in to comment.