class_docstr: The `VolumeLocator` class keeps track of the locations of the
  centers of the volume cells in the local volume coordinates as well as in
  the world coordinates for a voxel grid structure in 3D.
  
      Local coordinates:
          - Represent the locations of the volume cells in the local coordinate
            frame of the volume.
          - The center of the voxel indexed with `[·, ·, 0, 0, 0]` in the volume
            has its 3D local coordinate set to `[-1, -1, -1]`, while the voxel
            at index `[·, ·, depth_i-1, height_i-1, width_i-1]` has its
            3D local coordinate set to `[1, 1, 1]`.
          - The first/second/third coordinate of each of the 3D per-voxel
            XYZ vector denotes the horizontal/vertical/depth-wise position
            respectively. I.e the order of the coordinate dimensions in the
            volume is reversed w.r.t. the order of the 3D coordinate vectors.
          - The intermediate coordinates between `[-1, -1, -1]` and `[1, 1, 1]`.
            are linearly interpolated over the spatial dimensions of the volume.
          - Note that the convention is the same as for the 5D version of the
            `torch.nn.functional.grid_sample` function called with
            the same value of `align_corners` argument.
          - Note that the local coordinate convention of `VolumeLocator`
            (+X = left to right, +Y = top to bottom, +Z = away from the user)
            is *different* from the world coordinate convention of the
            renderer for `Meshes` or `Pointclouds`
            (+X = right to left, +Y = bottom to top, +Z = away from the user).
  
      World coordinates:
          - These define the locations of the centers of the volume cells
            in the world coordinates.
          - They are specified with the following mapping that converts
            points `x_local` in the local coordinates to points `x_world`
            in the world coordinates::
  
                  x_world = (
                      x_local * (volume_size - 1) * 0.5 * voxel_size
                  ) - volume_translation,
  
            here `voxel_size` specifies the size of each voxel of the volume,
            and `volume_translation` is the 3D offset of the central voxel of
            the volume w.r.t. the origin of the world coordinate frame.
            Both `voxel_size` and `volume_translation` are specified in
            the world coordinate units. `volume_size` is the spatial size of
            the volume in form of a 3D vector `[width, height, depth]`.
          - Given the above definition of `x_world`, one can derive the
            inverse mapping from `x_world` to `x_local` as follows::
  
                  x_local = (
                      (x_world + volume_translation) / (0.5 * voxel_size)
                  ) / (volume_size - 1)
  
          - For a trivial volume with `volume_translation==[0, 0, 0]`
            with `voxel_size=-1`, `x_world` would range
            from -(volume_size-1)/2` to `+(volume_size-1)/2`.
  
  Coordinate tensors that denote the locations of each of the volume cells in
  local / world coordinates (with shape `(depth x height x width x 3)`)
  can be retrieved by calling the `VolumeLocator.get_coord_grid()` getter with the
  appropriate `world_coordinates` argument.
  
  Internally, the mapping between `x_local` and `x_world` is represented
  as a `Transform3d` object `VolumeLocator._local_to_world_transform`.
  Users can access the relevant transformations with the
  `VolumeLocator.get_world_to_local_coords_transform()` and
  `VolumeLocator.get_local_to_world_coords_transform()`
  functions.
  
  Example coordinate conversion:
      - For a "trivial" volume with `voxel_size = 1.`,
        `volume_translation=[0., 0., 0.]`, and the spatial size of
        `DxHxW = 5x5x5`, the point `x_world = (-2, 0, 2)` gets mapped
        to `x_local=(-1, 0, 1)`.
      - For a "trivial" volume `v` with `voxel_size = 1.`,
        `volume_translation=[0., 0., 0.]`, the following holds::
  
              torch.nn.functional.grid_sample(
                  v.densities(),
                  v.get_coord_grid(world_coordinates=False),
                  align_corners=align_corners,
              ) == v.densities(),
  
          i.e. sampling the volume at trivial local coordinates
          (no scaling with `voxel_size`` or shift with `volume_translation`)
          results in the same volume.
docstr: Sets the internal representation of the transformation between the
  world and local volume coordinates by specifying
  `voxel_size` and `volume_translation`
  
  Args:
      **voxel_size**: Denotes the size of input voxels. Has to be one of:
          a) A scalar (square voxels)
          b) 3-tuple or a 3-list of scalars
          c) a Tensor of shape (3,)
          d) a Tensor of shape (minibatch, 3)
          e) a Tensor of shape (1,) (square voxels)
      **volume_translation**: Denotes the 3D translation of the center
          of the volume in world units. Has to be one of:
          a) 3-tuple or a 3-list of scalars
          b) a Tensor of shape (3,)
          c) a Tensor of shape (minibatch, 3)
          d) a Tensor of shape (1,) (square voxels)
docstr_tok: ["Sets","the","internal","representation","of","the","transformation","between","the","world","and","local","volume","coordinates","by","specifying","`","voxel_size","`","and","`","volume_translation","`","Args",":","*","*","voxel_size","*","*",":","Denotes","the","size","of","input","voxels",".","Has","to","be","one","of",":","a",")","A","scalar","(","square","voxels",")","b",")","3-tuple","or","a","3-list","of","scalars","c",")","a","Tensor","of","shape","(","3",",",")","d",")","a","Tensor","of","shape","(","minibatch",",","3",")","e",")","a","Tensor","of","shape","(","1",",",")","(","square","voxels",")","*","*","volume_translation","*","*",":","Denotes","the","3D","translation","of","the","center","of","the","volume","in","world","units",".","Has","to","be","one","of",":","a",")","3-tuple","or","a","3-list","of","scalars","b",")","a","Tensor","of","shape","(","3",",",")","c",")","a","Tensor","of","shape","(","minibatch",",","3",")","d",")","a","Tensor","of","shape","(","1",",",")","(","square","voxels",")"]
code: def _set_local_to_world_transform(
      self,
      voxel_size: _VoxelSize = 1.0,
      volume_translation: _Translation = (0.0, 0.0, 0.0),
  ):
      """
      Sets the internal representation of the transformation between the
      world and local volume coordinates by specifying
      `voxel_size` and `volume_translation`
  
      Args:
          **voxel_size**: Denotes the size of input voxels. Has to be one of:
              a) A scalar (square voxels)
              b) 3-tuple or a 3-list of scalars
              c) a Tensor of shape (3,)
              d) a Tensor of shape (minibatch, 3)
              e) a Tensor of shape (1,) (square voxels)
          **volume_translation**: Denotes the 3D translation of the center
              of the volume in world units. Has to be one of:
              a) 3-tuple or a 3-list of scalars
              b) a Tensor of shape (3,)
              c) a Tensor of shape (minibatch, 3)
              d) a Tensor of shape (1,) (square voxels)
      """
      # handle voxel size and center
      # here we force the tensors to lie on self.device
      voxel_size = self._handle_voxel_size(voxel_size, len(self))
      volume_translation = self._handle_volume_translation(
          volume_translation, len(self)
      )
      self._local_to_world_transform = (
          self._voxel_size_translation_to_transform(
              voxel_size, volume_translation, len(self)
          )
      )
  
imports: import copy
  from typing import List, Optional, Tuple, Union
  import torch
  from pytorch3d.common.compat import meshgrid_ij
  from pytorch3d.common.datatypes import Device, make_device
  from pytorch3d.transforms import Scale, Transform3d
  from .None import utils
label_desc: Use image node_id 11 for calling the VolumeLocator obj's underlying member method code with example usage: obj._set_local_to_world_transform(voxel_size, volume_translation) without return types