class_docstr: DAS beamformed phantom images and paired post-processed images.
class_docstr_tok: ["DAS","beamformed","phantom","images","and","paired","post-processed","images","."]
code: def _generate_examples(self, datapath, csvpath):
      with epath.Path(csvpath).open() as f:
          reader = csv.DictReader(f)
          for row in reader:
              data_key = (
                  "mark_data"
                  if row["target"] == "mark"
                  else "phantom_data"
              )
  
              filepath = os.path.join(
                  datapath[data_key], row["filename"]
              )
              matfile = tfds.core.lazy_imports.scipy.io.loadmat(
                  tf.io.gfile.GFile(filepath, "rb")
              )
  
              iq = np.abs(np.reshape(matfile["iq"], -1))
              iq = iq / iq.max()
              iq = 20 * np.log10(iq)
  
              yield row["filename"], {
                  "das": {
                      "dB": iq.astype(np.float32),
                      "real": np.reshape(matfile["iq"], -1).real.astype(
                          np.float32
                      ),
                      "imag": np.reshape(matfile["iq"], -1).imag.astype(
                          np.float32
                      ),
                  },
                  "dtce": np.reshape(matfile["dtce"], -1).astype(
                      np.float32
                  ),
                  "f0_hz": row["f0"],
                  "voltage": row["v"],
                  "focus_cm": row["focus_cm"],
                  "height": row["axial_samples"],
                  "width": row["lateral_samples"],
                  "initial_radius": row["initial_radius"],
                  "final_radius": row["final_radius"],
                  "initial_angle": row["initial_angle"],
                  "final_angle": row["final_angle"],
                  "probe": row["probe"],
                  "scanner": row["scanner"],
                  "target": row["target"],
                  "timestamp_id": row["timestamp_id"],
                  "harmonic": bool_utils.parse_bool(row["harm"]),
              }
  
file_path: datasets/tensorflow_datasets/datasets/duke_ultrasound/duke_ultrasound_dataset_builder.py
imports: import csv
  import os
  from etils import epath
  import numpy
  from tensorflow_datasets.core.utils import bool_utils
  from tensorflow_datasets.core.utils.lazy_imports_utils import tensorflow
  import tensorflow_datasets.public_api
label_desc: Use image node_id 4 for calling the Builder obj's underlying member method code with example usage: obj._generate_examples(datapath, csvpath) without return types