code: def get_average_of_timeseries( image, idx=None ):
      
      imagedim = image.dimension
      if idx is None:
          idx = range( image.shape[ imagedim - 1 ] )
      i0 = utils.slice_image( image, axis=image.dimension-1, idx=idx[0] ) * 0
      wt = 1.0 / len( idx )
      for k in idx:
          i0 = i0 + utils.slice_image( image, axis=image.dimension-1, idx=k ) * wt
      return( i0 )
docs: Average the timeseries into a dimension-1 image.
      image: input time series image
      idx:  indices over which to average