Package gov.nih.mipav.model.algorithms
Interface ContourPlot.PixelBase
-
- All Known Implementing Classes:
ContourPlot.Pixel
- Enclosing class:
- ContourPlot
public static interface ContourPlot.PixelBase
Basic interface for Pixel classes ofContourPlot.ImgBase
implementations.
An implementation of PixelBase stores a position and works like a pointer into the data of an image. An instance of PixelBase (or any implementation of it) is NOT the pixel value of an image at a specific location and changing its position will not change that image. Instead an instance is used to iterate the pixel values of an image. Such a pixel value can be retrieved and manipulated as long as the instance points to it.- Since:
- 2.0
- Author:
- hageldave
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description double
a_asDouble()
Returns the alpha value of this pixel at its current position.default java.lang.String
asString()
Returns a String representation of this pixel at its current position.double
b_asDouble()
Returns the blue value of this pixel at its current position.double
g_asDouble()
Returns the green value of this pixel at its current position.int
getIndex()
Returns this pixel's index.ContourPlot.ImgBase<?>
getSource()
Returns the underlying image of this pixel (the image referenced by this pixel)int
getX()
default double
getXnormalized()
Returns the normalized x coordinate of this Pixel.int
getY()
default double
getYnormalized()
Returns the normalized y coordinate of this Pixel.double
r_asDouble()
Returns the red value of this pixel at its current position.ContourPlot.PixelBase
setA_fromDouble(double a)
Sets the alpha value of this pixel at its current position with 0.0 as fully transparent and 1.0 as fully opaque.default ContourPlot.PixelBase
setARGB_fromDouble(double a, double r, double g, double b)
Sets the alpha, red, green and blue value of this pixel.ContourPlot.PixelBase
setB_fromDouble(double b)
Sets the blue value of this pixel at its current position with 0.0 as no blue contribution and 1.0 as full blue contribution.ContourPlot.PixelBase
setG_fromDouble(double g)
Sets the green value of this pixel at its current position with 0.0 as no green contribution and 1.0 as full green contribution.ContourPlot.PixelBase
setIndex(int index)
Sets the index of this pixel and thus its position.ContourPlot.PixelBase
setPosition(int x, int y)
Sets the position of this pixel to the specified coordinates.ContourPlot.PixelBase
setR_fromDouble(double r)
Sets the red value of this pixel at its current position with 0.0 as no red contribution and 1.0 as full red contribution.default ContourPlot.PixelBase
setRGB_fromDouble(double r, double g, double b)
Sets the red, green and blue value of this pixel.default ContourPlot.PixelBase
setRGB_fromDouble_preserveAlpha(double r, double g, double b)
Sets the red, green and blue value of this pixel.
-
-
-
Method Detail
-
a_asDouble
double a_asDouble()
Returns the alpha value of this pixel at its current position. If the underlying image does not support alpha, 1.0 is returned.- Returns:
- alpha value of this pixel with 0.0 as fully transparent and 1.0 as fully opaque. May exceed [0,1] range depending on implementation.
- See Also:
setA_fromDouble(double)
,r_asDouble()
,g_asDouble()
,b_asDouble()
-
r_asDouble
double r_asDouble()
Returns the red value of this pixel at its current position.- Returns:
- red value of this pixel with 0.0 as no red contribution and 1.0 as full red contribution. May exceed [0,1] range depending on implementation.
- See Also:
setR_fromDouble(double)
,a_asDouble()
,g_asDouble()
,b_asDouble()
-
g_asDouble
double g_asDouble()
Returns the green value of this pixel at its current position.- Returns:
- green value of this pixel with 0.0 as no green contribution and 1.0 as full green contribution. May exceed [0,1] range depending on implementation.
- See Also:
setG_fromDouble(double)
,a_asDouble()
,r_asDouble()
,b_asDouble()
-
b_asDouble
double b_asDouble()
Returns the blue value of this pixel at its current position.- Returns:
- blue value of this pixel with 0.0 as no blue contribution and 1.0 as full blue contribution. May exceed [0,1] range depending on implementation.
- See Also:
setB_fromDouble(double)
,a_asDouble()
,r_asDouble()
,g_asDouble()
-
setA_fromDouble
ContourPlot.PixelBase setA_fromDouble(double a)
Sets the alpha value of this pixel at its current position with 0.0 as fully transparent and 1.0 as fully opaque. If the underlying image does not support alpha, this call imediately returns without modifying the image.- Parameters:
a
- the alpha value. May exceed [0,1] range depending on implementation.- Returns:
- this pixel for chaining.
- See Also:
a_asDouble()
,setR_fromDouble(double)
,setG_fromDouble(double)
,setB_fromDouble(double)
,setARGB_fromDouble(double, double, double, double)
-
setR_fromDouble
ContourPlot.PixelBase setR_fromDouble(double r)
Sets the red value of this pixel at its current position with 0.0 as no red contribution and 1.0 as full red contribution.- Parameters:
r
- the red value. May exceed [0,1] range depending on implementation.- Returns:
- this pixel for chaining.
- See Also:
r_asDouble()
,setA_fromDouble(double)
,setG_fromDouble(double)
,setB_fromDouble(double)
,setARGB_fromDouble(double, double, double, double)
-
setG_fromDouble
ContourPlot.PixelBase setG_fromDouble(double g)
Sets the green value of this pixel at its current position with 0.0 as no green contribution and 1.0 as full green contribution.- Parameters:
g
- the green value. May exceed [0,1] range depending on implementation.- Returns:
- this pixel for chaining.
- See Also:
g_asDouble()
,setA_fromDouble(double)
,setR_fromDouble(double)
,setB_fromDouble(double)
,setARGB_fromDouble(double, double, double, double)
-
setB_fromDouble
ContourPlot.PixelBase setB_fromDouble(double b)
Sets the blue value of this pixel at its current position with 0.0 as no blue contribution and 1.0 as full blue contribution.- Parameters:
b
- the blue value. May exceed [0,1] range depending on implementation.- Returns:
- this pixel for chaining.
- See Also:
b_asDouble()
,setA_fromDouble(double)
,setR_fromDouble(double)
,setG_fromDouble(double)
,setARGB_fromDouble(double, double, double, double)
-
setARGB_fromDouble
default ContourPlot.PixelBase setARGB_fromDouble(double a, double r, double g, double b)
Sets the alpha, red, green and blue value of this pixel. Assumed minimum and maximum value for each channel is 0.0 and 1.0 but values may exceed [0,1] range depending on implementation.- Parameters:
a
- alpha value (0=transparent, 1=opaque)r
- red valueg
- green valueb
- blue value- Returns:
- this pixel for chaining.
- See Also:
setRGB_fromDouble_preserveAlpha(double, double, double)
,setRGB_fromDouble(double, double, double)
-
setRGB_fromDouble
default ContourPlot.PixelBase setRGB_fromDouble(double r, double g, double b)
Sets the red, green and blue value of this pixel. The alpha value is set to 1.0 (opaque) if the underlying image supports alpha. Assumed minimum and maximum value for each channel is 0.0 and 1.0 but values may exceed [0,1] range depending on implementation.- Parameters:
r
- red valueg
- green valueb
- blue value- Returns:
- this pixel for chaining.
- See Also:
setARGB_fromDouble(double, double, double, double)
,setRGB_fromDouble_preserveAlpha(double, double, double)
-
setRGB_fromDouble_preserveAlpha
default ContourPlot.PixelBase setRGB_fromDouble_preserveAlpha(double r, double g, double b)
Sets the red, green and blue value of this pixel. The alpha value is preserved. Assumed minimum and maximum value for each channel is 0.0 and 1.0 but values may exceed [0,1] range depending on implementation.- Parameters:
r
- red valueg
- green valueb
- blue value- Returns:
- this pixel for chaining.
- See Also:
setARGB_fromDouble(double, double, double, double)
,setRGB_fromDouble(double, double, double)
-
getX
int getX()
- Returns:
- the x coordinate of this pixel's current position
- See Also:
getY()
,getXnormalized()
,setPosition(int, int)
,getIndex()
,setIndex(int)
-
getY
int getY()
- Returns:
- the y coordinate of this pixel's current position
- See Also:
getX()
,getYnormalized()
,setPosition(int, int)
,getIndex()
,setIndex(int)
-
getXnormalized
default double getXnormalized()
Returns the normalized x coordinate of this Pixel. This will return 0 for Pixels at the left boundary and 1 for Pixels at the right boundary of the Img.
For Img's that are only 1 Pixel wide, NaN is returned.- Returns:
- normalized x coordinate within [0..1]
- See Also:
getX()
,getYnormalized()
,setPosition(int, int)
,getIndex()
,setIndex(int)
-
getYnormalized
default double getYnormalized()
Returns the normalized y coordinate of this Pixel. This will return 0 for Pixels at the upper boundary and 1 for Pixels at the lower boundary of the Img.
For Img's that are only 1 Pixel high, NaN is returned.- Returns:
- normalized y coordinate within [0..1]
- See Also:
getY()
,getXnormalized()
,setPosition(int, int)
,getIndex()
,setIndex(int)
-
getIndex
int getIndex()
Returns this pixel's index. The index relates to the pixels's position in the following way:
index = y * width + x y = index / width x = index % width
- Returns:
- index of this pixel
- See Also:
setIndex(int)
,getX()
,getY()
-
setIndex
ContourPlot.PixelBase setIndex(int index)
Sets the index of this pixel and thus its position. The index relates to the pixels's position in the following way:
index = y * width + x y = index / width x = index % width
Index values outside the range [0, number of pixels] are not allowed but not necessarily enforced either. Accessing image data with an index/position outside of the underlying image's boundaries may cause an Exception.- Parameters:
index
- to set the pixel to- Returns:
- this pixel for chaining
- See Also:
getIndex()
,setPosition(int, int)
-
setPosition
ContourPlot.PixelBase setPosition(int x, int y)
Sets the position of this pixel to the specified coordinates. Positions outside of the underlying images boundaries are not allowed but not necessarily enforced either. Accessing image data with a position outside of the boundaries may cause an Exception.- Parameters:
x
- coordinate (0 left most, width-1 right most)y
- coordinate (0 top most, height-1 bottom most)- Returns:
- this pixel for chaining
- See Also:
getX()
,getY()
,setIndex(int)
-
getSource
ContourPlot.ImgBase<?> getSource()
Returns the underlying image of this pixel (the image referenced by this pixel)- Returns:
- the image this pixel belongs to
- See Also:
ContourPlot.ImgBase
-
asString
default java.lang.String asString()
Returns a String representation of this pixel at its current position. The returned String has the following pattern:
Pixelclass[a:alpha r:red g:green b:blue]@(x,y)- Returns:
- string representation of this pixel at its current position
-
-