diff --git a/CEP/PyBDSM/doc/source/conf.py b/CEP/PyBDSM/doc/source/conf.py
index ce464f45ee572012b11231880a3f6fe77175a554..b541401cfad0214fa7950e5b14df6ef2ce7f3870 100644
--- a/CEP/PyBDSM/doc/source/conf.py
+++ b/CEP/PyBDSM/doc/source/conf.py
@@ -41,7 +41,7 @@ master_doc = 'index'
 
 # General information about the project.
 project = u'PyBDSM'
-copyright = u'2013, David Rafferty and Niruj Mohan'
+copyright = u'2014, David Rafferty and Niruj Mohan'
 
 # The version info for the project you're documenting, acts as replacement for
 # |version| and |release|, also used in various other places throughout the
@@ -50,7 +50,7 @@ copyright = u'2013, David Rafferty and Niruj Mohan'
 # The short X.Y version.
 version = '1.8'
 # The full version, including alpha/beta/rc tags.
-release = '1.8.0'
+release = '1.8.1'
 
 # The language for content autogenerated by Sphinx. Refer to documentation
 # for a list of supported languages.
diff --git a/CEP/PyBDSM/doc/source/examples.rst b/CEP/PyBDSM/doc/source/examples.rst
index 33a2ce543765e4e0c26ad3d91c39a705d80d05ce..b71c024cdaf400bb0e7dc2a0abea30fb9c8289c2 100644
--- a/CEP/PyBDSM/doc/source/examples.rst
+++ b/CEP/PyBDSM/doc/source/examples.rst
@@ -146,6 +146,8 @@ Lastly, the plot window is closed, and the source catalog is written out to an A
                                    'gaussian' => each Gaussian gets its own patch.
                                    'source' => all Gaussians belonging to a single
                                    source are grouped into one patch
+    bbs_patches_mask ...... None : Name of the mask file (of same size as input image)
+                                   that defines the patches if bbs_patches = 'mask'
     catalog_type .......... 'srl': Type of catalog to write:  'gaul' - Gaussian
                                    list, 'srl' - source list (formed by grouping
                                    Gaussians), 'shap' - shapelet list
diff --git a/CEP/PyBDSM/doc/source/process_image.rst b/CEP/PyBDSM/doc/source/process_image.rst
index cb82bf5df5be6639877ce64e169b215e27cdefb0..3c184fc1c6809680345d2ce05e3ea51be6d83788 100644
--- a/CEP/PyBDSM/doc/source/process_image.rst
+++ b/CEP/PyBDSM/doc/source/process_image.rst
@@ -709,7 +709,10 @@ The output options are:
                                    patches. 'single' => all Gaussians in one patch.
                                    'gaussian' => each Gaussian gets its own patch.
                                    'source' => all Gaussians belonging to a single
-                                   source are grouped into one patch
+                                   source are grouped into one patch. 'mask' => use mask
+                                   file specified by bbs_patches_mask
+      :term:`bbs_patches_mask` .... None : Name of the mask file (of same size as input image)
+                                   that defines the patches if bbs_patches = 'mask'
       :term:`indir` ............... None : Directory of input FITS files. None => get from
                                    filename
       :term:`opdir_overwrite` .. 'overwrite': 'overwrite'/'append': If output_all=True,
@@ -735,16 +738,16 @@ The output options are:
 .. glossary::
 
     bbs_patches
-        This parameter is a string (default is ``None``) that sets the type of patch to use in BBS-formatted catalogs. When the Gaussian catalogue is written as a BBS-readable sky file, this
-        determines whether all Gaussians are in a single patch (``'single'``), there are no
-        patches (``None``), all Gaussians for a given source are in a separate patch (``'source'``), or
-        each Gaussian gets its own patch (``'gaussian'``).
+        This parameter is a string (default is ``None``) that sets the type of patch to use in BBS-formatted catalogs. When the Gaussian catalogue is written as a BBS-readable sky file, this option determines whether all Gaussians are in a single patch (``'single'``), there are no patches (``None``), all Gaussians for a given source are in a separate patch (``'source'``), each Gaussian gets its own patch (``'gaussian'``), or a mask image is used to define the patches (``'mask'``).
 
         If you wish to have patches defined by island, then set
         ``group_by_isl = True`` before fitting to force all
         Gaussians in an island to be in a single source. Then set
         ``bbs_patches = 'source'`` when writing the catalog.
 
