Initialized scanArray with exact number of rows, cols, slcs as a speedup.