Adding Nadir method on timepointApi
This commit is contained in:
parent
bde625a961
commit
c580f2db72
@ -130,9 +130,7 @@ class TimepointApi {
|
|||||||
|
|
||||||
// Return only the current timepoint
|
// Return only the current timepoint
|
||||||
current() {
|
current() {
|
||||||
return this.timepoints.findOne({
|
return this.timepoints.findOne({ timepointId: this.currentTimepointId });
|
||||||
timepointId: this.currentTimepointId
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
lock() {
|
lock() {
|
||||||
@ -157,13 +155,9 @@ class TimepointApi {
|
|||||||
|
|
||||||
const latestDate = current.latestDate;
|
const latestDate = current.latestDate;
|
||||||
return this.timepoints.findOne({
|
return this.timepoints.findOne({
|
||||||
latestDate: {
|
latestDate: { $lt: latestDate }
|
||||||
$lt: latestDate
|
|
||||||
}
|
|
||||||
}, {
|
}, {
|
||||||
sort: {
|
sort: { latestDate: -1 }
|
||||||
latestDate: -1
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -186,9 +180,13 @@ class TimepointApi {
|
|||||||
|
|
||||||
// Return only the baseline timepoint
|
// Return only the baseline timepoint
|
||||||
baseline() {
|
baseline() {
|
||||||
return this.timepoints.findOne({
|
return this.timepoints.findOne({ timepointType: 'baseline' });
|
||||||
timepointType: 'baseline'
|
}
|
||||||
});
|
|
||||||
|
// Return only the nadir timepoint
|
||||||
|
nadir() {
|
||||||
|
const timepoint = this.timepoints.findOne({ timepointKey: 'nadir' });
|
||||||
|
return timepoint || this.baseline();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return only the key timepoints (current, prior, nadir and baseline)
|
// Return only the key timepoints (current, prior, nadir and baseline)
|
||||||
|
|||||||
@ -0,0 +1,28 @@
|
|||||||
|
import { OHIF } from 'meteor/ohif:core';
|
||||||
|
|
||||||
|
OHIF.measurements.findAndRenderDisplaySet = (displaySets, viewportIndex, studyInstanceUid, seriesInstanceUid, sopInstanceUid, renderedCallback) => {
|
||||||
|
// Find the proper stack to display
|
||||||
|
const stacksFromSeries = displaySets.filter(stack => stack.seriesInstanceUid === seriesInstanceUid);
|
||||||
|
const stack = stacksFromSeries.find(stack => {
|
||||||
|
const imageIndex = stack.images.findIndex(image => image.getSOPInstanceUID() === sopInstanceUid);
|
||||||
|
return imageIndex > -1;
|
||||||
|
});
|
||||||
|
|
||||||
|
// TODO: make this work for multi-frame instances
|
||||||
|
const specificImageIndex = stack.images.findIndex(image => image.getSOPInstanceUID() === sopInstanceUid);
|
||||||
|
|
||||||
|
const displaySetData = {
|
||||||
|
studyInstanceUid: studyInstanceUid,
|
||||||
|
seriesInstanceUid: seriesInstanceUid,
|
||||||
|
sopInstanceUid: sopInstanceUid,
|
||||||
|
displaySetInstanceUid: stack.displaySetInstanceUid,
|
||||||
|
currentImageIdIndex: specificImageIndex
|
||||||
|
};
|
||||||
|
|
||||||
|
// Add a renderedCallback to activate the measurements once it's
|
||||||
|
if (renderedCallback) {
|
||||||
|
displaySetData.renderedCallback = renderedCallback;
|
||||||
|
}
|
||||||
|
|
||||||
|
OHIF.viewerbase.layoutManager.rerenderViewportWithNewDisplaySet(viewportIndex, displaySetData);
|
||||||
|
};
|
||||||
@ -2,6 +2,7 @@ import './jumpToRowItem';
|
|||||||
import './activateMeasurements';
|
import './activateMeasurements';
|
||||||
import './deactivateAllToolData';
|
import './deactivateAllToolData';
|
||||||
import './exportPdf';
|
import './exportPdf';
|
||||||
|
import './findAndRenderDisplaySet';
|
||||||
import './getImageDataUrl';
|
import './getImageDataUrl';
|
||||||
import './getMeasurementsGroupedByNumber';
|
import './getMeasurementsGroupedByNumber';
|
||||||
import './getLocationLabel';
|
import './getLocationLabel';
|
||||||
|
|||||||
@ -1,44 +1,16 @@
|
|||||||
import { $ } from 'meteor/jquery';
|
import { $ } from 'meteor/jquery';
|
||||||
import { _ } from 'meteor/underscore';
|
import { _ } from 'meteor/underscore';
|
||||||
import { OHIF } from 'meteor/ohif:core';
|
import { OHIF } from 'meteor/ohif:core';
|
||||||
import 'meteor/ohif:viewerbase';
|
|
||||||
|
|
||||||
function findAndRenderDisplaySet(displaySets, viewportIndex, studyInstanceUid, seriesInstanceUid, sopInstanceUid, renderedCallback) {
|
|
||||||
// Find the proper stack to display
|
|
||||||
const stacksFromSeries = displaySets.filter(stack => stack.seriesInstanceUid === seriesInstanceUid);
|
|
||||||
const stack = stacksFromSeries.find(stack => {
|
|
||||||
const imageIndex = stack.images.findIndex(image => image.getSOPInstanceUID() === sopInstanceUid);
|
|
||||||
return imageIndex > -1;
|
|
||||||
});
|
|
||||||
|
|
||||||
// TODO: make this work for multi-frame instances
|
|
||||||
const specificImageIndex = stack.images.findIndex(image => image.getSOPInstanceUID() === sopInstanceUid);
|
|
||||||
|
|
||||||
const displaySetData = {
|
|
||||||
studyInstanceUid: studyInstanceUid,
|
|
||||||
seriesInstanceUid: seriesInstanceUid,
|
|
||||||
sopInstanceUid: sopInstanceUid,
|
|
||||||
displaySetInstanceUid: stack.displaySetInstanceUid,
|
|
||||||
currentImageIdIndex: specificImageIndex
|
|
||||||
};
|
|
||||||
|
|
||||||
// Add a renderedCallback to activate the measurements once it's
|
|
||||||
if (renderedCallback) {
|
|
||||||
displaySetData.renderedCallback = renderedCallback;
|
|
||||||
}
|
|
||||||
|
|
||||||
OHIF.viewerbase.layoutManager.rerenderViewportWithNewDisplaySet(viewportIndex, displaySetData);
|
|
||||||
}
|
|
||||||
|
|
||||||
function renderIntoViewport(viewportIndex, studyInstanceUid, seriesInstanceUid, sopInstanceUid, renderedCallback) {
|
function renderIntoViewport(viewportIndex, studyInstanceUid, seriesInstanceUid, sopInstanceUid, renderedCallback) {
|
||||||
|
|
||||||
// @TypeSafeStudies
|
// @TypeSafeStudies
|
||||||
// First, check if we already have this study loaded
|
// First, check if we already have this study loaded
|
||||||
const alreadyLoadedStudy = OHIF.viewer.Studies.findBy({ studyInstanceUid });
|
const alreadyLoadedStudy = OHIF.viewer.Studies.findBy({ studyInstanceUid });
|
||||||
|
|
||||||
|
const { findAndRenderDisplaySet } = OHIF.measurements;
|
||||||
if (alreadyLoadedStudy) {
|
if (alreadyLoadedStudy) {
|
||||||
// If the Study is already loaded, find the display set and render it
|
// If the Study is already loaded, find the display set and render it
|
||||||
findAndRenderDisplaySet(alreadyLoadedStudy.displaySets, viewportIndex, studyInstanceUid, seriesInstanceUid, sopInstanceUid, renderedCallback)
|
findAndRenderDisplaySet(alreadyLoadedStudy.displaySets, viewportIndex, studyInstanceUid, seriesInstanceUid, sopInstanceUid, renderedCallback);
|
||||||
} else {
|
} else {
|
||||||
// If not, retrieve the study metadata and then find the relevant display set and
|
// If not, retrieve the study metadata and then find the relevant display set and
|
||||||
// render it.
|
// render it.
|
||||||
@ -113,11 +85,11 @@ OHIF.measurements.jumpToRowItem = (rowItem, timepoints) => {
|
|||||||
timepoints.reverse();
|
timepoints.reverse();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (var i=0; i < numViewportsToUpdate; i++) {
|
for (let i = 0; i < numViewportsToUpdate; i++) {
|
||||||
const timepoint = timepoints[i];
|
const timepoint = timepoints[i];
|
||||||
const timepointId = timepoint.timepointId;
|
const timepointId = timepoint.timepointId;
|
||||||
|
|
||||||
const dataAtThisTimepoint = _.where(rowItem.entries, {timepointId: timepointId});
|
const dataAtThisTimepoint = _.where(rowItem.entries, { timepointId });
|
||||||
if (!dataAtThisTimepoint || !dataAtThisTimepoint.length) {
|
if (!dataAtThisTimepoint || !dataAtThisTimepoint.length) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -133,7 +105,7 @@ OHIF.measurements.jumpToRowItem = (rowItem, timepoints) => {
|
|||||||
// or maybe just remove the 'error' this throws?
|
// or maybe just remove the 'error' this throws?
|
||||||
let enabledElement;
|
let enabledElement;
|
||||||
try {
|
try {
|
||||||
enabledElement = cornerstone.getEnabledElement(element)
|
enabledElement = cornerstone.getEnabledElement(element);
|
||||||
} catch(error) {
|
} catch(error) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -37,6 +37,7 @@ Package.onUse(function(api) {
|
|||||||
api.use('ohif:log');
|
api.use('ohif:log');
|
||||||
api.use('ohif:study-list');
|
api.use('ohif:study-list');
|
||||||
api.use('ohif:hanging-protocols');
|
api.use('ohif:hanging-protocols');
|
||||||
|
api.use('ohif:viewerbase');
|
||||||
|
|
||||||
// Client and server imports
|
// Client and server imports
|
||||||
api.addFiles('both/index.js', ['client', 'server']);
|
api.addFiles('both/index.js', ['client', 'server']);
|
||||||
|
|||||||
@ -28,7 +28,7 @@ Template.studyBrowserSeries.onCreated(() => {
|
|||||||
if (!metadata) return;
|
if (!metadata) return;
|
||||||
|
|
||||||
// Get the study display sets
|
// Get the study display sets
|
||||||
let displaySets = metadata.getDisplaySets();
|
let displaySets = metadata.displaySets;
|
||||||
if (!displaySets.length) {
|
if (!displaySets.length) {
|
||||||
displaySets = OHIF.viewerbase.sortingManager.getDisplaySets(metadata);
|
displaySets = OHIF.viewerbase.sortingManager.getDisplaySets(metadata);
|
||||||
metadata.displaySets = displaySets;
|
metadata.displaySets = displaySets;
|
||||||
|
|||||||
@ -468,7 +468,7 @@ const setDisplaySet = (data, displaySetInstanceUid, templateData) => {
|
|||||||
throw new OHIFError('Study does not exist');
|
throw new OHIFError('Study does not exist');
|
||||||
}
|
}
|
||||||
|
|
||||||
let displaySets = study.getDisplaySets();
|
let displaySets = study.displaySets;
|
||||||
if (!displaySets.length) {
|
if (!displaySets.length) {
|
||||||
displaySets = OHIF.viewerbase.sortingManager.getDisplaySets(study);
|
displaySets = OHIF.viewerbase.sortingManager.getDisplaySets(study);
|
||||||
study.displaySets = displaySets;
|
study.displaySets = displaySets;
|
||||||
|
|||||||
@ -75,7 +75,7 @@ Template.seriesQuickSwitch.helpers({
|
|||||||
|
|
||||||
const seriesItems = [];
|
const seriesItems = [];
|
||||||
|
|
||||||
let displaySets = study.getDisplaySets();
|
let displaySets = study.displaySets;
|
||||||
if (!displaySets.length) {
|
if (!displaySets.length) {
|
||||||
displaySets = OHIF.viewerbase.sortingManager.getDisplaySets(study);
|
displaySets = OHIF.viewerbase.sortingManager.getDisplaySets(study);
|
||||||
study.displaySets = displaySets;
|
study.displaySets = displaySets;
|
||||||
|
|||||||
@ -5,7 +5,6 @@ import { Random } from 'meteor/random';
|
|||||||
import { OHIF } from 'meteor/ohif:core';
|
import { OHIF } from 'meteor/ohif:core';
|
||||||
// Local Modules
|
// Local Modules
|
||||||
import { unloadHandlers } from '../../../lib/unloadHandlers';
|
import { unloadHandlers } from '../../../lib/unloadHandlers';
|
||||||
import { hotkeyUtils } from '../../../lib/hotkeyUtils';
|
|
||||||
import { ResizeViewportManager } from '../../../lib/classes/ResizeViewportManager';
|
import { ResizeViewportManager } from '../../../lib/classes/ResizeViewportManager';
|
||||||
import { LayoutManager } from '../../../lib/classes/LayoutManager';
|
import { LayoutManager } from '../../../lib/classes/LayoutManager';
|
||||||
import { StudyPrefetcher } from '../../../lib/classes/StudyPrefetcher';
|
import { StudyPrefetcher } from '../../../lib/classes/StudyPrefetcher';
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user