Orthogonal slices
import { sliceScientificVolume } from 'purejsimage/scientific'
const xy = sliceScientificVolume(volume, { axis: 'xy', index: 42, c: 0, t: 0 })
const xz = sliceScientificVolume(volume, { axis: 'xz', index: 80, c: 0, t: 0 })
const yz = sliceScientificVolume(volume, { axis: 'yz', index: 120, c: 0, t: 0 })XY fixes Z. XZ fixes Y. YZ fixes X. The returned dataset has one Z plane and one channel. It can be passed directly to measureScientificPlane() or renderScientificPlane().
Physical spacing
XY retains physical X and Y spacing. XZ uses source X and Z spacing. YZ uses source Y and Z spacing. Missing source spacing remains undefined. The same mapping applies to finite origin components.
Z projections
import { projectScientificVolume } from 'purejsimage/scientific'
const maximum = projectScientificVolume(volume, { axis: 'z', mode: 'max' })
const minimum = projectScientificVolume(volume, { axis: 'z', mode: 'min' })
const mean = projectScientificVolume(volume, {
axis: 'z', mode: 'mean', rowsPerBlock: 8,
})Maximum and minimum preserve a floating-point source type. Integer inputs promote to float64 so a no-valid-sample result remains representable. Mean always uses float64. NaN, infinity, and the declared source no-data value are ignored when another valid sample contributes. An output location with no valid contributing sample is NaN.
Memory behavior
XY delegates to the source plane reader. XZ retains one requested X row while it visits contributing Z planes. YZ retains one requested Y row and requests a one-pixel-wide source column. Projection retains only rowsPerBlock output rows, one float64 accumulator per output sample, and one uint32 count per output sample. No helper allocates width × height × depth samples.
Measurement
const stats = await measureScientificPlane(maximum, {
plane: { z: 0, c: 0, t: 0 },
range: { mode: 'dataset' },
statistics: {
mean: true,
standardDeviation: true,
invalidSamples: true,
percentiles: [1, 50, 99],
histogram: { bins: 256 },
},
})Mean and population standard deviation use a numerically stable running calculation. Percentiles use bounded systematic sampling and are approximate when the sample budget is smaller than the selected plane. A histogram uses an explicit range or the measured range and stores only its requested bins.
Current boundary
Projection currently supports the Z axis. Arbitrary oblique slices, interpolation between planes, segmentation, and GPU volume rendering are not implemented.
Scientific Raster Explorer · MRC guide · FITS guide · OME-TIFF · API