Magnetic anisotropy in nanostructured materials