Requesting Feedback on DWI-sorting and concatenation algorithm

For our diffusion imaging pipeline, we unfortunately can only process a single diffusion image series. (while I wouldn’t mind using QSIprep, I cannot for this project). I am currently attempting to put together an acquisition-agnostic algorithm for grouping and choosing scans and was wondering if I could get some feedback.

Proposed steps are:

  1. Get a list of all diffusion images in a session
  2. Select images that are either multi- or single-shelled.
    • If only one type of image is found, but it is different from requested image type, then that image will be used.
  3. Group by common distortions. Concatenate images, b-values, and b-vectors in same distortion groups.
  4. If single-shell is requested, slice concatenated images, b-values, and b-vectors for shells that are closest to a minimum b-value requested (e.g. 0 and 1000)

I naively chose to concatenate the images since that seemed the most acquisition-agnostic, however I do have some concerns. E.g. if a subject has multiple single-shell acquisitions that were acquired and multi-shell protocol is requested, then these multiple single-shell acquisitions would be grouped into a single image and treated as a mutli-shell acquisition.

Any comments or critiques would be greatly appreciated!