class_docstr: A dataset class to generate circle poses.
class_docstr_tok: ["A","dataset","class","to","generate","circle","poses","."]
docstr: Get an item from the dataset.
  
  Args:
      idx (int): Index of the item to retrieve.
  
  Returns:
      dict: Data dictionary containing the following:
      - height (int): Height of the image.
      - width (int): Width of the image.
      - rays_o (torch.Tensor): Ray origins, shape [height, width, 3].
      - rays_d (torch.Tensor): Ray directions, shape [height, width, 3].
      - dir (torch.Tensor): View direction, shape [3].
      - mvp (torch.Tensor): Model-view-projection matrix, shape [4, 4].
      - azimuth (torch.Tensor): Azimuth angle, shape [1].
docstr_tok: ["Get","an","item","from","the","dataset",".","Args",":","idx","(","int",")",":","Index","of","the","item","to","retrieve",".","Returns",":","dict",":","Data","dictionary","containing","the","following",":","-","height","(","int",")",":","Height","of","the","image",".","-","width","(","int",")",":","Width","of","the","image",".","-","rays_o","(","torch.Tensor",")",":","Ray","origins",",","shape","[","height",",","width",",","3","]",".","-","rays_d","(","torch.Tensor",")",":","Ray","directions",",","shape","[","height",",","width",",","3","]",".","-","dir","(","torch.Tensor",")",":","View","direction",",","shape","[","3","]",".","-","mvp","(","torch.Tensor",")",":","Model-view-projection","matrix",",","shape","[","4",",","4","]",".","-","azimuth","(","torch.Tensor",")",":","Azimuth","angle",",","shape","[","1","]","."]
code: def __getitem__(
      self, idx: int
  ) -> Dict[str, Union[int, torch.Tensor]]:
      """Get an item from the dataset.
  
      Args:
          idx (int): Index of the item to retrieve.
  
      Returns:
          dict: Data dictionary containing the following:
          - height (int): Height of the image.
          - width (int): Width of the image.
          - rays_o (torch.Tensor): Ray origins, shape [height, width, 3].
          - rays_d (torch.Tensor): Ray directions, shape [height, width, 3].
          - dir (torch.Tensor): View direction, shape [3].
          - mvp (torch.Tensor): Model-view-projection matrix, shape [4, 4].
          - azimuth (torch.Tensor): Azimuth angle, shape [1].
      """
      # Initialize circle pose parameters
      thetas = torch.FloatTensor([self.default_polar]).to(self.device)
      phis = torch.FloatTensor([(idx / self.size) * 360]).to(
          self.device
      )
      radius = torch.FloatTensor([self.default_radius]).to(self.device)
  
      # Generate circle poses and directions
      poses, dirs = circle_poses(
          radius=radius,
          theta=thetas,
          phi=phis,
          angle_overhead=self.angle_overhead,
          angle_front=self.angle_front,
          return_dirs=True,
          device=self.device,
      )
  
      # Compute camera intrinsics
      intrinsics = self.camera.compute_intrinsics(
          fovx=self.default_fovx, fovy=self.default_fovy
      )
  
      # Compute projection matrix
      projection = self.camera.compute_projection_matrix(
          focal_x=intrinsics[0], focal_y=intrinsics[1]
      )
      mvp = projection @ torch.inverse(poses)  # [1, 4, 4]
  
      # Sample rays
      rays_o, rays_d = get_rays(
          poses=poses,
          intrinsics=intrinsics,
          height=self.height,
          width=self.width,
          device=poses.device,
      )
  
      # Compute azimuth delta
      delta_azimuth = phis - self.default_azimuth
      delta_azimuth[delta_azimuth > 180] -= 360  # range in [-180, 180]
  
      data = {
          "height": self.height,
          "width": self.width,
          "rays_o": rays_o,
          "rays_d": rays_d,
          "dir": dirs,
          "mvp": mvp,
          "azimuth": delta_azimuth,
      }
  
      return data
  
file_path: NeMo/nemo/collections/multimodal/data/nerf/circle_poses.py
imports: from typing import Dict, Union
  import numpy
  import torch
  from torch.utils.data import Dataset
  from nemo.collections.multimodal.data.nerf.cameras import PinholeCamera
  from nemo.collections.multimodal.data.nerf.utils import compute_look_at_vectors, construct_poses, get_rays, get_view_direction
label_desc: Use image node_id 3 for calling the CirclePosesDataset obj's underlying member method code with example usage: obj.__getitem__(idx) and returns: data