ini.trakem2.imaging
Class BinaryInterpolation2D

java.lang.Object
  extended by ini.trakem2.imaging.BinaryInterpolation2D
All Implemented Interfaces:
mpicbg.imglib.algorithm.Algorithm, mpicbg.imglib.algorithm.OutputAlgorithm<mpicbg.imglib.type.logic.BitType>

public class BinaryInterpolation2D
extends java.lang.Object
implements mpicbg.imglib.algorithm.OutputAlgorithm<mpicbg.imglib.type.logic.BitType>

Given two binary images of the same dimensions, generate an interpolated image that sits somewhere in between, as specified by the weight. For each binary image, the edges are found and then each pixel is assigned a distance to the nearest edge. Inside, distance values are positive; outside, negative. Then both processed images are compared, and wherever the weighted sum is larger than zero, the result image gets a pixel set to true (or white, meaning inside). A weight of zero means that the first image is not present at all in the interpolated image; a weight of one means that the first image is present exclusively. The code was originally created by Johannes Schindelin in the VIB's vib.BinaryInterpolator class, for ij.ImagePlus.


Constructor Summary
BinaryInterpolation2D(mpicbg.imglib.image.Image<mpicbg.imglib.type.logic.BitType> img1, mpicbg.imglib.image.Image<mpicbg.imglib.type.logic.BitType> img2, float weight)
           
 
Method Summary
 boolean checkInput()
           
 java.lang.String getErrorMessage()
           
 mpicbg.imglib.image.Image<mpicbg.imglib.type.logic.BitType> getResult()
           
 boolean process()
           
 mpicbg.imglib.image.Image<mpicbg.imglib.type.logic.BitType> process(float weight)
          The first time, it will prepare the distance transform images, which are computed only once.
 void setWeight(float weight)
          After changing the weight, it's totally valid to call process() again, and then getResult().
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BinaryInterpolation2D

public BinaryInterpolation2D(mpicbg.imglib.image.Image<mpicbg.imglib.type.logic.BitType> img1,
                             mpicbg.imglib.image.Image<mpicbg.imglib.type.logic.BitType> img2,
                             float weight)
Method Detail

getResult

public mpicbg.imglib.image.Image<mpicbg.imglib.type.logic.BitType> getResult()
Specified by:
getResult in interface mpicbg.imglib.algorithm.OutputAlgorithm<mpicbg.imglib.type.logic.BitType>

checkInput

public boolean checkInput()
Specified by:
checkInput in interface mpicbg.imglib.algorithm.Algorithm

getErrorMessage

public java.lang.String getErrorMessage()
Specified by:
getErrorMessage in interface mpicbg.imglib.algorithm.Algorithm

setWeight

public void setWeight(float weight)
               throws java.lang.IllegalArgumentException
After changing the weight, it's totally valid to call process() again, and then getResult().

Throws:
java.lang.IllegalArgumentException

process

public boolean process()
Specified by:
process in interface mpicbg.imglib.algorithm.Algorithm

process

public mpicbg.imglib.image.Image<mpicbg.imglib.type.logic.BitType> process(float weight)
The first time, it will prepare the distance transform images, which are computed only once.