docstr: read raw fragment, rotate the raw fragment using the calibration and the given pose,
  pre transform raw_fragment and save it into fragments
docstr_tok: ["read","raw","fragment",",","rotate","the","raw","fragment","using","the","calibration","and","the","given","pose",",","pre","transform","raw_fragment","and","save","it","into","fragments"]
code: def _pre_transform_fragment(self, mod):
      """
      read raw fragment, rotate the raw fragment using the calibration and the given pose,
      pre transform raw_fragment and save it into fragments
      """
  
      if files_exist(
          [osp.join(self.processed_dir, mod, "fragment")]
      ):  # pragma: no cover
          return
  
      in_dir = osp.join(self.raw_dir, "dataset")
      list_drive = self.dict_seq[mod]
  
      for drive in list_drive:
          out_dir = osp.join(
              self.processed_dir,
              mod,
              "fragment",
              "{:02d}".format(drive),
          )
          makedirs(out_dir)
          path_frames = osp.join(
              in_dir, "sequences", "{:02d}".format(drive), "velodyne"
          )
          T_calib = read_calib_file(
              osp.join(
                  in_dir,
                  "sequences",
                  "{:02d}".format(drive),
                  "calib.txt",
              )
          )
          all_poses = np.genfromtxt(
              osp.join(
                  in_dir, "refined_poses", "{:02d}.txt".format(drive)
              )
          )
          list_name_frames = sorted(
              [f for f in os.listdir(path_frames) if "bin" in f]
          )
          for i, name in enumerate(list_name_frames):
              pose = all_poses[i].reshape((3, 4))
              xyzr = np.fromfile(
                  osp.join(path_frames, name), dtype=np.float32
              ).reshape((-1, 4))
              xyzr[:, :3] = (
                  xyzr[:, :3].dot(T_calib[:3, :3].T) + T_calib[:3, 3]
              )
              xyzr[:, :3] = (
                  xyzr[:, :3].dot(pose[:3, :3].T) + pose[:3, 3]
              )
              # store position of the car to filter some frames
              pos_sensor = (
                  pose[:3, :3].dot(T_calib[:3, 3]) + pose[:3, 3]
              )
              data = Data(
                  pos=torch.from_numpy(xyzr[:, :3]),
                  reflectance=torch.from_numpy(xyzr[:, 3]),
                  pos_sensor=torch.from_numpy(pos_sensor),
              )
              out_path = osp.join(out_dir, name.split(".")[0] + ".pt")
              if self.pre_transform is not None:
                  data = self.pre_transform(data)
              torch.save(data, out_path)
  
imports: import glob
  import json
  import logging
  import numpy
  import os
  import os.path
  import shutil
  import torch
  from torch_geometric.data import Dataset, download_url, extract_zip
  from torch_geometric.data import Data
  from torch_points3d.datasets.registration.detector import RandomDetector
  from torch_points3d.datasets.registration.utils import rgbd2fragment_rough
  from torch_points3d.datasets.registration.utils import rgbd2fragment_fine
  from torch_points3d.datasets.registration.utils import compute_overlap_and_matches
  from torch_points3d.datasets.registration.utils import to_list
  from torch_points3d.datasets.registration.utils import files_exist
  from torch_points3d.datasets.registration.utils import makedirs
  from torch_points3d.datasets.registration.utils import get_urls
  from torch_points3d.datasets.registration.utils import PatchExtractor
label_desc: Use image node_id 5 for calling the BaseKitti obj's underlying member method code with example usage: obj._pre_transform_fragment(mod) without return types