de.unihalle.informatik.MiToBo.filters.nonlinear
Class RankOperator

java.lang.Object
  extended by de.unihalle.informatik.Alida.operator.ALDOperator
      extended by de.unihalle.informatik.MiToBo.core.operator.MTBOperator
          extended by de.unihalle.informatik.MiToBo.filters.nonlinear.RankOperator
All Implemented Interfaces:
de.unihalle.informatik.Alida.datatypes.ALDConfigurationValidator, loci.common.StatusReporter

@ALDAOperator(genericExecutionMode=ALL)
public class RankOperator
extends MTBOperator
implements loci.common.StatusReporter

Rank operator class to compute Median, Minimum or Maximum filter for hyperstack, stack and plain images. Slow but memory efficient implementation.

Author:
gress

Nested Class Summary
static class RankOperator.RankOpMode
          Defines the operation
 
Nested classes/interfaces inherited from class de.unihalle.informatik.Alida.operator.ALDOperator
de.unihalle.informatik.Alida.operator.ALDOperator.HidingMode
 
Field Summary
private  MTBImage inImg
           
private  int m_idx
          index of the minimum, median or maximum element in the sorted array
private  int m_rC
          Radius of the median in the corresponding dimension.
private  int m_rT
          Radius of the median in the corresponding dimension.
private  int m_rX
          Radius of the median in the corresponding dimension.
private  int m_rY
          Radius of the median in the corresponding dimension.
private  int m_rZ
          Radius of the median in the corresponding dimension.
private  int m_sizeC
          Size of the dimensions, size of the real stack.
private  int m_sizeT
          Size of the dimensions, size of the real stack.
private  int m_sizeX
          Size of the dimensions, size of the real stack.
private  int m_sizeY
          Size of the dimensions, size of the real stack.
private  int m_sizeZ
          Size of the dimensions, size of the real stack.
private  java.util.Vector<loci.common.StatusListener> m_statusListeners
          vector of installed StatusListeners
private  int maskRadiusC
           
private  int maskRadiusT
           
private  int maskRadiusX
           
private  int maskRadiusY
           
private  int maskRadiusZ
           
private  RankOperator.RankOpMode rankOpMode
           
private  MTBImage resultImg
           
 
Fields inherited from class de.unihalle.informatik.Alida.operator.ALDOperator
completeDAG, name, portHashAccess, verbose, versionProvider
 
Constructor Summary
RankOperator()
          Constructor
RankOperator(MTBImage inImg, RankOperator.RankOpMode mode, int maskRadius)
          Constructor
RankOperator(MTBImage inImg, RankOperator.RankOpMode mode, int maskRadiusX, int maskRadiusY, int maskRadiusZ, int maskRadiusT, int maskRadiusC)
          Constructor
 
Method Summary
 void addStatusListener(loci.common.StatusListener statuslistener)
           
 MTBImage getInImg()
          Get value of Input argument inImg.
 int getMaskRadiusC()
          Get value of Parameter argument maskRadiusC.
 int getMaskRadiusT()
          Get value of Parameter argument maskRadiusT.
 int getMaskRadiusX()
          Get value of Parameter argument maskRadiusX.
 int getMaskRadiusY()
          Get value of Parameter argument maskRadiusY.
 int getMaskRadiusZ()
          Get value of Parameter argument maskRadiusZ.
 RankOperator.RankOpMode getRankOpMode()
          Get value of Parameter argument rankOpMode.
 MTBImage getResultImg()
          Get value of Output argument resultImg.
 void notifyListeners(loci.common.StatusEvent e)
           
protected  void operate()
           
private  double rankedValueAt(int x, int y, int z, int t, int c, MTBImage img, double[] values)
          Compute rank operator value for coordinate (x,y,z,t,c) Treatment at boundaries: Image values are mirrored at the border element to determine values under the mask that are outside the image.
protected  MTBImage rankOp(MTBImage img, RankOperator.RankOpMode mode, int radiusX, int radiusY, int radiusZ, int radiusT, int radiusC)
          Compute the rank operation of a gray-valued image, stack or hyperstack
 void removeStatusListener(loci.common.StatusListener statuslistener)
           
 void setInImg(MTBImage img)
          Set value of Input argument inImg.
 void setMaskRadiusC(int value)
          Set value of Parameter argument maskRadiusC.
 void setMaskRadiusT(int value)
          Set value of Parameter argument maskRadiusT.
 void setMaskRadiusX(int value)
          Set value of Parameter argument maskRadiusX.
 void setMaskRadiusY(int value)
          Set value of Parameter argument maskRadiusY.
 void setMaskRadiusZ(int value)
          Set value of Parameter argument maskRadiusZ.
 void setRankOpMode(RankOperator.RankOpMode opMode)
          Set value of Parameter argument rankOpMode.
protected  void setResultImg(MTBImage img)
          Set value of Output argument resultImg.
 void validateCustom()
           
 
Methods inherited from class de.unihalle.informatik.MiToBo.core.operator.MTBOperator
readResolve
 
