Fix cmtk to handle ~ in the path to a registration