support complex data and NaN in images