Allow Imagine to encode 3d or 4d