Skip to content

Commit 273209e

Browse files
authored
Merge pull request niivue#1066 from niivue/issue1065
Orientation Label Regression
2 parents 88f6eee + 2b7bb76 commit 273209e

File tree

2 files changed

+28
-2
lines changed

2 files changed

+28
-2
lines changed

src/index.html

+18-1
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,23 @@
6565
<option value="2">Grid</option>
6666
<option value="3">Row</option>
6767
</select>
68-
<label for="renderingSelect">Rendering</label>
68+
<label for="renderingSelect">MultiplanarRendering</label>
6969
<select id="renderingSelect">
7070
<option value="0">Never</option>
7171
<option value="1">Always</option>
7272
<option value="2" selected>Auto</option>
7373
</select>
74+
<select id="sliceType">
75+
<option value="0">Axial</option>
76+
<option value="1">Coronal</option>
77+
<option value="2">Sagittal</option>
78+
<option value="4">Render</option>
79+
<option value="3" selected>Multiplanar</option>
80+
</select>
7481
<label for="equalCheck">EqualSize</label>
7582
<input type="checkbox" id="equalCheck" checked />
83+
<label for="cornerCheck">CornerText</label>
84+
<input type="checkbox" id="cornerCheck" unchecked />
7685
</header>
7786
<main id="canvas-container">
7887
<canvas id="gl1"></canvas>
@@ -132,6 +141,14 @@
132141
nv1.opts.multiplanarEqualSize = this.checked
133142
nv1.drawScene()
134143
}
144+
cornerCheck.onchange = function () {
145+
//nv1.opts.isCornerOrientationText = this.checked\
146+
nv1.setCornerOrientationText(this.checked)
147+
}
148+
sliceType.onchange = function () {
149+
let st = parseInt(document.getElementById("sliceType").value);
150+
nv1.setSliceType(st)
151+
}
135152
var volumeList1 = [{ url: "../demos/images/mni152.nii.gz" }];
136153
let defaults = {
137154
backColor: [0, 0, 0, 1],

src/niivue/index.ts

+10-1
Original file line numberDiff line numberDiff line change
@@ -8305,8 +8305,10 @@ export class Niivue {
83058305
elevation = isRadiolgical ? -90 : 90
83068306
}
83078307
const gl = this.gl
8308+
let isStretchToScreen = false
83088309
if (leftTopWidthHeight[2] === 0 || leftTopWidthHeight[3] === 0) {
83098310
// only one tile: stretch tile to fill whole screen.
8311+
isStretchToScreen = true
83108312
const pixPerMMw = gl.canvas.width / screen.fovMM[0]
83118313
const pixPerMMh = gl.canvas.height / screen.fovMM[1]
83128314
const pixPerMMmin = Math.min(pixPerMMw, pixPerMMh)
@@ -8465,6 +8467,10 @@ export class Niivue {
84658467
// no crossbars for mosaic view
84668468
this.drawCrosshairs3D(false, 0.15, obj.modelViewProjectionMatrix, true, this.opts.isSliceMM)
84678469
}
8470+
if (isStretchToScreen) {
8471+
// issue1065
8472+
this.drawSliceOrientationText(leftTopWidthHeight, axCorSag)
8473+
}
84688474
this.readyForSync = true
84698475
}
84708476

@@ -8491,7 +8497,10 @@ export class Niivue {
84918497
if (customMM === Infinity || customMM === -Infinity || axCorSag === SLICE_TYPE.RENDER) {
84928498
return
84938499
}
8494-
this.drawSliceOrientationText(leftTopWidthHeight, axCorSag, padLeftTop)
8500+
if (leftTopWidthHeight[2] !== 0 && leftTopWidthHeight[3] !== 0) {
8501+
// issue1065
8502+
this.drawSliceOrientationText(leftTopWidthHeight, axCorSag, padLeftTop)
8503+
}
84958504
}
84968505

84978506
// not included in public docs

0 commit comments

Comments
 (0)