# Voxelize¶

This module provides a complicated algorithm for making voxels out of regularly gridded points. Considering that this algorithm is rather complex, we are keeping it in its own module until we can simplify it, clean up the code, and make it capable of handling non-uniformly gridded points

## Voxelize Points¶

class PVGeo.filters.voxelize.VoxelizePoints(**kwargs)[source]

This makes a vtkUnstructuredGrid of scattered points given voxel sizes as input arrays. This assumes that the data is at least 2-Dimensional on the XY Plane.

static AddCellData(grid, arr, name)[source]

Add a NumPy array as cell data to the given grid input

AddFieldData(grid)[source]

An internal helper to add the recovered information as field data

EstimateUniformSpacing(x, y, z)[source]

This assumes that the input points make up some sort of uniformly spaced grid on at least an XY plane.

GetRecoveredAngle(degrees=True)[source]

Returns the recovered angle if set to recover the input grid. If the input points are rotated, then this angle will reflect a close approximation of that rotation.

Parameters: degrees (bool) – A flag on to return decimal degrees or radians.
GetSpacing()[source]

Get the cell spacings

PointsToGrid(xo, yo, zo, dx, dy, dz, grid=None)[source]

Convert XYZ points to a vtkUnstructuredGrid.

RequestData(request, inInfoVec, outInfoVec)[source]

Used by pipeline to generate output

SetDeltaX(dx)[source]

Set the X cells spacing

Parameters: dx (float or np.array(floats)) – the spacing(s) for the cells in the X-direction
SetDeltaY(dy)[source]

Set the Y cells spacing

Parameters: dy (float or np.array(floats)) – the spacing(s) for the cells in the Y-direction
SetDeltaZ(dz)[source]

Set the Z cells spacing

Parameters: dz (float or np.array(floats)) – the spacing(s) for the cells in the Z-direction
SetDeltas(dx, dy, dz)[source]

Set the cell spacings for each axial direction

Parameters: dx (float or np.array(floats)) – the spacing(s) for the cells in the X-direction dy (float or np.array(floats)) – the spacing(s) for the cells in the Y-direction dz (float or np.array(floats)) – the spacing(s) for the cells in the Z-direction
SetEstimateGrid(flag)[source]

Set a flag on whether or not to estimate the grid spacing/rotation

SetSafeSize(safe)[source]

A voxel size to use if a spacing cannot be determined for an axis

_CopyArrays(pdi, pdo)[source]

internal helper to copy arrays from point data to cell data in the voxels.