ndio/convert/volume.py
def from_voxels(voxels):
    """
    Converts a voxel list to an ndarray.

    Arguments:
        voxels (tuple[]): A list of coordinates indicating coordinates of
            populated voxels in an ndarray.

    Returns:
        numpy.ndarray The result of the transformation.
    """
    dimensions = len(voxels[0])

    for d in range(len(dimensions)):
        size.append(max([i[d] for i in voxels]))

    result = numpy.zeros(dimensions)

    for v in voxels:
        result[v] = 1

    return result
def from_voxels(voxels):
    """
    Converts a voxel list to an ndarray.

    Arguments:
        voxels (tuple[]): A list of coordinates indicating coordinates of
            populated voxels in an ndarray.

    Returns:
        numpy.ndarray The result of the transformation.
    """
    dimensions = len(voxels[0])

    for d in range(len(dimensions)):
        size.append(max([i[d] for i in voxels]))

    result = numpy.zeros(dimensions)

    for v in voxels:
        result[v] = 1

    return result
Converts a voxel list to an ndarray.

    Arguments:
        voxels (tuple[]): A list of coordinates indicating coordinates of
            populated voxels in an ndarray.

    Returns:
        numpy.ndarray The result of the transformation.