Image Analysis, Random Fields and Dynamic Monte Carlo Methods: A Mathematical Introduction