nanshe/advanced_image_processing.py: Optimized nan removal.
nanshe/advanced_image_processing.py: Only change result if there was a change.
nanshe/advanced_image_processing.py: Harden transposes of points.