XelToFab
CLI Reference

xtf process

Process a scalar field into a mesh from the command line

Usage

xtf process [OPTIONS] INPUT_PATH

Process a scalar field into a mesh. The input field is loaded, run through the full pipeline (preprocessing, extraction, smoothing, repair, remeshing, decimation), and the resulting mesh is saved to the output path.

Arguments

ArgumentDescription
INPUT_PATHPath to the input scalar field file (must exist)

Options

OptionTypeDefaultDescription
-o, --outputPATH(required)Output mesh file path (format determined by extension: .stl, .obj, .ply)
--thresholdFLOAT0.5Field threshold [0-1] for binarization
--sigmaFLOAT1.0Gaussian smoothing sigma for preprocessing
-f, --field-nameTEXTNoneField/variable name to extract from input file (for .npz, .mat, .h5, etc.)
--shapeTEXTNoneGrid shape for flat data, e.g. 100x200 or 10x20x30
--field-typedensity|sdfdensityInput field type. Setting sdf enables smart defaults (direct extraction, no Gaussian smoothing).
--directflagFalseDirect extraction from continuous field (skip preprocessing)
--no-repairflagFalseDisable watertight mesh repair
--no-remeshflagFalseDisable isotropic remeshing
--no-decimateflagFalseDisable QEM mesh decimation
--smoothingtaubin|bilateraltaubinMesh smoothing algorithm. Use bilateral for feature-preserving smoothing
--extraction-methodmc|dc|surfnets|manifoldmcExtraction algorithm. With --field-type sdf, smart default switches to dc unless explicitly overridden
--vizflagFalseSave a comparison visualization (PNG) alongside the mesh

Smart defaults with --field-type sdf

When --field-type sdf is used, the following defaults change automatically unless explicitly overridden:

  • --direct is enabled (preprocessing is skipped)
  • --sigma is set to 0.0 (no Gaussian smoothing)
  • --extraction-method is set to dc (dual contouring for sharp features)
  • --smoothing is set to bilateral with 5 iterations (reduced to preserve DC sharp features)

You can still override these by explicitly passing --sigma 1.0 or omitting --direct.

Examples

Basic 3D processing

xtf process scalar_field.npy -o output.stl

Custom threshold and smoothing

xtf process field.npy -o mesh.obj --threshold 0.4 --sigma 1.5

MATLAB file with named variable

xtf process design_result.mat -o mesh.stl -f xPhys

CSV with shape specification

xtf process flat_data.csv -o mesh.stl --shape 10x20x30

SDF field (smart defaults)

xtf process sdf_field.npy -o mesh.stl --field-type sdf

Direct extraction from continuous field

xtf process field.npy -o mesh.stl --direct

With visualization output

xtf process field.npy -o mesh.stl --viz
# Saves mesh.stl and mesh.png

When --viz is used, a comparison PNG image is saved alongside the mesh at the same path with a .png extension.

Feature-preserving smoothing

xtf process field.npy -o mesh.stl --smoothing bilateral

Bilateral filtering preserves sharp structural features (corners, ridges) while smoothing flat surfaces. Useful when the design has distinct sharp edges that should not be blurred.

Skip decimation (preserve full polygon count)

xtf process field.npy -o mesh.stl --no-decimate

Dual contouring on SDF field

xtf process neural_sdf.npy -o mesh.stl --field-type sdf

Auto-selects DC extraction with bilateral smoothing (5 iterations) for sharp feature preservation.

Explicit manifold extraction

xtf process sdf_field.npy -o mesh.stl --extraction-method manifold --field-type sdf

Watertight output by design — repair stage is automatically skipped.

Skip all post-processing (raw extraction output)

xtf process field.npy -o mesh.stl --no-repair --no-remesh --no-decimate

Useful for debugging or when you need the raw extraction output without any mesh optimization.

Outline