This is hard, which is what you are finding out. The problem is that DICOM from its origin is a 2D image oriented protocol/format. The way that the AFNI function mri_read_dicom() works is to use the "Image Position" (0020,0032) field from 2 consecutive positions to determine the orientation of the third direction. This is clumsy, but seems to work OK for us. (If the images are a Siemens' mosaic, then the Siemens custom info contains the slice locations of each sub-image in the mosaic.)
The gruesome details are in mri_read_dicom.c in the AFNI source code. Global variables are used, alas. When I was a computer science professor (back in the Stone Age) I used to give students grief over global variables. Oh well, they probably aren't checking out my code like I used to check theirs.
I've tried to read the Supplement 49 information which is the new standard way to store multiple images in a single DICOM file. But I've not been able to figure it out. I have a lot of trouble reading DICOM-ese.
bob cox