modify roi2gwmi alogrithm