jwo.landserf.process
Class VoidRemovalThread

java.lang.Object
  extended by java.lang.Thread
      extended by jwo.landserf.process.LSThread
          extended by jwo.landserf.process.VoidRemovalThread
All Implemented Interfaces:
Runnable, Scriptable, JWInterruptionListener

public class VoidRemovalThread
extends LSThread
implements Scriptable

Removes voids from a raster by taking average of non-void neighbours. Removes voids iteratively prioritising void cells with the smallest number of non-void neighbours.

Version:
2.3, 17th July, 2006.
Author:
Jo Wood

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
VoidRemovalThread(GISFrame gisFrame)
          Creates an object ready to look for void cells (represented by RasterMap.NO_VALUE) and remove them.
 
Method Summary
 boolean doCommand(LSCommand command)
          Creates a raster map without void values, based on the one given by the scripting command.
 void doProcessing()
          Processes DEM looking for and removing voids.
 LSCommand getCommand()
          Reports the syntax required to allow voids to be removed via a scripting command.
 GISFrame getGISFrame()
          Retrieves the GISFrame that can be used for storing multiple spatial objects.
 int getNumNeighbours(RasterMap raster, int row, int col)
          Counts the number of non-void neighbours surrounding a given cell.
 Object getReturnedObject()
          Returns a raster map holding the transformed object.
 
Methods inherited from class jwo.landserf.process.LSThread
checkStoppedThread, interruptionRequested, resetTimer, run, setErrorMessage, setFinalMessage, setMessage
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

VoidRemovalThread

public VoidRemovalThread(GISFrame gisFrame)
Creates an object ready to look for void cells (represented by RasterMap.NO_VALUE) and remove them.

Parameters:
gisFrame - GISFrame holding raster to process.
Method Detail

getCommand

public LSCommand getCommand()
Reports the syntax required to allow voids to be removed via a scripting command.

Specified by:
getCommand in interface Scriptable
Returns:
Command syntax.

doCommand

public boolean doCommand(LSCommand command)
Creates a raster map without void values, based on the one given by the scripting command.

Specified by:
doCommand in interface Scriptable
Parameters:
command - Command containing parameter values.
Returns:
True if the void removal is successful. If false, the details of the problem are reported to the gisFrame.

getReturnedObject

public Object getReturnedObject()
Returns a raster map holding the transformed object. If command has yet to be issued this will return null.

Specified by:
getReturnedObject in interface Scriptable
Returns:
New spatial object or null if problems converting or command has not yet been issued.

getGISFrame

public GISFrame getGISFrame()
Retrieves the GISFrame that can be used for storing multiple spatial objects.

Specified by:
getGISFrame in interface Scriptable
Returns:
GISFrame storing spatial objects.

doProcessing

public void doProcessing()
Processes DEM looking for and removing voids. If raster is entirely composed of voids, all values will be reclassified as 0. This does not produce a new raster but alters the primary raster stored in the GIS frame supplied to the constructor.

Note that this method will be called automatically if this is run as a threaded process (e.g. myVoidRemovalThread.start()). Alternatively it can be called directly as a non-threaded process.

Specified by:
doProcessing in class LSThread
See Also:
GISFrame

getNumNeighbours

public int getNumNeighbours(RasterMap raster,
                            int row,
                            int col)
Counts the number of non-void neighbours surrounding a given cell.

Parameters:
raster - Raster map to examine.
row - Row coordinate of cell to examine.
col - Column coordinate of cell to examine.
Returns:
Number of non-void neighbours (between 0 and 8).


Copyright Jo Wood, 1996-2009, last modified, 17th April, 2009