Methods inherited from class de.unihalle.informatik.Alida.operator.ALDOperator
deserializeFromXmlFile, fieldContained, getALDPortHashAccessKey, getConstructionMode, getInInoutNames, getInInoutNames, getInNames, getInOutNames, getMissingRequiredInputs, getName, getNumParameters, getOutInoutNames, getOutNames, getParameter, getParameterDescriptor, getParameterNames, getSupplementalNames, getVerbose, getVersion, isConfigured, parametersToXmlObject, print, print, print, printInterface, printInterface, readHistory, reinitializeParameterDescriptors, runOp, runOp, runOp, serializeToXmlFile, setConstructionMode, setName, setParameter, setParametersFromXml, setParametersFromXml, setVerbose, toStringVerbose, unconfiguredItems, validate, validateGeneric, writeHistory, writeHistory, writeHistory, writeParametersToXml
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

inImg

@Parameter(label="Input image",
           required=true,
           direction=IN,
           mode=STANDARD,
           dataIOOrder=1,
           description="Input image")
private MTBImage inImg

m_idx

private int m_idx
index of the minimum, median or maximum element in the sorted array


m_rC

private int m_rC
Radius of the median in the corresponding dimension. These values are set when the rankOp(..) function is called with an ImagePlus object


m_rT

private int m_rT
Radius of the median in the corresponding dimension. These values are set when the rankOp(..) function is called with an ImagePlus object


m_rX

private int m_rX
Radius of the median in the corresponding dimension. These values are set when the rankOp(..) function is called with an ImagePlus object


m_rY

private int m_rY
Radius of the median in the corresponding dimension. These values are set when the rankOp(..) function is called with an ImagePlus object


m_rZ

private int m_rZ
Radius of the median in the corresponding dimension. These values are set when the rankOp(..) function is called with an ImagePlus object


m_sizeC

private int m_sizeC
Size of the dimensions, size of the real stack. These values are set when the median(..) function is called with an ImagePlus object


m_sizeT

private int m_sizeT
Size of the dimensions, size of the real stack. These values are set when the median(..) function is called with an ImagePlus object


m_sizeX

private int m_sizeX
Size of the dimensions, size of the real stack. These values are set when the median(..) function is called with an ImagePlus object


m_sizeY

private int m_sizeY
Size of the dimensions, size of the real stack. These values are set when the median(..) function is called with an ImagePlus object


m_sizeZ

private int m_sizeZ
Size of the dimensions, size of the real stack. These values are set when the median(..) function is called with an ImagePlus object


m_statusListeners

private java.util.Vector<loci.common.StatusListener> m_statusListeners
vector of installed StatusListeners


maskRadiusC

@Parameter(label="Mask-radius c",
           required=true,
           direction=IN,
           mode=ADVANCED,
           dataIOOrder=7,
           description="Radius of the mask in c-dimension in a city-block sense (rectangular mask)")
private int maskRadiusC

maskRadiusT

@Parameter(label="Mask-radius t",
           required=true,
           direction=IN,
           mode=ADVANCED,
           dataIOOrder=6,
           description="Radius of the mask in t-dimension in a city-block sense (rectangular mask)")
private int maskRadiusT

maskRadiusX

@Parameter(label="Mask-radius x",
           required=true,
           direction=IN,
           mode=ADVANCED,
           dataIOOrder=3,
           description="Radius of the mask in x-dimension in a city-block sense (rectangular mask)")
private int maskRadiusX

maskRadiusY

@Parameter(label="Mask-radius y",
           required=true,
           direction=IN,
           mode=ADVANCED,
           dataIOOrder=4,
           description="Radius of the mask in y-dimension in a city-block sense (rectangular mask)")
private int maskRadiusY

maskRadiusZ

@Parameter(label="Mask-radius z",
           required=true,
           direction=IN,
           mode=ADVANCED,
           dataIOOrder=5,
           description="Radius of the mask in z-dimension in a city-block sense (rectangular mask)")
private int maskRadiusZ

rankOpMode

@Parameter(label="Rank operation",
           required=true,
           direction=IN,
           mode=STANDARD,
           dataIOOrder=2,
           description="Type of the rank operation")
private RankOperator.RankOpMode rankOpMode

resultImg

@Parameter(label="Result image",
           required=true,
           direction=OUT,
           mode=STANDARD,
           dataIOOrder=1,
           description="Resulting image")
private MTBImage resultImg
Constructor Detail

RankOperator

public RankOperator()
             throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
Constructor

Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException

RankOperator

public RankOperator(MTBImage inImg,
                    RankOperator.RankOpMode mode,
                    int maskRadius)
             throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
Constructor

Parameters:
inImg - input image
mode - rank operation
maskRadius - mask radius in a city-block sense for cubic mask of size (2*maskRadius + 1) in x-, y-dimension and z-dimension if available
Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException - if given parameters are not valid

RankOperator

