Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 | 98x 98x 7735x 217079x 98x 3x 3x 3x 30x 3000x 30000x 30000x 30000x 30x 3x 5x 5x 4x 5x 5x 5x 5x 19x 630x 23300x 5x 5x 23300x 23300x 5x 44x 44x 44x 44x 44x 44x 427x 42020x 429960x 427x 44x 2x 2x 2x 2x 20x 2000x 200000x 200000x 200000x 200000x 2x | import { colors } from './testUtils';
function getVerticalBarImage(rows, columns, barStart, barWidth) {
const pixelData = new Uint8Array(rows * columns);
for (let i = 0; i < rows; i++) {
for (let j = barStart; j < barStart + barWidth; j++) {
pixelData[i * columns + j] = 255;
}
}
return pixelData;
}
function getVerticalBarRGBImage(rows, columns, barStart, barWidth) {
let start = barStart;
const pixelData = new Uint8Array(rows * columns * 3);
colors.forEach((color) => {
for (let i = 0; i < rows; i++) {
for (let j = start; j < start + barWidth; j++) {
pixelData[(i * columns + j) * 3] = color[0];
pixelData[(i * columns + j) * 3 + 1] = color[1];
pixelData[(i * columns + j) * 3 + 2] = color[2];
}
}
start += barWidth;
});
return pixelData;
}
function getExactRegionVolume(
rows,
columns,
slices,
start_X,
start_Y,
start_Z,
end_X,
end_Y,
end_Z,
valueForSegmentIndex
) {
let value = valueForSegmentIndex;
if (!value) {
value = 1;
}
const yMultiple = rows;
const zMultiple = rows * columns;
// from [start_x, start_y, start_z] to [end_x, end_y, end_z]
// create all the indices that are in the region of interest
const indices = [];
for (let z = start_Z; z < end_Z; z++) {
for (let y = start_Y; y < end_Y; y++) {
for (let x = start_X; x < end_X; x++) {
indices.push([x, y, z]);
}
}
}
let pixelData;
pixelData = new Uint8Array(rows * columns * slices);
for (const index of indices) {
const [x, y, z] = index;
pixelData[z * zMultiple + y * yMultiple + x] = value;
}
return pixelData;
}
function getVerticalBarVolume(rows, columns, slices) {
const yMultiple = rows;
const zMultiple = rows * columns;
let barStart = 0;
const barWidth = Math.floor(rows / slices);
let pixelData;
pixelData = new Uint8Array(rows * columns * slices);
for (let z = 0; z < slices; z++) {
for (let i = 0; i < rows; i++) {
for (let j = barStart; j < barStart + barWidth; j++) {
pixelData[z * zMultiple + i * yMultiple + j] = 255;
}
}
barStart += barWidth;
}
return pixelData;
}
function getVerticalBarRGBVolume(rows, columns, slices) {
let index, pixelData;
const yMultiple = rows;
const zMultiple = rows * columns;
pixelData = new Uint8Array(rows * columns * slices * 3);
for (let z = 0; z < slices; z++) {
for (let i = 0; i < rows; i++) {
for (let j = 0; j < columns; j++) {
index = z * zMultiple + i * yMultiple + j;
pixelData[index * 3] = colors[z][0];
pixelData[index * 3 + 1] = colors[z][1];
pixelData[index * 3 + 2] = colors[z][2];
}
}
}
return pixelData;
}
export {
getVerticalBarImage,
getVerticalBarVolume,
getVerticalBarRGBImage,
getVerticalBarRGBVolume,
getExactRegionVolume,
};
|