code: def to_file(self, outpath):
          
          if not self.has_mask() and not self.is_smoothed():
              save_niigz(outpath, self.img)
          else:
              save_niigz(outpath, self.get_data(masked=True, smoothed=True),
                         self.get_header(), self.get_affine())
docs: Save this object instance in outpath.
  
          Parameters
          ----------
          outpath: str
              Output file path