+    bbs_patches_mask
+        This parameter is a string (default is ``None``) that sets the file name of the mask file to use to define patches in BBS-formatted catalogs. The mask image should be 1 inside the patches and 0 elsewhere and should be the same size as the input image (before any ``trim_box`` is applied). Any Gaussians that fall outside of the patches will be ignored and will not appear in the output sky model.
+
     indir
         This parameter is a string (default is ``None``) that sets the directory of input FITS files. If ``None``, the directory is defined by the input filename.
 
diff --git a/CEP/PyBDSM/doc/source/whats_new.rst b/CEP/PyBDSM/doc/source/whats_new.rst
index 2304241deccf9d788d575fbac2a2e40e293f00fc..b37e317b1bf1e341da775d0cf696f1d791664b17 100644
--- a/CEP/PyBDSM/doc/source/whats_new.rst
+++ b/CEP/PyBDSM/doc/source/whats_new.rst
@@ -4,13 +4,15 @@
 What's New
 **********
 
-Version 1.8.1 (2014/01/10):
+Version 1.8.1 (2014/01/14):
+
+    * Added option (``bbs_patches = 'mask'``) to allow patches in an output BBS sky model to be defined using a mask image (set with the ``bbs_patches_mask`` option).
 
     * Fix to bug that caused the ``incl_empty`` option to be ignored when ``format='fits'`` in the ``write_catalog`` task.
 
     * Enabled output of images in CASA format in the ``export_image`` task (``img_format = 'casa'``).
 
-    * Added an option to ``export_image`` to export an island-mask image, with ones where there is emission and zeros elsewhere (``image_type = 'island_mask'``). Features in the island mask may be optionally dilated by specifying the number of dilation iterations with the ``mask_dilation`` parameter.
+    * Added an option to ``export_image`` to export an island-mask image, with ones where there is emission and zeros elsewhere (``image_type = 'island_mask'``). Features in the island mask may be optionally dilated by specifying the number of dilation iterations with the ``mask_dilation`` parameter. The mask image may be padded with zeros to match the original image when the ``trim_box`` option was used to analyze only a portion of the image (``pad_image = True``).
 
     * Added an option to write a CASA region file to the ``write_catalog`` task (``format = 'casabox'``).
 
diff --git a/CEP/PyBDSM/doc/source/write_catalog.rst b/CEP/PyBDSM/doc/source/write_catalog.rst
index 886c065bce7277c31b5a3e1b7c7ff379b9ccf854..a842cc8dde9e33b702fa9f40710d5dd47d31b0df 100644
--- a/CEP/PyBDSM/doc/source/write_catalog.rst
+++ b/CEP/PyBDSM/doc/source/write_catalog.rst
@@ -23,11 +23,14 @@ The task parameters are as follows:
                                    patches. 'single' => all Gaussians in one patch.
                                    'gaussian' => each Gaussian gets its own patch.
                                    'source' => all Gaussians belonging to a single
-                                   source are grouped into one patch
+                                   source are grouped into one patch. 'mask' => use mask
+                                   file specified by bbs_patches_mask
+    :term:`bbs_patches_mask` ...... None : Name of the mask file (of same size as input image)
+                                   that defines the patches if bbs_patches = 'mask'
     :term:`catalog_type` .......... 'srl': Type of catalog to write:  'gaul' - Gaussian
                                    list, 'srl' - source list (formed by grouping
-                                   Gaussians), 'shap' - shapelet list (not yet
-                                   supported)
+                                   Gaussians), 'shap' - shapelet list (FITS
+                                   format only)
     :term:`clobber` .............. False : Overwrite existing file?
     :term:`correct_proj` .......... True : Correct source parameters for image projection
                                    (BBS format only)?
@@ -48,16 +51,16 @@ Each of the parameters is described in detail below.
         This parameter is a string (default is ``None``) that sets the name of the output file. If ``None``, the file is named automatically. If 'SAMP' the full catalog (i.e., ``format = 'fits'``) is sent to a running SAMP Hub (e.g., to TOPCAT or Aladin).
 
     bbs_patches