public RankOperator(MTBImage inImg,
                    RankOperator.RankOpMode mode,
                    int maskRadiusX,
                    int maskRadiusY,
                    int maskRadiusZ,
                    int maskRadiusT,
                    int maskRadiusC)
             throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
Constructor

Parameters:
inImg - input image
mode - rank operation
maskRadiusX - mask radius in x-dimension in a city-block sense (rectangular mask)
maskRadiusY - mask radius in y-dimension in a city-block sense (rectangular mask)
maskRadiusZ - mask radius in z-dimension in a city-block sense (rectangular mask)
maskRadiusT - mask radius in t-dimension in a city-block sense (rectangular mask)
maskRadiusC - mask radius in c-dimension in a city-block sense (rectangular mask)
Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException - if given parameters are not valid
Method Detail

addStatusListener

public void addStatusListener(loci.common.StatusListener statuslistener)
Specified by:
addStatusListener in interface loci.common.StatusReporter

getInImg

public MTBImage getInImg()
                  throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
Get value of Input argument inImg.

Returns:
value of inImg
Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException

getMaskRadiusC

public int getMaskRadiusC()
                   throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
Get value of Parameter argument maskRadiusC.

Returns:
value of maskRadiusC
Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException

getMaskRadiusT

public int getMaskRadiusT()
Get value of Parameter argument maskRadiusT.

Returns:
value of maskRadiusT

getMaskRadiusX

public int getMaskRadiusX()
Get value of Parameter argument maskRadiusX.

Returns:
value of maskRadiusX

getMaskRadiusY

public int getMaskRadiusY()
                   throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
Get value of Parameter argument maskRadiusY.

Returns:
value of maskRadiusY
Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException

getMaskRadiusZ

public int getMaskRadiusZ()
                   throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
Get value of Parameter argument maskRadiusZ.

Returns:
value of maskRadiusZ
Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException

getRankOpMode

public RankOperator.RankOpMode getRankOpMode()
Get value of Parameter argument rankOpMode.

Returns:
value of rankOpMode

getResultImg

public MTBImage getResultImg()
                      throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
Get value of Output argument resultImg.

Returns:
value of resultImg
Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException

notifyListeners

public void notifyListeners(loci.common.StatusEvent e)
Specified by:
notifyListeners in interface loci.common.StatusReporter

operate

protected void operate()
                throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
Specified by:
operate in class de.unihalle.informatik.Alida.operator.ALDOperator
Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException

rankedValueAt

private double rankedValueAt(int x,
                             int y,
                             int z,
                             int t,
                             int c,
                             MTBImage img,
                             double[] values)
Compute rank operator value for coordinate (x,y,z,t,c) Treatment at boundaries: Image values are mirrored at the border element to determine values under the mask that are outside the image. For example I(-1,-1)=I(1,1)

Parameters:
x - x-coordinate
y - y-coordinate
z - z-coordinate
t - t-coordinate
c - c-coordinate
img - Image to compute the ranked value from
Returns:
ranked value

rankOp

protected MTBImage rankOp(MTBImage img,
                          RankOperator.RankOpMode mode,
                          int radiusX,
                          int radiusY,
                          int radiusZ,
                          int radiusT,
                          int radiusC)
Compute the rank operation of a gray-valued image, stack or hyperstack

Parameters:
img - input MTBImage
radius - radius of the median mask
mode - rank operator mode
Returns:
median image

removeStatusListener

public void removeStatusListener(loci.common.StatusListener statuslistener)
Specified by:
removeStatusListener in interface loci.common.StatusReporter

setInImg

public void setInImg(MTBImage img)
              throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
Set value of Input argument inImg.

Parameters:
value - New value for inImg
Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException

setMaskRadiusC

public void setMaskRadiusC(int value)
                    throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
Set value of Parameter argument maskRadiusC.

Parameters:
value - New value for maskRadiusC
Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException

setMaskRadiusT

public void setMaskRadiusT(int value)
Set value of Parameter argument maskRadiusT.

Parameters:
value - New value for maskRadiusT

setMaskRadiusX

public void setMaskRadiusX(int value)
Set value of Parameter argument maskRadiusX.

Parameters:
value - New value for maskRadiusX

setMaskRadiusY

public void setMaskRadiusY(int value)
                    throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
Set value of Parameter argument maskRadiusY.

Parameters:
value - New value for maskRadiusY
Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException

setMaskRadiusZ

public void setMaskRadiusZ(int value)
                    throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
Set value of Parameter argument maskRadiusZ.

Parameters:
value - New value for maskRadiusZ
Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException

setRankOpMode

public void setRankOpMode(RankOperator.RankOpMode opMode)
Set value of Parameter argument rankOpMode.

Parameters:
value - New value for rankOpMode

setResultImg

protected void setResultImg(MTBImage img)
                     throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
Set value of Output argument resultImg.

Parameters:
value - New value for resultImg
Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException

validateCustom

public void validateCustom()
                    throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
Overrides:
validateCustom in class de.unihalle.informatik.Alida.operator.ALDOperator
Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException