Previous research has shown both obesity and diabetes are associated with an increased risk of cognitive impairment. Meanwhile, olfactory impairment is associated with incident (amnestic mild cognitive impairment) aMCI and progression from aMCI to (Alzheimer disease) AD dementia. On one hand, in the cross-sectional study, biometric measurements, cognitive assessment, olfactory function and fMRI results are analysed to explore the differences among T1DM patients, T2DM patients and non-diabetic people . One the other hand, in the longitudinal study, changes in olfactory function and fMRI results in diabetic and non-diabetic obese patients both at baseline and 6 months after their bariatric surgery are collected to investigate whether better glucose and weight control benefit brain function.