Skip to content

Commit 0d7da9e

Browse files
committed
test(volume-rendering): render smaller volumes in fitted-default specs
Each volume load in these specs renders several full 3D frames, and in software rendering a frame of a 64-voxel cube takes about 2.5x as long as a 32-voxel one. Two 64-voxel loads in one test exceeded the 90s limit on slower Linux runners. Shapes now scale with the cube size.
1 parent 9de9bbc commit 0d7da9e

1 file changed

Lines changed: 12 additions & 7 deletions

File tree

‎tests/specs/volume-modality-presets.e2e.ts‎

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,8 @@ async function expectVisibleVolume(name: string) {
217217
}
218218

219219
describe('grayscale default fitted to the data', () => {
220-
const SIZE = 64;
220+
// Software-rendered 3D frames on CI cost time in proportion to volume depth.
221+
const SIZE = 32;
221222
const coordinates = (index: number) => [
222223
index % SIZE,
223224
Math.floor(index / SIZE) % SIZE,
@@ -228,8 +229,8 @@ describe('grayscale default fitted to the data', () => {
228229
const name = 'fitted-untagged-hu';
229230
const voxels = floatVoxels(SIZE, (index) => {
230231
const radius = Math.hypot(...coordinates(index).map((c) => c - SIZE / 2));
231-
if (radius < 8) return 700;
232-
return radius < 24 ? 40 : -1024;
232+
if (radius < SIZE / 8) return 700;
233+
return radius < (3 * SIZE) / 8 ? 40 : -1024;
233234
});
234235
await openWith3DLayout(
235236
writeNrrd(name, nrrd([], 'float', SIZE), voxels),
@@ -243,7 +244,9 @@ describe('grayscale default fitted to the data', () => {
243244
const name = 'fitted-sparse';
244245
const voxels = floatVoxels(SIZE, (index) => {
245246
if (index === 0) return 1e6;
246-
const inBlock = coordinates(index).every((c) => c >= 28 && c < 36);
247+
const inBlock = coordinates(index).every(
248+
(c) => c >= SIZE / 2 - 4 && c < SIZE / 2 + 4
249+
);
247250
return inBlock ? 500 + (index % 7) : 0;
248251
});
249252
await openWith3DLayout(
@@ -257,7 +260,9 @@ describe('grayscale default fitted to the data', () => {
257260
it('renders the brightest voxels opaque, so a binary mask face is solid', async () => {
258261
const name = 'fitted-binary';
259262
const voxels = floatVoxels(SIZE, (index) =>
260-
coordinates(index).every((c) => c >= 16 && c < 48) ? 1 : 0
263+
coordinates(index).every((c) => c >= SIZE / 4 && c < (3 * SIZE) / 4)
264+
? 1
265+
: 0
261266
);
262267
await openWith3DLayout(
263268
writeNrrd(name, nrrd([], 'float', SIZE), voxels),
@@ -288,8 +293,8 @@ describe('grayscale default fitted to the data', () => {
288293
it('fits an MR preset to the intensity scale', async () => {
289294
const shell = (scale: number) => (index: number) => {
290295
const radius = Math.hypot(...coordinates(index).map((c) => c - SIZE / 2));
291-
if (radius < 8) return 300 * scale;
292-
return radius < 24 ? 100 * scale : 0;
296+
if (radius < SIZE / 8) return 300 * scale;
297+
return radius < (3 * SIZE) / 8 ? 100 * scale : 0;
293298
};
294299
const rendered = [];
295300
for (const scale of [1, 10]) {

0 commit comments

Comments
 (0)