Spatial Relationship Based Scene Analysis And Synthesis