Fix the way vtkDICOMWriter indexes multi-dimensional data sets.

The writer assumed that the time and vector dimensions varied faster
than the slice dimension, which is not always true for DICOM files.
Because the writer tried to match written slices with input slices
(via the meta data from the input file), if an input multi-dimensional
series had a slice dimension that varied faster than the time or vector
dimensions, then a crash could result.