///|
pub fn parse_image_index_csv(
  text : String,
) -> Array[ImageFrameRef] raise VisionFormatError {
  let lines = non_empty_lines(text)
  if lines.is_empty() {
    raise VisionFormatError::EmptyInput
  }
  let start = if lines[0].to_lower().contains("sec") { 1 } else { 0 }
  let frames = Array::new()
  for i in start.. String {
  let rows = ["sec,nsec,frame_id,path"]
  for frame in frames {
    rows.push(
      "\{frame.stamp.sec},\{frame.stamp.nsec},\{frame.frame_id},\{frame.path}",
    )
  }
  rows.join("\n")
}

///|
pub fn image_periods_ns(frames : ArrayView[ImageFrameRef]) -> Array[Int64] {
  let periods = Array::new()
  for i in 1.. String {
  if frames.is_empty() {
    "0 frames"
  } else {
    let first = frames[0].stamp.to_string()
    let last = frames[frames.length() - 1].stamp.to_string()
    "\{frames.length()} frames from \{first} to \{last}"
  }
}