parameters: (voxelgrids)
return_statement: return output
docstring: r""" Fills the internal structures in a voxelgrids grid. Used to fill holes
      and 'solidify' objects.
  
      .. Note::
          This function is not differentiable.
  
      Args:
          voxelgrids (torch.Tensor): binary voxelgrids of size (N, X, Y, Z) to be filled.
  
      Returns:
          torch.BoolTensor: filled, binary voxelgrids array
  
      Example:
          >>> voxelgrids = torch.Tensor(
          ...              [[[[0., 0., 0., 0., 0.],
          ...                 [0., 1., 1., 1., 1.],
          ...                 [0., 1., 1., 1., 1.],
          ...                 [0., 1., 1., 1., 1.]],
          ...                [[0., 0., 0., 0., 0.],
          ...                 [0., 1., 1., 1., 1.],
          ...                 [0., 1., 0., 0., 1.],
          ...                 [0., 1., 1., 1., 1.]],
          ...                [[0., 0., 0., 0., 0.],
          ...                 [0., 1., 1., 1., 1.],
          ...                 [0., 1., 1., 1., 1.],
          ...                 [0., 1., 1., 1., 1.]]]])
          >>> fill(voxelgrids)
          tensor([[[[False, False, False, False, False],
                    [False,  True,  True,  True,  True],
                    [False,  True,  True,  True,  True],
                    [False,  True,  True,  True,  True]],
          <BLANKLINE>
                   [[False, False, False, False, False],
                    [False,  True,  True,  True,  True],
                    [False,  True,  True,  True,  True],
                    [False,  True,  True,  True,  True]],
          <BLANKLINE>
                   [[False, False, False, False, False],
                    [False,  True,  True,  True,  True],
                    [False,  True,  True,  True,  True],
                    [False,  True,  True,  True,  True]]]])
docstring_summary: r""" Fills the internal structures in a voxelgrids grid. Used to fill holes
      and 'solidify' objects.
docstring_tokens: r Fills the internal structures in a voxelgrids grid . Used to fill holes and solidify objects .
function: def fill(voxelgrids):
      r""" Fills the internal structures in a voxelgrids grid. Used to fill holes
      and 'solidify' objects.
  
      .. Note::
          This function is not differentiable.
  
      Args:
          voxelgrids (torch.Tensor): binary voxelgrids of size (N, X, Y, Z) to be filled.
  
      Returns:
          torch.BoolTensor: filled, binary voxelgrids array
  
      Example:
          >>> voxelgrids = torch.Tensor(
          ...              [[[[0., 0., 0., 0., 0.],
          ...                 [0., 1., 1., 1., 1.],
          ...                 [0., 1., 1., 1., 1.],
          ...                 [0., 1., 1., 1., 1.]],
          ...                [[0., 0., 0., 0., 0.],
          ...                 [0., 1., 1., 1., 1.],
          ...                 [0., 1., 0., 0., 1.],
          ...                 [0., 1., 1., 1., 1.]],
          ...                [[0., 0., 0., 0., 0.],
          ...                 [0., 1., 1., 1., 1.],
          ...                 [0., 1., 1., 1., 1.],
          ...                 [0., 1., 1., 1., 1.]]]])
          >>> fill(voxelgrids)
          tensor([[[[False, False, False, False, False],
                    [False,  True,  True,  True,  True],
                    [False,  True,  True,  True,  True],
                    [False,  True,  True,  True,  True]],
          <BLANKLINE>
                   [[False, False, False, False, False],
                    [False,  True,  True,  True,  True],
                    [False,  True,  True,  True,  True],
                    [False,  True,  True,  True,  True]],
          <BLANKLINE>
                   [[False, False, False, False, False],
                    [False,  True,  True,  True,  True],
                    [False,  True,  True,  True,  True],
                    [False,  True,  True,  True,  True]]]])
      """
      if voxelgrids.ndim != 4:
          voxelgrids_dim = voxelgrids.ndim
          raise ValueError(f"Expected voxelgrids to have 4 dimensions " 
                           f"but got {voxelgrids_dim} dimensions.")
  
  
      dtype = voxelgrids.dtype
      device = voxelgrids.device
  
      if voxelgrids.is_cuda:
          raise NotImplementedError("Fill function is not supported on GPU yet.")
  
      voxelgrids = voxelgrids.data.cpu()
  
      output = []
      for i in range(voxelgrids.shape[0]): 
          on = ndimage.binary_fill_holes(voxelgrids[i])
          output.append(on)
  
      output = torch.tensor(output, dtype=torch.bool, device=device)
      return output
function_tokens: def fill ( voxelgrids ) : if voxelgrids . ndim != 4 : voxelgrids_dim = voxelgrids . ndim raise ValueError ( f"Expected voxelgrids to have 4 dimensions " f"but got {voxelgrids_dim} dimensions." ) dtype = voxelgrids . dtype device = voxelgrids . device if voxelgrids . is_cuda : raise NotImplementedError ( "Fill function is not supported on GPU yet." ) voxelgrids = voxelgrids . data . cpu ( ) output = [ ] for i in range ( voxelgrids . shape [ 0 ] ) : on = ndimage . binary_fill_holes ( voxelgrids [ i ] ) output . append ( on ) output = torch . tensor ( output , dtype = torch . bool , device = device ) return output