LT-92: Adding validation to RecistApi
This commit is contained in:
1 parent
d1e0695a4b
commit
5605133517
7 files changed
+84
-25
No files matched your search
@@ -1,3 +1,2 @@
|
||||
import './measurements.js';
|
||||
import './recist.js';
|
||||
import './timepoints.js';
|
||||
@@ -326,6 +326,21 @@ class MeasurementApi {
|
||||
});
|
||||
}
|
||||
|
||||
getMeasurementById(measurementId) {
|
||||
let foundGroup;
|
||||
_.find(this.toolGroups, toolGroup => {
|
||||
foundGroup = toolGroup.findOne({ toolItemId: measurementId });
|
||||
return !!foundGroup;
|
||||
});
|
||||
|
||||
// Stop here if no group was found or if the record is a placeholder
|
||||
if (!foundGroup || !foundGroup.toolId) {
|
||||
return;
|
||||
}
|
||||
|
||||
return this.tools[foundGroup.toolId].findOne(measurementId);
|
||||
}
|
||||
|
||||
fetch(toolGroupId, selector, options) {
|
||||
if (!this.toolGroups[toolGroupId]) {
|
||||
throw 'MeasurementApi: No Collection with the id: ' + toolGroupId;
|
||||
@@ -336,7 +351,7 @@ class MeasurementApi {
|
||||
const result = [];
|
||||
const items = this.toolGroups[toolGroupId].find(selector, options).fetch();
|
||||
items.forEach(item => {
|
||||
if(item.toolId) {
|
||||
if (item.toolId) {
|
||||
result.push(this.tools[item.toolId].findOne(item.toolItemId));
|
||||
} else {
|
||||
result.push({ measurementNumber: item.measurementNumber });
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
import { OHIF } from 'meteor/ohif:core';
|
||||
|
||||
class RecistApi {
|
||||
|
||||
constructor(measurementApi) {
|
||||
if (measurementApi) {
|
||||
this.measurementApi = measurementApi;
|
||||
}
|
||||
this.warnings = {};
|
||||
}
|
||||
|
||||
validate() {
|
||||
|
||||
}
|
||||
|
||||
getModalities() {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
OHIF.measurements.RecistApi = RecistApi;
|
||||
@@ -0,0 +1 @@
|
||||
import './recist';
|
||||
@@ -0,0 +1,64 @@
|
||||
import { OHIF } from 'meteor/ohif:core';
|
||||
import { _ } from 'meteor/underscore';
|
||||
|
||||
class RecistApi {
|
||||
|
||||
constructor(measurementApi) {
|
||||
if (measurementApi) {
|
||||
this.measurementApi = measurementApi;
|
||||
}
|
||||
|
||||
this.warnings = {};
|
||||
}
|
||||
|
||||
validate() {
|
||||
const measurements = this.getMeasurements();
|
||||
|
||||
measurements.targets.forEach(measurement => {
|
||||
const image = this.getImageById(measurement.studyInstanceUid, measurement.imageId);
|
||||
console.warn('>>>>modality', image, image.modality);
|
||||
});
|
||||
}
|
||||
|
||||
getMeasurements() {
|
||||
const targets = this.measurementApi.fetch('targets');
|
||||
const nonTargets = this.measurementApi.fetch('nonTargets');
|
||||
return {
|
||||
targets,
|
||||
nonTargets
|
||||
};
|
||||
}
|
||||
|
||||
getModalities() {
|
||||
|
||||
}
|
||||
|
||||
getImageById(studyInstanceUid, imageId) {
|
||||
const study = ViewerStudies.findOne({ studyInstanceUid });
|
||||
|
||||
// Stop here if the study was not found
|
||||
if (!study) {
|
||||
return;
|
||||
}
|
||||
|
||||
let foundImage;
|
||||
_.each(study.displaySets, displaySet => {
|
||||
if (foundImage) {
|
||||
return;
|
||||
}
|
||||
|
||||
_.each(displaySet.images, image => {
|
||||
if (foundImage) {
|
||||
return;
|
||||
} else if (getImageId(image) === imageId) {
|
||||
foundImage = image;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
return foundImage;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
OHIF.measurements.RecistApi = RecistApi;
|
||||
@@ -1,3 +1,4 @@
|
||||
import './api';
|
||||
import './lib';
|
||||
import './helpers';
|
||||
import './components';
|
||||
Reference in new issue
Block a user