Class PixelRecord

java.lang.Object
inra.ijpb.data.PixelRecord
All Implemented Interfaces:
java.lang.Comparable<PixelRecord>

public class PixelRecord
extends java.lang.Object
implements java.lang.Comparable<PixelRecord>
Class to store integer pixel coordinates and its corresponding double value
Author:
Ignacio Arganda-Carreras
  • Constructor Summary

    Constructors
    Constructor Description
    PixelRecord​(int x, int y, double value)
    Create pixel record with cursor position and double value
    PixelRecord​(Cursor2D cursor, double value)
    Create pixel record with cursor position and double value
  • Method Summary

    Modifier and Type Method Description
    int compareTo​(PixelRecord p2)
    Compare with a pixel record based on its value and timestamp
    double euclideanDistance​(PixelRecord pr)
    Calculate Euclidean distance to another pixel record
    Cursor2D getCursor()  
    double getValue()  

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • PixelRecord

      public PixelRecord​(Cursor2D cursor, double value)
      Create pixel record with cursor position and double value
      Parameters:
      cursor - pixel position in 2D coordinates
      value - pixel intensity value
    • PixelRecord

      public PixelRecord​(int x, int y, double value)
      Create pixel record with cursor position and double value
      Parameters:
      x - the x-position of the record
      y - the y-position of the record
      value - pixel intensity value
  • Method Details

    • getCursor

      public Cursor2D getCursor()
      Returns:
      the position of this PixelRecord, as a Cursor2D.
    • getValue

      public double getValue()
      Returns:
      the value stored by this PixelRecord.
    • compareTo

      public int compareTo​(PixelRecord p2)
      Compare with a pixel record based on its value and timestamp
      Specified by:
      compareTo in interface java.lang.Comparable<PixelRecord>
      Parameters:
      p2 - pixel record to compare with
      Returns:
      a value smaller than 0 if the p2 pixel value is larger this pixel record value, a value larger than 0 if it is lower. If equal, the records created before are set as smaller.
    • euclideanDistance

      public double euclideanDistance​(PixelRecord pr)
      Calculate Euclidean distance to another pixel record
      Parameters:
      pr - pixel record to calculate distance to
      Returns:
      Euclidean distance between this pixel record and the input one