-        This parameter is a string (default is ``None``) that sets the type of patch to use in BBS-formatted catalogs. When the Gaussian catalogue is written as a BBS-readable sky file, this
-        determines whether all Gaussians are in a single patch (``'single'``), there are no
-        patches (``None``), all Gaussians for a given source are in a separate patch (``'source'``), or
-        each Gaussian gets its own patch (``'gaussian'``).
+        This parameter is a string (default is ``None``) that sets the type of patch to use in BBS-formatted catalogs. When the Gaussian catalogue is written as a BBS-readable sky file, this option determines whether all Gaussians are in a single patch (``'single'``), there are no patches (``None``), all Gaussians for a given source are in a separate patch (``'source'``), each Gaussian gets its own patch (``'gaussian'``), or a mask image is used to define the patches (``'mask'``).
 
         If you wish to have patches defined by island, then set
         ``group_by_isl = True`` before fitting to force all
         Gaussians in an island to be in a single source. Then set
         ``bbs_patches = 'source'`` when writing the catalog.
 
+    bbs_patches_mask
+        This parameter is a string (default is ``None``) that sets the file name of the mask file to use to define patches in BBS-formatted catalogs. The mask image should be 1 inside the patches and 0 elsewhere and should be the same size as the input image (before any ``trim_box`` is applied). Any Gaussians that fall outside of the patches will be ignored and will not appear in the output sky model.
+
     catalog_type
         This parameter is a string (default is ``'srl'``) that sets the type of catalog to write:  ``'gaul'`` - Gaussian list, ``'srl'`` - source list
         (formed by grouping Gaussians), ``'shap'`` - shapelet list (``'fits'`` format only)
diff --git a/CEP/PyBDSM/src/python/opts.py b/CEP/PyBDSM/src/python/opts.py
index a160960f2327e5eab5f17d01b9861a4e06b56e49..823cbdd0871eac9f6cec96a000e253e7fd8da8a2 100644
--- a/CEP/PyBDSM/src/python/opts.py
+++ b/CEP/PyBDSM/src/python/opts.py
@@ -846,10 +846,11 @@ class Opts(object):
                                  "BBS-readable sky file, this determines whether "\
                                  "all Gaussians are in a single patch, there are "\
                                  "no patches, all Gaussians for a given source "\
-                                 "are in a separate patch, or each Gaussian gets "\
-                                 "its own patch.\n"\
+                                 "are in a separate patch, each Gaussian gets "\
+                                 "its own patch, or a mask image is used to define "\
+                                 "the patches.\n"\
                                  "If you wish to have patches defined by island, "\
-                                 "then set group_by_isl=True (under advanced_opts) "\
+                                 "then set group_by_isl = True (under advanced_opts) "\
                                  "before fitting to force all Gaussians in an "\
                                  "island to be in a single source. Then set "\
                                  "bbs_patches='source' when writing the catalog.",
@@ -861,7 +862,7 @@ class Opts(object):
                                  "patches in the output BBS sky model. The mask "\
                                  "image should be 1 inside the patches and 0 "\
                                  "elsewhere and should be the same size as the "\
-                                 "input image (before trim_box is applied). Any "\
+                                 "input image (before any trim_box is applied). Any "\
                                  "Gaussians that fall outside of the patches "\
                                  "will be ignored and will not appear in the "\
                                  "output sky model.",
@@ -1245,7 +1246,7 @@ class Opts(object):
                              doc = "Type of image to export: 'gaus_resid', "\
                                  "'shap_resid', 'rms', 'mean', 'gaus_model', "\
                                  "'shap_model', 'ch0', 'pi', 'psf_major', "\
-                                 "'psf_minor', 'psf_pa', 'psf_ratio', 'psf_ratio_aper',"\
+                                 "'psf_minor', 'psf_pa', 'psf_ratio', 'psf_ratio_aper', "\
                                  "'island_mask'\nThe following images "\
                                  "can be exported:\n"\
                                  "'ch0' - image used for source detection\n"\