Refactor imaffine to be similar to streamlinear