copper3d / Modules / Utils/segmentation/core/GaussianSmoother / GaussianSmoother
Class: GaussianSmoother
Utils/segmentation/core/GaussianSmoother.GaussianSmoother
Table of contents
Constructors
Methods
Constructors
constructor
• new GaussianSmoother()
Methods
convolve1D
▸ Static Private convolve1D(data, width, height, depth, axis, kernel): void
In-place single-axis convolution with zero-padding at boundaries.
Uses a 3-segment approach: left boundary (with bounds check), middle interior (branch-free, ~95% of work), right boundary (with bounds check). This eliminates per-element branching in the hot inner loop.
Parameters
| Name | Type | Description |
|---|---|---|
data | Float32Array | Flat float buffer (width × height × depth). |
width | number | X dimension. |
height | number | Y dimension. |
depth | number | Z dimension. |
axis | number | 0 = X, 1 = Y, 2 = Z. |
kernel | Float32Array | 1D convolution kernel (odd length). |
Returns
void
Defined in
src/Utils/segmentation/core/GaussianSmoother.ts:147
gaussianSmooth3D
▸ Static gaussianSmooth3D(volume, channel, sigma?, spacing?): void
Smooth a single label channel in-place using separable 3D Gaussian blur.
Steps:
- Extract — create a Float32Array with 1.0 where voxel === channel, 0.0 elsewhere.
- Blur — apply separable Gaussian (X → Y → Z) on the float buffer.
- Threshold — binarize at 0.5.
- Write back — overwrite/erase voxels according to the thresholded result.
Parameters
| Name | Type | Default value | Description |
|---|---|---|---|
volume | MaskVolume | undefined | The MaskVolume to operate on (modified in-place). |
channel | number | undefined | The label value to smooth (must be > 0). |
sigma | number | 1.0 | Base Gaussian sigma in voxel units (default 1.0). |
spacing? | [number, number, number] | undefined | Optional voxel spacing [sx, sy, sz]. When provided, per-axis sigma is computed as sigma / spacing[axis] so that the physical smoothing radius is isotropic. |
Returns
void
Defined in
src/Utils/segmentation/core/GaussianSmoother.ts:33
generateKernel1D
▸ Static generateKernel1D(sigma): Float32Array
Generate a normalized 1D Gaussian kernel truncated at ±3σ.
Parameters
| Name | Type | Description |
|---|---|---|
sigma | number | Standard deviation (in voxels). Must be > 0. |
Returns
Float32Array
Normalized Float32Array of odd length.