most accurate way to determine TDEE?

Options
Im sure this has been posted a million times before so just responding with a past link would be fine (:

What is the best or most accurate way to determine TDEE? I know there are calculations I could do, but is there some sort of formal testing a doctor could do to determine this?

I am trying to slowlyyyyy gain weight, in a healthy way but even eating at my maintenance calories ( according to MFP) has me gaining very quickly, which is freaking me out.

So if I had a more accurate TDEE number maybe it would help me more?

thanks for any responses