Switch from getopt to argparse

I replaced the getopt code in __main__ to argparse so that it could
handle an option specifying whether or not to mask the D region.
Fix masking method

Apparently the masking method had been left a useless husk from its
first commit, but I finally added the 1 line of code that makes it
work.