1. A device for generating spatial-encoding magnetic fields when positioned in an external magnetic field, the device comprising: a plurality of spatial-encoding elements configured to produce a spatial-encoding magnetic field in the presence of an external magnetic field, the plurality of spatial-encoding elements comprising: at least one paramagnetic spatial-encoding element; at least one diamagnetic spatial-encoding element; and a rotatable support coupled to the plurality of spatial-encoding elements and configured to space the plurality of spatial-encoding elements in a fixed spatial arrangement and to rotate the spatial-encoding elements about a rotation axis of the support in order to produce a plurality of different spatial-encoding magnetic fields in the presence of the external magnetic field.