code: def process_scene(s, args):
      scene_name = s["name"]
      tmp_dir = os.path.join(dataset_scenes_dir, scene_name, "_tmp")
      detail_dir = os.path.join(
          dataset_scenes_dir, scene_name, "_detail"
      )
      images_dir = os.path.join(
          dataset_scenes_dir, scene_name, "images"
      )
  
      metadata_cameras_csv_file = os.path.join(
          detail_dir, "metadata_cameras.csv"
      )
      df = pd.read_csv(metadata_cameras_csv_file)
  
      if args.camera_names is not None:
          cameras = [
              c
              for c in df.to_records()
              if fnmatch.fnmatch(c["camera_name"], args.camera_names)
          ]
      else:
          cameras = df.to_records()
  
      for c in cameras:
          camera_name = c["camera_name"]
  
          print(
              "[HYPERSIM: DATASET_GENERATE_HDF5_FROM_VRIMG] For scene "
              + scene_name
              + ", generating HDF5 files for camera "
              + camera_name
              + "..."
          )
  
          #
          # generate HDF5 files for geometry render
          #
  
          if args.render_pass is None or args.render_pass == "geometry":
              if args.frames is not None:
                  in_vrimg_files = (
                      '"'
                      + os.path.abspath(
                          os.path.join(
                              images_dir,
                              in_scene_fileroot
                              + "_"
                              + camera_name
                              + "_geometry",
                              "frame." + args.frames + ".vrimg",
                          )
                      )
                      + '"'
                  )
              else:
                  in_vrimg_files = (
                      '"'
                      + os.path.abspath(
                          os.path.join(
                              images_dir,
                              in_scene_fileroot
                              + "_"
                              + camera_name
                              + "_geometry",
                              "frame.*.vrimg",
                          )
                      )
                      + '"'
                  )
  
              in_camera_trajectory_dir = os.path.abspath(
                  os.path.join(detail_dir, camera_name)
              )
              in_metadata_nodes_file = os.path.abspath(
                  os.path.join(detail_dir, "metadata_nodes.csv")
              )
              in_metadata_scene_file = os.path.abspath(
                  os.path.join(detail_dir, "metadata_scene.csv")
              )
              out_hdf5_dir = os.path.abspath(
                  os.path.join(
                      images_dir,
                      in_scene_fileroot
                      + "_"
                      + camera_name
                      + "_geometry_hdf5",
                  )
              )
              out_preview_dir = os.path.abspath(
                  os.path.join(
                      images_dir,
                      in_scene_fileroot
                      + "_"
                      + camera_name
                      + "_geometry_preview",
                  )
              )
              tmp_dir_ = os.path.abspath(tmp_dir)
  
              current_source_file_path = (
                  path_utils.get_current_source_file_path(
                      frame=inspect.currentframe()
                  )
              )
              cwd = os.getcwd()
              os.chdir(current_source_file_path)
  
              cmd = (
                  _system_config.python_bin
                  + " generate_hdf5_from_vrimg.py"
                  + " --in_vrimg_files "
                  + in_vrimg_files
                  + " --in_camera_trajectory_dir "
                  + in_camera_trajectory_dir
                  + " --in_metadata_nodes_file "
                  + in_metadata_nodes_file
                  + " --in_metadata_scene_file "
                  + in_metadata_scene_file
                  + " --out_hdf5_dir "
                  + out_hdf5_dir
                  + " --out_preview_dir "
                  + out_preview_dir
                  + " --tmp_dir "
                  + tmp_dir_
                  + " --render_pass geometry"
              )
              print("")
              print(cmd)
              print("")
              retval = os.system(cmd)
              assert retval == 0
  
              os.chdir(cwd)
  
          #
          # generate HDF5 files for final render
          #
  
          if args.render_pass is None or args.render_pass == "final":
              if args.frames is not None:
                  in_vrimg_files = (
                      '"'
                      + os.path.abspath(
                          os.path.join(
                              images_dir,
                              in_scene_fileroot
                              + "_"
                              + camera_name
                              + "_final",
                              "frame." + args.frames + ".vrimg",
                          )
                      )
                      + '"'
                  )
              else:
                  in_vrimg_files = (
                      '"'
                      + os.path.abspath(
                          os.path.join(
                              images_dir,
                              in_scene_fileroot
                              + "_"
                              + camera_name
                              + "_final",
                              "frame.*.vrimg",
                          )
                      )
                      + '"'
                  )
  
              out_hdf5_dir = os.path.abspath(
                  os.path.join(
                      images_dir,
                      in_scene_fileroot
                      + "_"
                      + camera_name
                      + "_final_hdf5",
                  )
              )
              out_preview_dir = os.path.abspath(
                  os.path.join(
                      images_dir,
                      in_scene_fileroot
                      + "_"
                      + camera_name
                      + "_final_preview",
                  )
              )
              tmp_dir_ = os.path.abspath(tmp_dir)
  
              if args.denoise:
                  denoise_arg = " --denoise"
              else:
                  denoise_arg = ""
  
              current_source_file_path = (
                  path_utils.get_current_source_file_path(
                      frame=inspect.currentframe()
                  )
              )
              cwd = os.getcwd()
              os.chdir(current_source_file_path)
  
              cmd = (
                  _system_config.python_bin
                  + " generate_hdf5_from_vrimg.py"
                  + " --in_vrimg_files "
                  + in_vrimg_files
                  + " --out_hdf5_dir "
                  + out_hdf5_dir
                  + " --out_preview_dir "
                  + out_preview_dir
                  + " --tmp_dir "
                  + tmp_dir_
                  + " --render_pass final"
                  + denoise_arg
              )
              print("")
              print(cmd)
              print("")
              retval = os.system(cmd)
              assert retval == 0
  
              os.chdir(cwd)
  
file_path: ml-hypersim/code/python/tools/dataset_generate_hdf5_from_vrimg.py
imports: from pylab import *
  import argparse
  import fnmatch
  import inspect
  import os
  import pandas
  import path_utils
  import _system_config
  import _dataset_config
label_desc: Use image node_id 1 for calling a global function with example usage: process_scene(s, args) without return types