Locally orderless tensor networks for classifying two- and three-dimensional medical images