Magnetism of materials: theory and practice in magnetic resonance imaging