pygmi.raster.smooth#

Routines to smooth raster data.

Classes#

Smooth

Smooth rasters.

Functions#

filters2d(filtertype, sze, *sigma)

Filter 2D.

Module Contents#

class pygmi.raster.smooth.Smooth(parent=None)#

Bases: pygmi.misc.BasicModule

Smooth rasters.

Parameters:

parent (parent, optional) – Reference to the parent routine. The default is None.

setupui()#

Set up UI.

Return type:

None.

settings(nodialog=False)#

Entry point into item.

Parameters:

nodialog (bool, optional) – Run settings without a dialog. The default is False.

Returns:

True if successful, False otherwise.

Return type:

bool

saveproj()#

Save project data from class.

Return type:

None.

choosefilter()#

Section to choose the filter.

Return type:

None.

updatetable()#

Update table.

Return type:

None.

msgbox(title, message)#

Message box.

Parameters:
  • title (str) – Title for message box.

  • message (str) – Text for message box.

Return type:

None.

mov_win_filt(dat, fmat, itype)#

Apply moving window filter function to data.

Parameters:
  • dat (numpy masked array.) – Data for a PyGMI raster dataset.

  • fmat (numpy array) – Filter matrix.

  • itype (str) – Filter type. Can be ‘2D Mean’ or ‘2D Median’.

Returns:

out – Data for a PyGMI raster dataset.

Return type:

numpy masked array

pygmi.raster.smooth.filters2d(filtertype, sze, *sigma)#

Filter 2D.

These filter definitions have been translated from the octave function ‘fspecial’.

Copyright (C) 2005 Peter Kovesi

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

FSPECIAL - Create spatial filters for image processing

Usage: f = fspecial(filtertype, optional parameters)

filtertype can be

‘average’ - Rectangular averaging filter
‘disc’ - Circular averaging filter.
‘gaussian’ - Gaussian filter.

The parameters that need to be specified depend on the filtertype

Examples of use and associated default values:

f = fspecial(‘average’,sze) sze can be a 1 or 2 vector
default is [3 3].
f = fspecial(‘disk’,radius) default radius = 5
f = fspecial(‘gaussian’,sze, sigma) default sigma is 0.5

Where sze is specified as a single value the filter will be square.

Author: Peter Kovesi <pk@csse.uwa.edu.au> Keywords: image processing, spatial filters Created: August 2005

Parameters:
  • filtertype (str) – Type of filter. Can be ‘average’, ‘disc’ or ‘gaussian’.

  • sze (numpy array or integer)) – This is a integer radius for ‘disc’ or a vector containing rows and columns otherwise.

  • sigma (numpy array) – numpy array containing std deviation. Used in ‘gaussian’.

Returns:

f – Returns the filter to be used.

Return type:

numpy array