reorganize packages, start converting overall app to react (very broken at the moment)
This commit is contained in:
1 parent
024fe1a448
commit
5f30f7bd35
479 files changed
+5364
-11611
No files matched your search
@@ -1,5 +0,0 @@
|
||||
import { OHIF } from 'meteor/ohif:core';
|
||||
|
||||
OHIF.studies = {};
|
||||
|
||||
require('../imports/both');
|
||||
@@ -1,2 +0,0 @@
|
||||
import './lib';
|
||||
import './services';
|
||||
@@ -1 +0,0 @@
|
||||
import './parseFloatArray.js';
|
||||
@@ -1,11 +0,0 @@
|
||||
import './item.html';
|
||||
import './item.js';
|
||||
import './list.html';
|
||||
import './list.js';
|
||||
import './list.styl';
|
||||
import './quickSwitch.html';
|
||||
import './quickSwitch.js';
|
||||
import './series.html';
|
||||
import './series.js';
|
||||
import './sidebar.html';
|
||||
import './sidebar.js';
|
||||
@@ -1,29 +0,0 @@
|
||||
<template name="studyBrowserItem">
|
||||
<div class="study-browser-item {{this.studyItemClass}} {{#if isActive}}active{{/if}} {{#if isLoading}}loading{{/if}}" data-uid="{{this.studyInformation.studyInstanceUid}}">
|
||||
<div class="study-item">
|
||||
{{#if isLoading}}
|
||||
{{>loadingText}}
|
||||
{{/if}}
|
||||
{{#let studyData=instance.studyData.get}}
|
||||
<div class="study-item-box">
|
||||
<div class="study-modality">
|
||||
<div class="study-modality-text" style="{{modalityStyle studyData.modalities}}">{{studyData.modalities}}</div>
|
||||
</div>
|
||||
<div class="study-text">
|
||||
{{#if (or isLoaded hasDescriptionAndDate)}}
|
||||
<div class="study-date">{{formatDA studyData.studyDate 'D-MMM-YYYY'}}</div>
|
||||
<div class="study-description">{{studyData.studyDescription}}</div>
|
||||
{{else}}
|
||||
<div class="study-availability">{{#if eq studyAvailable false}}N/A{{else}}Click to load{{/if}}</div>
|
||||
{{/if}}
|
||||
</div>
|
||||
</div>
|
||||
{{/let}}
|
||||
</div>
|
||||
{{#if this.studyChildTemplate}}
|
||||
{{#if and (not isLoading) instance.studyData.get instance.loaded}}
|
||||
{{>Template.dynamic template=this.studyChildTemplate data=(clone this)}}
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
</div>
|
||||
</template>
|
||||
@@ -1,140 +0,0 @@
|
||||
import { Template } from 'meteor/templating';
|
||||
import { ReactiveVar } from 'meteor/reactive-var';
|
||||
import { Tracker } from 'meteor/tracker';
|
||||
import { $ } from 'meteor/jquery';
|
||||
import { _ } from 'meteor/underscore';
|
||||
import { OHIF } from 'meteor/ohif:core';
|
||||
|
||||
Template.studyBrowserItem.onCreated(() => {
|
||||
const instance = Template.instance();
|
||||
const { studyInformation } = instance.data;
|
||||
const { studyInstanceUid } = studyInformation;
|
||||
|
||||
instance.loaded = new ReactiveVar(false);
|
||||
instance.loading = new ReactiveVar(false);
|
||||
|
||||
instance.studyData = new ReactiveVar(studyInformation);
|
||||
|
||||
// Try to load the study data from an external source if available
|
||||
if (OHIF.studies.getStudyBoxData) {
|
||||
OHIF.studies.getStudyBoxData(studyInformation).then(studyData => {
|
||||
if (!instance.loaded.get()) {
|
||||
instance.studyData.set(studyData);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
instance.studyMetadata = null;
|
||||
instance.getStudyMetadata = () => {
|
||||
instance.loading.dep.depend();
|
||||
|
||||
if (!instance.studyMetadata) {
|
||||
let study = OHIF.viewer.Studies.findBy({ studyInstanceUid }) || null;
|
||||
if (study && !(study instanceof OHIF.viewerbase.metadata.StudyMetadata)) {
|
||||
study = new OHIF.metadata.StudyMetadata(study, study.studyInstanceUid);
|
||||
}
|
||||
|
||||
instance.studyMetadata = study;
|
||||
}
|
||||
|
||||
return instance.studyMetadata;
|
||||
};
|
||||
|
||||
instance.autorun(() => {
|
||||
const instance = Template.instance();
|
||||
|
||||
OHIF.studies.loadingDict.get(studyInstanceUid);
|
||||
const studyMetadata = instance.getStudyMetadata();
|
||||
if (studyMetadata) {
|
||||
const firstInstance = studyMetadata.getFirstInstance();
|
||||
instance.studyData.set({
|
||||
studyDate: firstInstance.getRawValue('x00080020') || '',
|
||||
studyDescription: firstInstance.getRawValue('x00081030') || '',
|
||||
modalities: firstInstance.getRawValue('x00080060') || '',
|
||||
});
|
||||
|
||||
instance.loaded.set(true);
|
||||
instance.loading.set(false);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Template.studyBrowserItem.events({
|
||||
'click .study-item'(event, instance) {
|
||||
if (instance.loading.get()) return;
|
||||
|
||||
const { studyInformation } = instance.data;
|
||||
|
||||
// Skip if study is not available (set to false explicitly)
|
||||
if (studyInformation.available === false) {
|
||||
return;
|
||||
}
|
||||
|
||||
const element = event.currentTarget.parentElement;
|
||||
const $element = $(element);
|
||||
const triggerClick = () => {
|
||||
const cloneEvent = _.clone(event);
|
||||
delete cloneEvent.type;
|
||||
cloneEvent.currentTarget = cloneEvent.target = element;
|
||||
const newEvent = $.Event('ohif.studies.study.click', cloneEvent);
|
||||
$element.trigger(newEvent, studyInformation);
|
||||
};
|
||||
|
||||
if (instance.loaded.get()) {
|
||||
triggerClick();
|
||||
} else {
|
||||
instance.loading.set(true);
|
||||
OHIF.studies.loadStudy(studyInformation.studyInstanceUid).then(() => {
|
||||
instance.loaded.set(true);
|
||||
instance.loading.set(false);
|
||||
$element.trigger('ohif.studies.study.load', studyInformation);
|
||||
Tracker.afterFlush(triggerClick);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Template.studyBrowserItem.helpers({
|
||||
isLoaded() {
|
||||
return Template.instance().loaded.get();
|
||||
},
|
||||
|
||||
hasDescriptionAndDate() {
|
||||
const studyData = Template.instance().studyData.get();
|
||||
return studyData.studyDescription && studyData.studyDate;
|
||||
},
|
||||
|
||||
isLoading() {
|
||||
return Template.instance().loading.get();
|
||||
},
|
||||
|
||||
modalitiesText(modalities) {
|
||||
const text = modalities || 'UN';
|
||||
return _.uniq(text.split(/[^A-Za-z]+/g)).join(' ');
|
||||
},
|
||||
|
||||
modalityStyle(modalities) {
|
||||
// Responsively styles the Modality Acronyms for studies with more than one modality
|
||||
const numModalities = modalities ? modalities.split(/\s/g).length : 1;
|
||||
|
||||
if (numModalities === 1) {
|
||||
// If we have only one modality, it should take up the whole div
|
||||
return 'font-size:1em';
|
||||
} else if (numModalities === 2) {
|
||||
// If we have two modalities, let them sit side-by-side
|
||||
return 'font-size:0.7em';
|
||||
} else {
|
||||
// If we have more than two modalities, change the line height to display multiple rows
|
||||
return 'font-size:0.7em;line-height:1.4em;padding-top:0.5em';
|
||||
}
|
||||
},
|
||||
|
||||
studyAvailable() {
|
||||
const { studyInformation } = Template.instance().data;
|
||||
if (!studyInformation) {
|
||||
return;
|
||||
}
|
||||
|
||||
return studyInformation.available;
|
||||
}
|
||||
});
|
||||
@@ -1,7 +0,0 @@
|
||||
<template name="studyBrowserList">
|
||||
<div class="study-browser-list {{this.class}}">
|
||||
{{#each studyInformation in getStudiesInformation}}
|
||||
{{>studyBrowserItem (clone this studyInformation=studyInformation)}}
|
||||
{{/each}}
|
||||
</div>
|
||||
</template>
|
||||
@@ -1,26 +0,0 @@
|
||||
import { Template } from 'meteor/templating';
|
||||
|
||||
Template.studyBrowserList.onCreated(() => {
|
||||
const instance = Template.instance();
|
||||
|
||||
if (instance.data.studiesData) {
|
||||
instance.studiesData = instance.data.studiesData;
|
||||
}
|
||||
});
|
||||
|
||||
Template.studyBrowserList.helpers({
|
||||
getStudiesInformation() {
|
||||
const instance = Template.instance();
|
||||
|
||||
let studiesInformation;
|
||||
if (instance.studiesData) {
|
||||
studiesInformation = instance.studiesData.get() || [];
|
||||
} else {
|
||||
studiesInformation = instance.data.studiesInformation || [];
|
||||
}
|
||||
|
||||
const result = new Map();
|
||||
studiesInformation.forEach(item => result.set(item.studyInstanceUid, item));
|
||||
return Array.from(result.values());
|
||||
}
|
||||
});
|
||||
@@ -1,149 +0,0 @@
|
||||
@require '{ohif:design}/app'
|
||||
|
||||
$boxBorderColor = transparent
|
||||
$boxHoverBackgroundColor = #14191E
|
||||
$boxHoverBorderColor = #2d4660
|
||||
$boxActiveBorderColor = #131D29
|
||||
$boxWidth = 50px
|
||||
$borderThickness = 2px
|
||||
$boxBorderRadius = 8px
|
||||
$nestingMargin = 6px
|
||||
$spacerX = 7px
|
||||
$spacerY = 12px
|
||||
|
||||
.study-browser-item
|
||||
position: relative
|
||||
// required transformation to make inner fixed elements relative to this one
|
||||
transform(scale(1))
|
||||
|
||||
.loadingTextDiv
|
||||
theme('color', '$textSecondaryColor')
|
||||
background-color: $boxHoverBackgroundColor
|
||||
border-radius: 12px
|
||||
font-size: 32px
|
||||
opacity: 0
|
||||
margin: 0
|
||||
padding: 25px
|
||||
position: absolute
|
||||
pointer-events: none
|
||||
z-index: 100
|
||||
|
||||
&.loading
|
||||
.loadingTextDiv
|
||||
height: 100%
|
||||
left: 0
|
||||
opacity: 0.75
|
||||
top: 0
|
||||
width: 100%
|
||||
|
||||
.study-item-box
|
||||
opacity: 0.2
|
||||
|
||||
&.active
|
||||
.study-item-box
|
||||
.study-modality
|
||||
theme('color', '$primaryBackgroundColor')
|
||||
&
|
||||
&:before
|
||||
&:after
|
||||
theme('background-color', '$activeColor')
|
||||
border-color: $boxActiveBorderColor
|
||||
|
||||
&:not(.active) .study-browser-series
|
||||
max-height: 0 !important
|
||||
|
||||
.study-series-container
|
||||
opacity: 0
|
||||
transform(translateY(-100%))
|
||||
|
||||
.study-browser-series
|
||||
overflow: hidden
|
||||
transition(max-height 0.3s ease)
|
||||
|
||||
.study-series-container
|
||||
opacity: 1
|
||||
transition(opacity 0.3s ease\, transform 0.3s ease)
|
||||
transform(translateY(0))
|
||||
transform-origin(50% 0%)
|
||||
|
||||
.study-item-box
|
||||
border: 1px solid $boxBorderColor
|
||||
border-radius: 12px
|
||||
cursor: pointer
|
||||
padding: $spacerY $spacerX ($spacerY - 1)
|
||||
position: relative
|
||||
transition($sidebarTransition)
|
||||
z-index: 0
|
||||
|
||||
&:hover
|
||||
background-color: $boxHoverBackgroundColor
|
||||
border-color: $boxHoverBorderColor
|
||||
|
||||
&.additional
|
||||
theme('color', '$textSecondaryColor')
|
||||
|
||||
&.additional
|
||||
theme('color', '$textPrimaryColor')
|
||||
font-size: 16px
|
||||
font-weight: normal
|
||||
height: 91px
|
||||
line-height: 91px
|
||||
padding: 0
|
||||
text-align: center
|
||||
|
||||
.study-text
|
||||
font-size: 13px
|
||||
left: ($spacerX * 3) + $boxWidth + ($nestingMargin * 3)
|
||||
line-height: 14px
|
||||
position: absolute
|
||||
right: $spacerX
|
||||
top: $spacerY
|
||||
.study-date
|
||||
margin-top: 8px
|
||||
theme('color', '$textSecondaryColor')
|
||||
.study-description
|
||||
margin-top: 8px
|
||||
theme('color', '$textPrimaryColor')
|
||||
.study-availability
|
||||
margin-top: 24px
|
||||
theme('color', '$textPrimaryColor')
|
||||
|
||||
.study-modality
|
||||
theme('color', '$textSecondaryColor')
|
||||
font-size: 20px
|
||||
line-height: $boxWidth
|
||||
margin-left: $nestingMargin * 2
|
||||
margin-top: $nestingMargin * 2
|
||||
position: relative
|
||||
|
||||
.study-modality-text
|
||||
height: 100%
|
||||
overflow: hidden
|
||||
text-align: center
|
||||
text-transform: uppercase
|
||||
|
||||
&
|
||||
&:before
|
||||
&:after
|
||||
theme('border', '%s solid $primaryBackgroundColor' % $borderThickness)
|
||||
theme('background-color', '$boxBackgroundColor')
|
||||
border-radius: $boxBorderRadius
|
||||
height: $boxWidth + ($borderThickness * 2)
|
||||
transition($sidebarTransition)
|
||||
width: $boxWidth + ($borderThickness * 2)
|
||||
|
||||
&:before
|
||||
&:after
|
||||
display: block
|
||||
content: ''
|
||||
position: absolute
|
||||
|
||||
&:before
|
||||
top: -($borderThickness + $nestingMargin)
|
||||
left: -($borderThickness + $nestingMargin)
|
||||
z-index: -1
|
||||
|
||||
&:after
|
||||
top: -($borderThickness + ($nestingMargin * 2))
|
||||
left: -($borderThickness + ($nestingMargin * 2))
|
||||
z-index: -2
|
||||
@@ -1,3 +0,0 @@
|
||||
<template name="studyBrowserQuickSwitch">
|
||||
{{>studyBrowserList studyBrowserData}}
|
||||
</template>
|
||||
@@ -1,43 +0,0 @@
|
||||
import { Template } from 'meteor/templating';
|
||||
import { ReactiveVar } from 'meteor/reactive-var';
|
||||
import { Tracker } from 'meteor/tracker';
|
||||
import { OHIF } from 'meteor/ohif:core';
|
||||
|
||||
Template.studyBrowserQuickSwitch.onCreated(() => {
|
||||
const instance = Template.instance();
|
||||
instance.studiesInformation = new ReactiveVar();
|
||||
const filter = { studyInstanceUid: OHIF.viewer.data.studyInstanceUids };
|
||||
OHIF.studies.searchStudies(filter).then(studies => instance.studiesInformation.set(studies));
|
||||
});
|
||||
|
||||
Template.studyBrowserQuickSwitch.onRendered(() => {
|
||||
const instance = Template.instance();
|
||||
instance.autorun(() => {
|
||||
instance.studiesInformation.dep.depend();
|
||||
const currentStudy = instance.data.currentStudy.get();
|
||||
const studyInstanceUid = (currentStudy && currentStudy.studyInstanceUid) || '';
|
||||
Tracker.afterFlush(() => {
|
||||
const $studyBrowserItems = instance.$('.study-browser-item');
|
||||
$studyBrowserItems.removeClass('active');
|
||||
$studyBrowserItems.filter(`[data-uid="${studyInstanceUid}"]`).addClass('active');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Template.studyBrowserQuickSwitch.events({
|
||||
'ohif.studies.study.click'(event, instance, studyInformation) {
|
||||
const { studyInstanceUid } = studyInformation;
|
||||
const study = OHIF.viewer.Studies.findBy({ studyInstanceUid });
|
||||
instance.data.currentStudy.set(study);
|
||||
const $studySwitch = $(event.currentTarget).closest('.study-switch');
|
||||
$studySwitch.siblings('.series-switch').trigger('rescale');
|
||||
}
|
||||
});
|
||||
|
||||
Template.studyBrowserQuickSwitch.helpers({
|
||||
studyBrowserData() {
|
||||
const instance = Template.instance();
|
||||
const studiesInformation = instance.studiesInformation.get();
|
||||
return { studiesInformation };
|
||||
}
|
||||
});
|
||||
@@ -1,9 +0,0 @@
|
||||
<template name="studyBrowserSeries">
|
||||
<div class="study-browser-series">
|
||||
<div class="study-series-container">
|
||||
{{#each thumbnail in instance.thumbnails.get}}
|
||||
{{>thumbnailEntry (clone this thumbnail=thumbnail)}}
|
||||
{{/each}}
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -1,65 +0,0 @@
|
||||
import { Template } from 'meteor/templating';
|
||||
import { ReactiveVar } from 'meteor/reactive-var';
|
||||
import { Tracker } from 'meteor/tracker';
|
||||
import { OHIF } from 'meteor/ohif:core';
|
||||
|
||||
Template.studyBrowserSeries.onCreated(() => {
|
||||
const instance = Template.instance();
|
||||
const { studyInformation, studyMetadata } = instance.data;
|
||||
const studyInstanceUid = (studyMetadata && studyMetadata.studyInstanceUid) || (studyInformation && studyInformation.studyInstanceUid);
|
||||
|
||||
instance.thumbnails = new ReactiveVar([]);
|
||||
|
||||
// Get the study metadata and update the study thumbnails
|
||||
instance.autorun(() => {
|
||||
let metadata = studyMetadata;
|
||||
|
||||
// Check for reactivity
|
||||
if (metadata instanceof ReactiveVar) {
|
||||
metadata = metadata.get();
|
||||
}
|
||||
|
||||
// Retrieve the study metadata
|
||||
if (!metadata) {
|
||||
metadata = OHIF.viewer.Studies.findBy({ studyInstanceUid });
|
||||
}
|
||||
|
||||
// Stop here if there's no study metadata
|
||||
if (!metadata) return;
|
||||
|
||||
// Get the study display sets
|
||||
let displaySets = metadata.displaySets;
|
||||
if (!displaySets.length) {
|
||||
displaySets = OHIF.viewerbase.sortingManager.getDisplaySets(metadata);
|
||||
metadata.displaySets = displaySets;
|
||||
metadata.setDisplaySets(displaySets);
|
||||
|
||||
metadata.forEachDisplaySet(displaySet => {
|
||||
OHIF.viewerbase.stackManager.makeAndAddStack(metadata, displaySet);
|
||||
});
|
||||
}
|
||||
|
||||
// Defines the resulting thumbnails list
|
||||
const thumbnails = [];
|
||||
displaySets.forEach((stack, thumbnailIndex) => {
|
||||
thumbnails.push({
|
||||
thumbnailIndex,
|
||||
stack
|
||||
});
|
||||
});
|
||||
|
||||
instance.thumbnails.set(thumbnails);
|
||||
});
|
||||
});
|
||||
|
||||
Template.studyBrowserSeries.onRendered(() => {
|
||||
const instance = Template.instance();
|
||||
|
||||
// Run this computation every time the thumbnails are changed
|
||||
instance.autorun(() => {
|
||||
instance.thumbnails.get();
|
||||
Tracker.afterFlush(() => {
|
||||
instance.$('.study-browser-series').adjustMax('height');
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -1,5 +0,0 @@
|
||||
<template name="studyBrowserSidebar">
|
||||
{{#scrollArea class='fit noselect' scrollableClass='p-a-1' scrollStep=191}}
|
||||
{{>studyBrowserList (clone this studyChildTemplate='studyBrowserSeries')}}
|
||||
{{/scrollArea}}
|
||||
</template>
|
||||
@@ -1,13 +0,0 @@
|
||||
import { Template } from 'meteor/templating';
|
||||
|
||||
Template.studyBrowserSidebar.events({
|
||||
'ohif.studies.study.click'(event, instance) {
|
||||
const $element = $(event.currentTarget);
|
||||
|
||||
// Remove active class from sibling studies
|
||||
$element.siblings().removeClass('active');
|
||||
|
||||
// Toggle the active class on clicked study
|
||||
$element.toggleClass('active');
|
||||
}
|
||||
});
|
||||
@@ -1 +0,0 @@
|
||||
import './browser';
|
||||
@@ -1,2 +1,2 @@
|
||||
import './components';
|
||||
import './lib';
|
||||
import './services';
|
||||
@@ -2,6 +2,7 @@ import { OHIF } from 'meteor/ohif:core';
|
||||
import { OHIFStudyMetadataSource } from './OHIFStudyMetadataSource';
|
||||
import { OHIFStudySummary } from './OHIFStudySummary';
|
||||
|
||||
OHIF.studies = {};
|
||||
OHIF.studies.classes = {
|
||||
OHIFStudyMetadataSource,
|
||||
OHIFStudySummary
|
||||
|
||||
@@ -4,3 +4,4 @@ import './loadStudy';
|
||||
import './retrieveStudiesMetadata';
|
||||
import './retrieveStudyMetadata';
|
||||
import './searchStudies';
|
||||
import './parseFloatArray';
|
||||
File renamed without changes.
@@ -8,11 +8,11 @@ const StudyMetaDataPromises = new Map();
|
||||
|
||||
|
||||
/**
|
||||
* Delete the cached study metadata retrieval promise to ensure that the browser will
|
||||
* Delete the cached study metadata retrieval promise to ensure that the browser will
|
||||
* re-retrieve the study metadata when it is next requested
|
||||
*
|
||||
* @param {String} studyInstanceUid The UID of the Study to be removed from cache
|
||||
*
|
||||
*
|
||||
*/
|
||||
OHIF.studies.deleteStudyMetadataPromise = (studyInstanceUid) => {
|
||||
if (StudyMetaDataPromises.has(studyInstanceUid)) {
|
||||
@@ -52,41 +52,6 @@ OHIF.studies.retrieveStudyMetadata = (studyInstanceUid, seriesInstanceUids) => {
|
||||
OHIF.studies.services.WADO.RetrieveMetadata(server, studyInstanceUid).then(function (data) {
|
||||
resolve(data)
|
||||
}, reject);
|
||||
} else {
|
||||
Meteor.call('GetStudyMetadata', studyInstanceUid, function (error, study) {
|
||||
OHIF.log.timeEnd(timingKey);
|
||||
|
||||
if (error) {
|
||||
const errorType = error.error;
|
||||
let errorMessage = '';
|
||||
|
||||
if (errorType === 'server-connection-error') {
|
||||
errorMessage = 'There was an error connecting to the DICOM server, please verify if it is up and running.';
|
||||
} else if (errorType === 'server-internal-error') {
|
||||
errorMessage = `There was an internal error with the DICOM server getting metadeta for ${studyInstanceUid}`;
|
||||
} else {
|
||||
errorMessage = `For some reason we could not retrieve the study\'s metadata for ${studyInstanceUid}.`;
|
||||
}
|
||||
|
||||
OHIF.log.error(errorMessage);
|
||||
OHIF.log.error(error.stack);
|
||||
reject(`GetStudyMetadata: ${errorMessage}`);
|
||||
return;
|
||||
}
|
||||
|
||||
// Filter series if seriesInstanceUid exists
|
||||
if (seriesInstanceUids && seriesInstanceUids.length) {
|
||||
study.seriesList = study.seriesList.filter(series => seriesInstanceUids.indexOf(series.seriesInstanceUid) > -1);
|
||||
}
|
||||
|
||||
if (!study) {
|
||||
reject(`GetStudyMetadata: No study data returned from server: ${studyInstanceUid}`);
|
||||
return;
|
||||
}
|
||||
|
||||
// Resolve the promise with the final study metadata object
|
||||
resolve(study);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -19,14 +19,6 @@ OHIF.studies.searchStudies = filter => {
|
||||
|
||||
if (server.type === 'dicomWeb' && server.requestOptions.requestFromBrowser === true) {
|
||||
OHIF.studies.services.QIDO.Studies(server, filter).then(resolve, reject);
|
||||
} else {
|
||||
Meteor.call('StudyListSearch', filter, (error, studiesData) => {
|
||||
if (error) {
|
||||
reject(error);
|
||||
} else {
|
||||
resolve(studiesData);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
studySearchPromises.set(promiseKey, promise);
|
||||
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -1,2 +0,0 @@
|
||||
import './methods';
|
||||
import './services';
|
||||
@@ -1,32 +0,0 @@
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import { OHIF } from 'meteor/ohif:core';
|
||||
|
||||
Meteor.methods({
|
||||
/**
|
||||
* Retrieves Study metadata given a Study Instance UID
|
||||
* This Meteor method is available from both the client and the server
|
||||
*/
|
||||
GetStudyMetadata: function(studyInstanceUid) {
|
||||
OHIF.log.info('GetStudyMetadata(%s)', studyInstanceUid);
|
||||
|
||||
// Get the server data. This is user-defined in the config.json files or through servers
|
||||
// configuration modal
|
||||
const server = OHIF.servers.getCurrentServer();
|
||||
|
||||
if (!server) {
|
||||
throw new Meteor.Error('improper-server-config', 'No properly configured server was available over DICOMWeb or DIMSE.');
|
||||
}
|
||||
|
||||
try {
|
||||
if (server.type === 'dicomWeb') {
|
||||
return OHIF.studies.services.WADO.RetrieveMetadata(server, studyInstanceUid);
|
||||
} else if (server.type === 'dimse') {
|
||||
return OHIF.studies.services.DIMSE.RetrieveMetadata(studyInstanceUid);
|
||||
}
|
||||
} catch (error) {
|
||||
OHIF.log.trace();
|
||||
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -1,2 +0,0 @@
|
||||
import './getStudyMetadata.js';
|
||||
import './studylistSearch.js';
|
||||
@@ -1,31 +0,0 @@
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import { OHIF } from 'meteor/ohif:core';
|
||||
|
||||
Meteor.methods({
|
||||
/**
|
||||
* Use the specified filter to conduct a search from the DICOM server
|
||||
*
|
||||
* @param filter
|
||||
*/
|
||||
StudyListSearch(filter) {
|
||||
// Get the server data. This is user-defined in the config.json files or through servers
|
||||
// configuration modal
|
||||
const server = OHIF.servers.getCurrentServer();
|
||||
|
||||
if (!server) {
|
||||
throw new Meteor.Error('improper-server-config', 'No properly configured server was available over DICOMWeb or DIMSE.');
|
||||
}
|
||||
|
||||
try {
|
||||
if (server.type === 'dicomWeb') {
|
||||
return OHIF.studies.services.QIDO.Studies(server, filter);
|
||||
} else if (server.type === 'dimse') {
|
||||
return OHIF.studies.services.DIMSE.Studies(filter);
|
||||
}
|
||||
} catch (error) {
|
||||
OHIF.log.trace();
|
||||
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -1,70 +0,0 @@
|
||||
import { OHIF } from 'meteor/ohif:core';
|
||||
import DIMSE from 'dimse';
|
||||
|
||||
/**
|
||||
* Parses data returned from a study search and transforms it into
|
||||
* an array of series that are present in the study
|
||||
*
|
||||
* @param resultData
|
||||
* @param studyInstanceUid
|
||||
* @returns {Array} Series List
|
||||
*/
|
||||
function resultDataToStudyMetadata(resultData, studyInstanceUid) {
|
||||
const seriesMap = {};
|
||||
const seriesList = [];
|
||||
|
||||
resultData.forEach(function(instanceRaw) {
|
||||
const instance = instanceRaw.toObject();
|
||||
// Use seriesMap to cache series data
|
||||
// If the series instance UID has already been used to
|
||||
// process series data, continue using that series
|
||||
const seriesInstanceUid = instance[0x0020000E];
|
||||
let series = seriesMap[seriesInstanceUid];
|
||||
|
||||
// If no series data exists in the seriesMap cache variable,
|
||||
// process any available series data
|
||||
if (!series) {
|
||||
series = {
|
||||
seriesInstanceUid: seriesInstanceUid,
|
||||
seriesNumber: instance[0x00200011],
|
||||
instances: []
|
||||
};
|
||||
|
||||
// Save this data in the seriesMap cache variable
|
||||
seriesMap[seriesInstanceUid] = series;
|
||||
seriesList.push(series);
|
||||
}
|
||||
|
||||
// TODO: Check which peer it should point to
|
||||
const server = OHIF.servers.getCurrentServer().peers[0];
|
||||
|
||||
const serverRoot = server.host + ':' + server.port;
|
||||
|
||||
const sopInstanceUid = instance[0x00080018];
|
||||
const uri = serverRoot + '/studies/' + studyInstanceUid + '/series/' + seriesInstanceUid + '/instances/' + sopInstanceUid + '/frames/1';
|
||||
|
||||
// Add this instance to the current series
|
||||
series.instances.push({
|
||||
sopClassUid: instance[0x00080016],
|
||||
sopInstanceUid,
|
||||
uri,
|
||||
instanceNumber: instance[0x00200013]
|
||||
});
|
||||
});
|
||||
return seriesList;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve a set of instances using a DIMSE call
|
||||
* @param studyInstanceUid
|
||||
* @returns {{wadoUriRoot: String, studyInstanceUid: String, seriesList: Array}}
|
||||
*/
|
||||
OHIF.studies.services.DIMSE.Instances = function(studyInstanceUid) {
|
||||
//var url = buildUrl(server, studyInstanceUid);
|
||||
const result = DIMSE.retrieveInstances(studyInstanceUid);
|
||||
|
||||
return {
|
||||
studyInstanceUid: studyInstanceUid,
|
||||
seriesList: resultDataToStudyMetadata(result, studyInstanceUid)
|
||||
};
|
||||
};
|
||||
@@ -1,170 +0,0 @@
|
||||
import { OHIF } from 'meteor/ohif:core';
|
||||
import { parseFloatArray } from 'meteor/ohif:studies/imports/both/lib/parseFloatArray';
|
||||
import DIMSE from 'dimse';
|
||||
|
||||
/**
|
||||
* Returns the value of the element (e.g. '00280009')
|
||||
*
|
||||
* @param element - The group/element of the element (e.g. '00280009')
|
||||
* @param defaultValue - The default value to return if the element does not exist
|
||||
* @returns {*}
|
||||
*/
|
||||
function getValue(element, defaultValue) {
|
||||
if (!element || !element.value) {
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
return element.value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses the SourceImageSequence, if it exists, in order
|
||||
* to return a ReferenceSOPInstanceUID. The ReferenceSOPInstanceUID
|
||||
* is used to refer to this image in any accompanying DICOM-SR documents.
|
||||
*
|
||||
* @param instance
|
||||
* @returns {String} The ReferenceSOPInstanceUID
|
||||
*/
|
||||
function getSourceImageInstanceUid(instance) {
|
||||
// TODO= Parse the whole Source Image Sequence
|
||||
// This is a really poor workaround for now.
|
||||
// Later we should probably parse the whole sequence.
|
||||
const SourceImageSequence = instance[0x00082112];
|
||||
if (SourceImageSequence && SourceImageSequence.length) {
|
||||
return SourceImageSequence[0][0x00081155];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses result data from a DIMSE search into Study MetaData
|
||||
* Returns an object populated with study metadata, including the
|
||||
* series list.
|
||||
*
|
||||
* @param studyInstanceUid
|
||||
* @param resultData
|
||||
* @returns {{seriesList: Array, patientName: *, patientId: *, accessionNumber: *, studyDate: *, modalities: *, studyDescription: *, imageCount: *, studyInstanceUid: *}}
|
||||
*/
|
||||
function resultDataToStudyMetadata(studyInstanceUid, resultData) {
|
||||
OHIF.log.info('resultDataToStudyMetadata');
|
||||
const seriesMap = {};
|
||||
const seriesList = [];
|
||||
|
||||
if (!resultData.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
const anInstance = resultData[0].toObject();
|
||||
if (!anInstance) {
|
||||
return;
|
||||
}
|
||||
|
||||
const studyData = {
|
||||
seriesList: seriesList,
|
||||
patientName: anInstance[0x00100010],
|
||||
patientId: anInstance[0x00100020],
|
||||
patientBirthDate: anInstance[0x00100030],
|
||||
patientSex: anInstance[0x00100040],
|
||||
accessionNumber: anInstance[0x00080050],
|
||||
studyDate: anInstance[0x00080020],
|
||||
modalities: anInstance[0x00080061],
|
||||
studyDescription: anInstance[0x00081030],
|
||||
imageCount: anInstance[0x00201208],
|
||||
studyInstanceUid: anInstance[0x0020000D],
|
||||
institutionName: anInstance[0x00080080]
|
||||
};
|
||||
|
||||
resultData.forEach(function(instanceRaw) {
|
||||
const instance = instanceRaw.toObject();
|
||||
const seriesInstanceUid = instance[0x0020000E];
|
||||
let series = seriesMap[seriesInstanceUid];
|
||||
if (!series) {
|
||||
series = {
|
||||
seriesDescription: instance[0x0008103E],
|
||||
modality: instance[0x00080060],
|
||||
seriesInstanceUid: seriesInstanceUid,
|
||||
seriesNumber: parseFloat(instance[0x00200011]),
|
||||
instances: []
|
||||
};
|
||||
seriesMap[seriesInstanceUid] = series;
|
||||
seriesList.push(series);
|
||||
}
|
||||
|
||||
const sopInstanceUid = instance[0x00080018];
|
||||
|
||||
const instanceSummary = {
|
||||
imageType: instance[0x00080008],
|
||||
sopClassUid: instance[0x00080016],
|
||||
modality: instance[0x00080060],
|
||||
sopInstanceUid: sopInstanceUid,
|
||||
instanceNumber: parseFloat(instance[0x00200013]),
|
||||
imagePositionPatient: instance[0x00200032],
|
||||
imageOrientationPatient: instance[0x00200037],
|
||||
frameOfReferenceUID: instance[0x00200052],
|
||||
sliceThickness: parseFloat(instance[0x00180050]),
|
||||
sliceLocation: parseFloat(instance[0x00201041]),
|
||||
tablePosition: parseFloat(instance[0x00189327]),
|
||||
samplesPerPixel: parseFloat(instance[0x00280002]),
|
||||
photometricInterpretation: instance[0x00280004],
|
||||
planarConfiguration: parseFloat(instance[0x00280006]),
|
||||
rows: parseFloat(instance[0x00280010]),
|
||||
columns: parseFloat(instance[0x00280011]),
|
||||
pixelSpacing: instance[0x00280030],
|
||||
bitsAllocated: parseFloat(instance[0x00280100]),
|
||||
bitsStored: parseFloat(instance[0x00280101]),
|
||||
highBit: parseFloat(instance[0x00280102]),
|
||||
pixelRepresentation: parseFloat(instance[0x00280103]),
|
||||
windowCenter: instance[0x00281050],
|
||||
windowWidth: instance[0x00281051],
|
||||
rescaleIntercept: parseFloat(instance[0x00281052]),
|
||||
rescaleSlope: parseFloat(instance[0x00281053]),
|
||||
sourceImageInstanceUid: getSourceImageInstanceUid(instance),
|
||||
laterality: instance[0x00200062],
|
||||
viewPosition: instance[0x00185101],
|
||||
acquisitionDateTime: instance[0x0008002A],
|
||||
numberOfFrames: parseFloat(instance[0x00280008]),
|
||||
frameIncrementPointer: getValue(instance[0x00280009]),
|
||||
frameTime: parseFloat(instance[0x00181063]),
|
||||
frameTimeVector: parseFloatArray(instance[0x00181065]),
|
||||
lossyImageCompression: instance[0x00282110],
|
||||
derivationDescription: instance[0x00282111],
|
||||
lossyImageCompressionRatio: instance[0x00282112],
|
||||
lossyImageCompressionMethod: instance[0x00282114],
|
||||
spacingBetweenSlices: instance[0x00180088],
|
||||
echoNumber: instance[0x00180086],
|
||||
contrastBolusAgent: instance[0x00180010]
|
||||
};
|
||||
|
||||
// Retrieve the actual data over WADO-URI
|
||||
const server = OHIF.servers.getCurrentServer();
|
||||
const wadouri = `${server.wadoUriRoot}?requestType=WADO&studyUID=${studyInstanceUid}&seriesUID=${seriesInstanceUid}&objectUID=${sopInstanceUid}&contentType=application%2Fdicom`;
|
||||
instanceSummary.wadouri = WADOProxy.convertURL(wadouri, server);
|
||||
|
||||
series.instances.push(instanceSummary);
|
||||
});
|
||||
|
||||
studyData.studyInstanceUid = studyInstanceUid;
|
||||
|
||||
return studyData;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieved Study MetaData from a DICOM server using DIMSE
|
||||
* @param studyInstanceUid
|
||||
* @returns {{seriesList: Array, patientName: *, patientId: *, accessionNumber: *, studyDate: *, modalities: *, studyDescription: *, imageCount: *, studyInstanceUid: *}}
|
||||
*/
|
||||
OHIF.studies.services.DIMSE.RetrieveMetadata = function(studyInstanceUid) {
|
||||
// TODO: Check which peer it should point to
|
||||
const activeServer = OHIF.servers.getCurrentServer().peers[0];
|
||||
const supportsInstanceRetrievalByStudyUid = activeServer.supportsInstanceRetrievalByStudyUid;
|
||||
let results;
|
||||
|
||||
// Check explicitly for a value of false, since this property
|
||||
// may be left undefined in config files
|
||||
if (supportsInstanceRetrievalByStudyUid === false) {
|
||||
results = DIMSE.retrieveInstancesByStudyOnly(studyInstanceUid);
|
||||
} else {
|
||||
results = DIMSE.retrieveInstances(studyInstanceUid);
|
||||
}
|
||||
|
||||
return resultDataToStudyMetadata(studyInstanceUid, results);
|
||||
};
|
||||
@@ -1,41 +0,0 @@
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import { OHIF } from 'meteor/ohif:core';
|
||||
import { CurrentServer } from 'meteor/ohif:servers/both/collections';
|
||||
import DIMSE from 'dimse';
|
||||
|
||||
const setupDIMSE = () => {
|
||||
// Terminate existing DIMSE servers and sockets and clean up the connection object
|
||||
DIMSE.connection.reset();
|
||||
|
||||
// Get the new server configuration
|
||||
const server = OHIF.servers.getCurrentServer();
|
||||
|
||||
// Stop here if the new server is not of DIMSE type
|
||||
if (server.type !== 'dimse') {
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if peers were defined in the server configuration and throw an error if not
|
||||
const peers = server.peers;
|
||||
if (!peers || !peers.length) {
|
||||
OHIF.log.error('dimse-config: ' + 'No DIMSE Peers provided.');
|
||||
throw new Meteor.Error('dimse-config', 'No DIMSE Peers provided.');
|
||||
}
|
||||
|
||||
// Add all the DIMSE peers, establishing the connections
|
||||
OHIF.log.info('Adding DIMSE peers');
|
||||
try {
|
||||
peers.forEach(peer => DIMSE.connection.addPeer(peer));
|
||||
} catch(error) {
|
||||
OHIF.log.error('dimse-addPeers: ' + error);
|
||||
throw new Meteor.Error('dimse-addPeers', error);
|
||||
}
|
||||
};
|
||||
|
||||
// Setup the DIMSE connections on startup or when the current server is changed
|
||||
Meteor.startup(() => {
|
||||
CurrentServer.find().observe({
|
||||
added: setupDIMSE,
|
||||
changed: setupDIMSE
|
||||
});
|
||||
});
|
||||
@@ -1,69 +0,0 @@
|
||||
import { moment } from 'meteor/momentjs:moment';
|
||||
import { OHIF } from 'meteor/ohif:core';
|
||||
import DIMSE from 'dimse';
|
||||
|
||||
/**
|
||||
* Parses resulting data from a QIDO call into a set of Study MetaData
|
||||
*
|
||||
* @param resultData
|
||||
* @returns {Array} An array of Study MetaData objects
|
||||
*/
|
||||
function resultDataToStudies(resultData) {
|
||||
const studies = [];
|
||||
|
||||
resultData.forEach(function(studyRaw) {
|
||||
const study = studyRaw.toObject();
|
||||
studies.push({
|
||||
studyInstanceUid: study[0x0020000D],
|
||||
// 00080005 = SpecificCharacterSet
|
||||
studyDate: study[0x00080020],
|
||||
studyTime: study[0x00080030],
|
||||
accessionNumber: study[0x00080050],
|
||||
referringPhysicianName: study[0x00080090],
|
||||
// 00081190 = URL
|
||||
patientName: study[0x00100010],
|
||||
patientId: study[0x00100020],
|
||||
patientBirthdate: study[0x00100030],
|
||||
patientSex: study[0x00100040],
|
||||
imageCount: study[0x00201208],
|
||||
studyId: study[0x00200010],
|
||||
studyDescription: study[0x00081030],
|
||||
modalities: study[0x00080061]
|
||||
});
|
||||
});
|
||||
return studies;
|
||||
}
|
||||
|
||||
OHIF.studies.services.DIMSE.Studies = function(filter) {
|
||||
OHIF.log.info('Services.DIMSE.Studies');
|
||||
|
||||
let filterStudyDate = '';
|
||||
if (filter.studyDateFrom && filter.studyDateTo) {
|
||||
const convertDate = date => moment(date, 'MM/DD/YYYY').format('YYYYMMDD');
|
||||
const dateFrom = convertDate(filter.studyDateFrom);
|
||||
const dateTo = convertDate(filter.studyDateTo);
|
||||
filterStudyDate = `${dateFrom}-${dateTo}`;
|
||||
}
|
||||
|
||||
// Build the StudyInstanceUID parameter
|
||||
let studyUids = filter.studyInstanceUid || '';
|
||||
if (studyUids) {
|
||||
studyUids = Array.isArray(studyUids) ? studyUids.join() : studyUids;
|
||||
studyUids = studyUids.replace(/[^0-9.]+/g, '\\');
|
||||
}
|
||||
|
||||
const parameters = {
|
||||
0x0020000D: studyUids,
|
||||
0x00100010: filter.patientName,
|
||||
0x00100020: filter.patientId,
|
||||
0x00080050: filter.accessionNumber,
|
||||
0x00080020: filterStudyDate,
|
||||
0x00081030: filter.studyDescription,
|
||||
0x00100040: '',
|
||||
0x00201208: '',
|
||||
0x00080061: filter.modalitiesInStudy
|
||||
};
|
||||
|
||||
const results = DIMSE.retrieveStudies(parameters);
|
||||
return resultDataToStudies(results);
|
||||
};
|
||||
@@ -1,7 +0,0 @@
|
||||
import './namespace.js';
|
||||
|
||||
// DIMSE instance, study, and metadata retrieval
|
||||
import './dimse/instances.js';
|
||||
import './dimse/studies.js';
|
||||
import './dimse/retrieveMetadata.js';
|
||||
import './dimse/setup.js';
|
||||
@@ -1,3 +0,0 @@
|
||||
import { OHIF } from 'meteor/ohif:core';
|
||||
|
||||
OHIF.studies.services.DIMSE = {};
|
||||
@@ -22,19 +22,10 @@ Package.onUse(function(api) {
|
||||
|
||||
// Our custom packages
|
||||
api.use([
|
||||
'ohif:design',
|
||||
'ohif:core',
|
||||
'ohif:servers',
|
||||
'ohif:viewerbase',
|
||||
'ohif:wadoproxy'
|
||||
]);
|
||||
|
||||
// Client and server imports
|
||||
api.addFiles('both/main.js', [ 'client', 'server' ]);
|
||||
|
||||
// Server imports
|
||||
api.addFiles('server/main.js', 'server');
|
||||
|
||||
// Client imports
|
||||
api.addFiles('client/main.js', 'client');
|
||||
});
|
||||
@@ -1 +0,0 @@
|
||||
require('../imports/server');
|
||||
Reference in new issue
Block a user