Speed-up ImagineDimensionReducer

Speed-up ImagineDimensionReducer by only working with array. Export
functions still need to be written.