diff --git a/src/components/core/GlobalSettings/script.js b/src/components/core/GlobalSettings/script.js
index a7d02d4e..3117af59 100644
--- a/src/components/core/GlobalSettings/script.js
+++ b/src/components/core/GlobalSettings/script.js
@@ -7,8 +7,8 @@ import {
import { Events } from 'paraview-glance/src/constants';
const ORIENTATION_PRESETS = [
- { text: 'Axial/Coronal/Saggital', value: 'lps' },
{ text: 'XYZ', value: 'default' },
+ { text: 'LPS', value: 'lps' },
];
const AXIS_TYPES = [
@@ -83,7 +83,7 @@ export default {
backgroundColor: DEFAULT_BACKGROUND,
orientationAxis: true,
annotationOpacity: 1,
- orientationPreset: view ? view.getPresetToOrientationAxes() : 'lps',
+ orientationPreset: view ? view.getPresetToOrientationAxes() : 'default',
orientationPresets: ORIENTATION_PRESETS,
axisTypes: AXIS_TYPES,
axisType: view ? view.getOrientationAxesType() : 'arrow',
diff --git a/src/components/core/GlobalSettings/template.html b/src/components/core/GlobalSettings/template.html
index f258fa14..bcbbd5fd 100644
--- a/src/components/core/GlobalSettings/template.html
+++ b/src/components/core/GlobalSettings/template.html
@@ -75,7 +75,6 @@
dense
flat
hide-details
- :disabled="!orientationAxis || axisType != 'cube'"
v-model="orientationPreset"
:items="orientationPresets"
diff --git a/src/components/core/VtkView/constants.js b/src/components/core/VtkView/constants.js
index 2dca3d9a..d7c0c590 100644
--- a/src/components/core/VtkView/constants.js
+++ b/src/components/core/VtkView/constants.js
@@ -7,6 +7,13 @@ export const VIEW_TYPES = [
{ text: 'Orientation Z', value: 'View2D_Z:z' },
];
+export const VIEW_TYPES_LPS = [
+ { text: 'View 3D', value: 'View3D:default' },
+ { text: 'Saggital', value: 'View2D_Y:y' },
+ { text: 'Coronal', value: 'View2D_X:x' },
+ { text: 'Axial', value: 'View2D_Z:z' },
+];
+
export const VIEW_ORIENTATIONS = {
default: {
axis: 1,
diff --git a/src/components/core/VtkView/helper.js b/src/components/core/VtkView/helper.js
index 279c4c40..a885ccdf 100644
--- a/src/components/core/VtkView/helper.js
+++ b/src/components/core/VtkView/helper.js
@@ -66,6 +66,9 @@ function getView(proxyManager, viewType, container) {
// set background to transparent
view.setBackground(0, 0, 0, 0);
+
+ // FIXME: Use storage to choose defaults
+ view.setPresetToOrientationAxes('default');
}
if (container) {
@@ -78,6 +81,30 @@ function getView(proxyManager, viewType, container) {
// ----------------------------------------------------------------------------
+function updateViewsAnnotation(proxyManager) {
+ const hasImageData = proxyManager
+ .getSources()
+ .find((s) => s.getDataset().isA && s.getDataset().isA('vtkImageData'));
+ const views = proxyManager.getViews();
+
+ for (let i = 0; i < views.length; i++) {
+ const view = views[i];
+ view.setCornerAnnotation('se', '');
+ if (view.getProxyName().indexOf('2D') !== -1 && hasImageData) {
+ /* eslint-disable */
+ view.setCornerAnnotation(
+ 'nw',
+ 'CW ${colorWindow} - CL ${colorLevel}
Slice ${slice}'
+ );
+ /* eslint-enable */
+ } else {
+ view.setCornerAnnotation('nw', '');
+ }
+ }
+}
+
+// ----------------------------------------------------------------------------
+
function bindView(proxyManager, viewType, container) {
return getView(proxyManager, viewType, container);
}
@@ -90,4 +117,5 @@ export default {
getView,
getViewActions,
getNumberOfVisibleViews,
+ updateViewsAnnotation,
};
diff --git a/src/components/core/VtkView/script.js b/src/components/core/VtkView/script.js
index 65c0f6d9..7662a5e6 100644
--- a/src/components/core/VtkView/script.js
+++ b/src/components/core/VtkView/script.js
@@ -2,6 +2,7 @@ import { Events, Widgets } from 'paraview-glance/src/constants';
import {
DEFAULT_VIEW_TYPE,
VIEW_TYPES,
+ VIEW_TYPES_LPS,
VIEW_ORIENTATIONS,
} from 'paraview-glance/src/components/core/VtkView/constants';
@@ -137,7 +138,7 @@ function toggleCrop() {
this.isCropping = true;
// Add subscription to monitor crop change
- if (this.subscriptions.length === 2 && volumeRep.getCropFilter) {
+ if (this.subscriptions.length === 3 && volumeRep.getCropFilter) {
this.subscriptions.push(
volumeRep
.getCropFilter()
@@ -231,6 +232,22 @@ function singleView() {
});
}
+// ----------------------------------------------------------------------------
+
+function orientationLabels() {
+ return this.view.getPresetToOrientationAxes() === 'lps'
+ ? ['L', 'P', 'S']
+ : ['X', 'Y', 'Z'];
+}
+
+// ----------------------------------------------------------------------------
+
+function viewTypes() {
+ return this.view.getPresetToOrientationAxes() === 'lps'
+ ? VIEW_TYPES_LPS
+ : VIEW_TYPES;
+}
+
// ----------------------------------------------------------------------------
// Vue LifeCycle
// ----------------------------------------------------------------------------
@@ -255,6 +272,10 @@ function onMounted() {
() => window.removeEventListener('resize', this.resizeCurrentView),
this.proxyManager.onProxyRegistrationChange(() => {
// When proxy change, just re-render widget
+ viewHelper.updateViewsAnnotation(this.proxyManager);
+ this.$forceUpdate();
+ }).unsubscribe,
+ this.view.onModified(() => {
this.$forceUpdate();
}).unsubscribe,
];
@@ -312,7 +333,6 @@ export default {
data() {
return {
palette: BACKGROUND,
- viewTypes: VIEW_TYPES,
backgroundSheet: false,
isCropping: false,
inAnimation: false,
@@ -329,6 +349,7 @@ export default {
getAvailableActions,
onBeforeDestroy,
onMounted,
+ orientationLabels,
quadView,
resetCamera,
resetCrop,
@@ -339,6 +360,7 @@ export default {
splitView,
toggleCrop,
updateOrientation,
+ viewTypes,
},
mounted() {
this.$nextTick(this.onMounted);
diff --git a/src/components/core/VtkView/template.html b/src/components/core/VtkView/template.html
index 83f6c72c..538d32d7 100644
--- a/src/components/core/VtkView/template.html
+++ b/src/components/core/VtkView/template.html
@@ -42,7 +42,7 @@
- Rotate left 90°
+ Rotate camera left 90°
- Rotate right 90°
+ Rotate camera right 90°
- Reset Camera to Orientation X
+ Reset Camera to Orientation {{orientationLabels()[0]}}
- X
+ {{orientationLabels()[0]}}
- Reset Camera to Orientation Y
+ Reset Camera to Orientation {{orientationLabels()[1]}}
- Y
+ {{orientationLabels()[1]}}
- Reset Camera to Orientation Z
+ Reset Camera to Orientation {{orientationLabels()[2]}}
- Z
+ {{orientationLabels()[2]}}
@@ -131,7 +131,7 @@
flat
dark
:class="$style.viewTypeSelector"
- :items="viewTypes"
+ :items="viewTypes()"
:value="viewType"
@change="changeViewType"
/>