docs: def _create_bvecs(sorted_dicoms, bvec_file):
      """
      Calculate the bvecs and write the to a bvec file
      # inspired by dicom2nii from mricron
      # see  http://users.fmrib.ox.ac.uk/~robson/internal/Dicom2Nifti111.m
      """
      if type(sorted_dicoms[0]) is list:
          dicom_headers = sorted_dicoms[0][0]
      else:
          dicom_headers = sorted_dicoms[0]
  
      # get the patient orientation
      image_orientation = dicom_headers.ImageOrientationPatient
      read_vector = numpy.array([float(image_orientation[0]), float(image_orientation[1]), float(image_orientation[2])])
      phase_vector = numpy.array([float(image_orientation[3]), float(image_orientation[4]), float(image_orientation[5])])
      mosaic_vector = numpy.cross(read_vector, phase_vector)
  
      # normalize the vectors
      read_vector /= numpy.linalg.norm(read_vector)
      phase_vector /= numpy.linalg.norm(phase_vector)
      mosaic_vector /= numpy.linalg.norm(mosaic_vector)
      # create an empty array for the new bvecs
      bvecs = numpy.zeros([len(sorted_dicoms), 3])
      # for each slice calculate the new bvec
      for index in range(0, len(sorted_dicoms)):
          if type(sorted_dicoms[0]) is list:
              dicom_headers = sorted_dicoms[index][0]
          else:
              dicom_headers = sorted_dicoms[index]
  
          # get the bval als this is needed in some checks
          bval = common.get_is_value(dicom_headers[Tag(0x0019, 0x100c)])
          # get the bvec if it exists in the headers
          bvec = numpy.array([0, 0, 0])
          if Tag(0x0019, 0x100e) in dicom_headers:
              # in case of implicit VR the private field cannot be split into an array, we do this here
              bvec = numpy.array(common.get_fd_array_value(dicom_headers[Tag(0x0019, 0x100e)], 3))
          # if bval is 0 or the vector is 0 no projection is needed and the vector is 0,0,0
          new_bvec = numpy.array([0, 0, 0])
  
          if bval > 0 and not (bvec == [0, 0, 0]).all():
              # project the bvec and invert the y direction
              new_bvec = numpy.array(
                  [numpy.dot(bvec, read_vector), -numpy.dot(bvec, phase_vector), numpy.dot(bvec, mosaic_vector)])
              # normalize the bvec
              new_bvec /= numpy.linalg.norm(new_bvec)
          bvecs[index, :] = new_bvec
          # save the found bvecs to the file
          common.write_bvec_file(bvecs, bvec_file)
      return numpy.array(bvecs)