Eliminate many redundant memory allocations
Numerous minor code twaeks

- changePixels() no longer treates NaN values as inside the threshold
- when a thresh method fails the error dialog prompt now works correctly
- some documentation changed
- some initialization code made more clear