org.dcm4chee.imagetest
Class ImageDiff

java.lang.Object
  extended by org.dcm4chee.imagetest.ImageDiff

public class ImageDiff
extends Object

Performs a different on two images. Optionally writes the differenced (second) image out, and writes out information about the differences.

Author:
bwallace

Field Summary
static boolean writeDiff
           
static boolean writeImage
           
static boolean writeInfo
           
 
Constructor Summary
ImageDiff(BufferedImage i1, BufferedImage i2, String fileBase, long allowedDiff)
          Compares two images, i1 and i2, writing information out to fileBase about the differences.
 
Method Summary
protected  int colourDiff(int c1, int c2)
          Returns the difference in the colour component
protected  int colourDiffPixel(int c1, int c2)
          Returns a pixel representing the difference in the colour component
protected  void computeDiffs(BufferedImage i1, BufferedImage i2, BufferedImage i3)
           
 long getMaxDiff()
           
 long getPixelCount()
           
 long getSumDifference()
           
 long getSumSqrDifference()
           
protected  int grayDiffPixel(int diff)
          Returns a gray pixel diff
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

writeImage

public static boolean writeImage

writeDiff

public static boolean writeDiff

writeInfo

public static boolean writeInfo
Constructor Detail

ImageDiff

public ImageDiff(BufferedImage i1,
                 BufferedImage i2,
                 String fileBase,
                 long allowedDiff)
          throws IOException
Compares two images, i1 and i2, writing information out to fileBase about the differences.

Parameters:
i1 - - this is typically the "correct" image.
i2 - - this is typically the image you are testing.
fileBase - - this is the location to use for saving files
allowedDiff - - this is the amount of difference, per pixel that is allowed.
Throws:
IOException
Method Detail

computeDiffs

protected void computeDiffs(BufferedImage i1,
                            BufferedImage i2,
                            BufferedImage i3)

colourDiff

protected int colourDiff(int c1,
                         int c2)
Returns the difference in the colour component


colourDiffPixel

protected int colourDiffPixel(int c1,
                              int c2)
Returns a pixel representing the difference in the colour component


grayDiffPixel

protected int grayDiffPixel(int diff)
Returns a gray pixel diff


getMaxDiff

public long getMaxDiff()

getPixelCount

public long getPixelCount()

getSumDifference

public long getSumDifference()

getSumSqrDifference

public long getSumSqrDifference()


Copyright © 2011. All Rights Reserved.