Skip to content
This repository has been archived by the owner on Jun 23, 2023. It is now read-only.

Commit

Permalink
fix(text)
Browse files Browse the repository at this point in the history
Allow for no study description; set up volume view to Anterior in simple case.
  • Loading branch information
DominionSoftware committed Oct 3, 2018
1 parent ea3c16b commit aa2a290
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 4 deletions.
17 changes: 13 additions & 4 deletions multiplanarReformatting/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,10 @@ var MultiplanarReformattingPlugin = class MultiplanarReformattingPlugin extends
let topRightParent = document.querySelector('#'+viewDirection+"TopRight");

const topRightMap = new Map();
let studyDescription = displaySet.images[0]._study.studyDescription.replace(/\^/g, " ");
let studyDescription = "";
if (displaySet.images[0]._study.studyDescription){
studyDescription = displaySet.images[0]._study.studyDescription.replace(/\^/g, " ");
}
let studyDate = displaySet.images[0]._study.studyDate;

let seriesYear = parseInt(studyDate.substr(0,4),10);
Expand Down Expand Up @@ -88,7 +91,7 @@ var MultiplanarReformattingPlugin = class MultiplanarReformattingPlugin extends

}

setBottomRightText(viewDirection,displaySet,window,level){
static setBottomRightText(viewDirection,displaySet,window,level){
let botRightParent = document.querySelector('#'+viewDirection+"BotRight");
const botRightMap = new Map();
let compStr = displaySet.images[0]._data.lossyImageCompression === undefined ? "Lossless / Uncompressed" : ds.images[0]._data.lossyImageCompression;
Expand All @@ -104,18 +107,19 @@ var MultiplanarReformattingPlugin = class MultiplanarReformattingPlugin extends
* @param eventData
*/
updateViewportText(eventData){
debugger;
MultiplanarReformattingPlugin.setBottomLeftText(eventData.viewDirection, eventData.displaySet,eventData.sliceIndex,eventData.sliceCount);
MultiplanarReformattingPlugin.setTopLeftText(eventData.viewDirection,eventData.displaySet);
MultiplanarReformattingPlugin.setTopRightText(eventData.viewDirection,eventData.displaySet);
this.setBottomRightText(eventData.viewDirection,eventData.displaySet,eventData.window,eventData.level);
MultiplanarReformattingPlugin.setBottomRightText(eventData.viewDirection,eventData.displaySet,eventData.window,eventData.level);
}

/**
* Updates the window level text.
* @param eventData
*/
updateWindowLevelText(eventData){
this.setBottomRightText(eventData.viewDirection,eventData.displaySet,eventData.window,eventData.level);
MultiplanarReformattingPlugin.setBottomRightText(eventData.viewDirection,eventData.displaySet,eventData.window,eventData.level);
}


Expand Down Expand Up @@ -218,13 +222,18 @@ var MultiplanarReformattingPlugin = class MultiplanarReformattingPlugin extends
* @param displaySet
*/
setupViewport(div, viewportData, displaySet) {

const divParentElement = div.parentElement;
const { viewportIndex } = viewportData;
let { viewDirection } = viewportData.pluginData;

if (!displaySet) {
displaySet = OHIF.plugins.ViewportPlugin.getDisplaySet(viewportIndex);
}
// Reject image sets that are less than 20 images.
if (displaySet.images.length < 20){
throw new Error("Series has too few images for this plugin.");
}

const { VTKUtils } = window;
const genericRenderWindow = vtk.Rendering.Misc.vtkGenericRenderWindow.newInstance({
Expand Down
31 changes: 31 additions & 0 deletions volumeRendering/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,27 @@ var VolumeRenderingPlugin = class VolumeRenderingPlugin extends OHIF.plugins.Vie
}


orientCamera(camera,orientation){
switch (orientation){
case 'I':
break;
case 'S':
camera.elevation(-89.99); // TODO camera signularuty at -90???????
break;
case 'A':
break;
case 'P':
break;
case 'L':
break;
case 'R':
break;
default:
console.assert("unknown orientation");
break;
}
}

/**
* Overriden from base class. Sets up the viewport based on the viewportData and the displaySet.
* @param div
Expand Down Expand Up @@ -181,9 +202,15 @@ var VolumeRenderingPlugin = class VolumeRenderingPlugin extends OHIF.plugins.Vie
displaySet = OHIF.plugins.ViewportPlugin.getDisplaySet(viewportIndex);
}

// Reject image sets that are less than 20 images.
if (displaySet.images.length < 20){
div.innerHTML = "";
throw new Error("Series has too few images for this plugin.");
}
viewportWrapper.style.position = "relative";

const { VTKUtils } = window;

const imageDataObject = VTKUtils.getImageData(displaySet);

if (imageDataObject === null){
Expand Down Expand Up @@ -227,6 +254,10 @@ var VolumeRenderingPlugin = class VolumeRenderingPlugin extends OHIF.plugins.Vie

self.setupViewportText(viewportWrapper, viewDirection, displaySet);
self.updateViewportText(viewDirection, displaySet);

self.orientCamera(genericRenderWindow.getRenderer().getActiveCamera(),imageDataObject.orientation);
genericRenderWindow.getRenderWindow().render();

}

// Don't load data until the viewports etc are set up (above).
Expand Down

0 comments on commit aa2a290

Please sign in to comment.