sqzc3d API reference
Applies to sqzc3d v0.4.x (ABI SQZC3D_ABI_VERSION=4).
Headers
include/sqzc3d.h: public C APIinclude/sqzc3d_types.h: shared scalar and status typesinclude/sqzc3d_easy.h: lightweight C++ convenience helpers
Initialization helpers
API |
Purpose |
|---|---|
|
Fill |
|
Fill |
|
Preset for streaming full-frame point reads. |
|
Preset for streaming with explicit user point selection. |
|
Preset for window analysis with residual gate default. |
|
Preset for interpolation-friendly window reads. |
|
Fill bundle-load options with safe defaults. |
|
Fill an error-detail struct with zeros/defaults. |
|
Return the semantic version string. |
|
Return the ABI version integer. |
Default behavior notes:
Option structs must set
struct_size == sizeof(struct); usesqzc3d_default_*_opt(...)to initialize.sqzc3d_default_build_opt(...)materializes analogs by default (analog_enable = sqzc3d_ANALOG_EN_ON).sqzc3d_build_opt_t::target_unitoptionally converts materializedchunk->points_xyztomm,cm,m, orkm.NULL/empty keeps source units.When
analog_enable = sqzc3d_ANALOG_EN_AUTO,sqzc3d_build_chunksenforcesanalog_size_soft_limit_bytes(default500 MiB) and fails withsqzc3d_STATUS_INVALID_ARGUMENTif the projected analog payload exceeds the limit.
Life-cycle
API |
Purpose |
|---|---|
|
Open C3D from file path. |
|
Open C3D from memory buffer. |
|
Release decoder handle. |
|
Retrieve last API error text or structured detail. |
Notes:
sqzc3d_open_memorycopies the input bytes into decoder-owned memory and reads from that memory source. The caller may release or mutate the input buffer after the call returns. This is not a zero-copy borrowed-buffer API.Decoder and chunk handles are not internally synchronized. Use a given handle from one thread at a time, or guard concurrent API calls with external synchronization.
sqzc3d_last_error(NULL)andsqzc3d_last_error_detail(NULL, ...)report the last error on the current thread. This is useful whensqzc3d_open_file/sqzc3d_open_memoryfails before returning a decoder handle.
In
SQZC3D_WITH_EZC3D=OFF,sqzc3d_open_file,sqzc3d_open_memory,sqzc3d_build_chunksreturnsqzc3d_STATUS_NOT_IMPLEMENTEDand keepsqzc3d_get_features()authoritative.
Chunk building and query
API |
Purpose |
|---|---|
|
Parse selected frame/point/analog ranges into a chunk object. |
|
Release chunk resources. |
|
Access chunk shape. |
|
Optional chunk-local -> source-total point index mapping (when available). |
|
Optional |
|
Optional time-axis metadata (source first/last frame, rates, window origins). |
|
Map labels to indices. |
|
Build point views by frame, index list, or selected frame+points. |
|
Build analog views by sample range or channel list. |
Chunk point payload:
chunk->points_xyz: frame-major[T][P][3]; converted bytarget_unitwhen requested.chunk->points_valid: frame-major[T][P].chunk->points_residual: frame-major[T][P]; raw decoded residual in source point units.chunk->residual_nscalar:T * Pwhen residual storage is available.Unit metadata:
point_units_per_meter,target_units_per_meter,residual_units_per_meter, andpoint_units_source.
Residual validity policy:
Default
sqzc3d_VALID_POLICY_FINITE_XYZmarks points valid from finite xyz only.sqzc3d_VALID_POLICY_FINITE_XYZ_AND_RESIDUAL_GATEadditionally appliesresidual_gate_mm.residual_gate_mmis always expressed in millimeters; sqzc3d converts the threshold to residual source units before comparing.points_residualremains readable regardless of valid policy and is never scaled bytarget_unit.
View lifetime:
sqzc3d_points_view_tborrowssqzc3d_chunk_tstorage; the view must not outlive the source chunk.Non-contiguous point views also borrow the caller-provided
point_indicesarray.sqzc3d_analogs_view_tfollows the same rule for chunk analog storage and caller-providedchannel_indices.
Bundle persistence
API |
Purpose |
|---|---|
|
Write |
|
Load persisted bundle into chunk. |
|
Strict-load variant with strict flag. |
Type-group metadata and default layout
chunk->type_group_names: group names (lengthchunk->n_type_groups).chunk->type_group_starts: prefix-sum offsets lengthn_type_groups + 1.chunk->type_group_indices: flattened group indices in the chunk-local point index space[0..n_points);indices[type_group_starts[i]..type_group_starts[i+1])are indices intochunk->point_labelsfortype_group_names[i].Optional:
sqzc3d_chunk_point_indices_total()provides a chunk-local -> source-total mapping when available.
In v0.x the default points layout is fixed:
points_layout = sqzc3d_POINTS_LAYOUT_FRAME_MAJORpoints_pack = sqzc3d_POINTS_PACK_AOS_XYZ_VALIDDefault easy layer contracts:
PointWindowis frame-major, AoS XYZ;validandresidualare frame-major [T][K].points_xyz_shape = [n_frames][n_points][3](contiguous)points_xyz_stride = [n_points*3, 3, 1]points_valid_shape = [n_frames][n_points](contiguous)points_valid_stride = [n_points, 1]points_residual_shape = [n_frames][n_points](contiguous)points_residual_stride = [n_points, 1]
Default analog layout in v0.x is channel-major
(C, N):analog_shape = [n_analogs][n_frames*n_analog_by_frame](contiguous)analog_stride = [n_frames*n_analog_by_frame, 1]
Feature and capability
API |
Purpose |
|---|---|
|
Read runtime availability bits. |
In practice this is the first call to decide whether C3D parsing and analog APIs are enabled before invoking feature-gated paths.
Easy API
Header-only helpers in include/sqzc3d_easy.h:
sqzc3d::MakeFrameWindowBuildOpt/sqzc3d::ReadPointsWindowBuild a windowed frame-range chunk with a chosen preset.
sqzc3d::ReadPointsWindowByLabelsLabel-driven windowing.
sqzc3d::FrameMajorPointsViewConvert chunk pointer to frame-major AoS view with
[frame][point][xyz]shape.
sqzc3d::AnalogSamplesViewConvert chunk pointer to analog view with channel-major
(C, N)layout.
sqzc3d::FrameMajorAnalogViewTCSProvide a non-contiguous (strided) frame-major view
(T, C, S)over the underlying(C, N)storage.
sqzc3d::PointIndicesFromTypeGroupsConvert type-group names to a flat chunk-local point index list.
Default filter semantics: missing TYPE_GROUPS metadata => no-op (all points); missing group name => empty set.
sqzc3d::PointIndicesFromTypeGroupsStrictStrict variant with explicit error signaling (returns a
sqzc3d_STATUS_*code).
sqzc3d::ChunkQuery/sqzc3d::ChunkRecipeMinimal AND-only chunk-local filtering helpers (bound to a chunk; recipes are reusable).
sqzc3d::ReorderFrameMajorToPointMajorReorder helper for consumers requiring point-major layout.
Status and enums
Return codes are C-style ints from
sqzc3d_types.h:sqzc3d_STATUS_SUCCESSsqzc3d_STATUS_INVALID_ARGUMENTsqzc3d_STATUS_DIMENSION_MISMATCHsqzc3d_STATUS_NOT_IMPLEMENTEDsqzc3d_STATUS_INTERNAL_ERROR
Important enum families:
input type:
sqzc3d_FILE,sqzc3d_MEMORYselection mode: indices/labels/all
read policy:
AUTO,DENSE,SPARSEvalid policy:
sqzc3d_VALID_POLICY_FINITE_XYZ,sqzc3d_VALID_POLICY_FINITE_XYZ_AND_RESIDUAL_GATE
Notes
API is C89-compatible (
extern "C"available for C++).All non-
constout-parameters are expected writable by caller.Resources allocated by this library must be released with corresponding
freeAPIs above.Public residual payload is available as raw source-unit decoded residual. Camera masks are not yet public payload.
Python API
Python bindings are implemented via pybind11.
High-level Python exports:
sqzc3d.version()sqzc3d.abi_version()sqzc3d.features()sqzc3d.read(...) -> sqzc3d.View(easy layer)sqzc3d.View(easy layer)sqzc3d.Recipe(alias ofsqzc3d.ChunkRecipe)sqzc3d.Decodersqzc3d.Chunksqzc3d.ChunkQuery/sqzc3d.ChunkRecipe(AND-only chunk-local filtering)sqzc3d.type_group_indices(chunk, group_names, strict=False)sqzc3d.load_bundle(path: str, strict: bool = True)sqzc3d.export_bundle(out_dir: str, chunk: sqzc3d.Chunk)
Easy layer
Recommended for most users.
read:
sqzc3d.read(source, *, start_frame=0, frame_count=-1, points=None, analogs=None, analog_range=None, label_norm=..., recipe=None, target_unit=None) -> View
Selector semantics (Python):
None= default (ALL)[]= empty selection
View:
Selection state (labels-first):
view.point_labels(None | list[str])view.analog_labels(None | list[str])view.type_groups(list[str])
Data (properties):
view.points/view.points_validview.points_residualview.analogs/view.analogs_valid
Label accessors:
view.point["LANK"]/view.point_valid["LANK"]view.point_residual["LANK"]view.analog["EMG1"]/view.analog_valid["EMG1"]
Metadata:
view.meta(flat dict)view.meta_tree(EZ parameter tree when available; preserved in bundles;SQZC3D_WITH_EZC3D=ONis required to extract it from C3D)
Advanced escape hatch:
view._chunk(pybindChunk; indices/masks/etc are considered advanced)
Notes:
The easy layer is labels-only by design. If you already have indices, use the core API and slice arrays directly.
Decoder:
Decoder(path, label_norm=sqzc3d.SQZC3D_LABEL_NORM_EXACT)Decoder.read(start_frame=0, frame_count=-1, points=None, analogs=None, analog_range=None, target_unit="")Decoder.close()Decoder.source_path(read-only)Decoder.closed(read-only bool)
Chunk:
chunk.points(selector=None, copy=True) -> (values, valid)chunk.residual(selector=None, copy=True) -> residualchunk.analogs(selector=None, layout="CN", copy=True) -> (values, valid)layout="tcs"returns a non-contiguous frame-major view(T, C, S)over channel-major storage.
chunk.meta(dict)chunk.meta_tree(dict, parsed EZ parameter tree when available; preserved in bundles; available foropen_memoryas well)chunk.source_path(read-only)
Python payload semantics:
pointsvalues:float64, default frame-major shape(T, P, 3), valid mask(T, P)with dtypeuint8.residualvalues:float64, default frame-major shape(T, P), source point units.analogsvalues:layout="CN"default:(C, N)whereN = n_frames * n_analog_by_framelayout="tcs":(T, C, S)non-contiguous view helper
selector:
Nonemeans all[]means emptyintor list/tuple of ints for index selectionstror list/tuple of str for label selection
non-contiguous selection requires
copy=True;copy=Falsecurrently raisesRuntimeErrorand avoids hidden conversions.