java.lang.Object
imagingbook.common.image.PixelPack.PixelSlice
- Enclosing class:
PixelPack
Inner class representing a single (scalar-valued) component of a (vector-valued)
PixelPack.-
Method Summary
Modifier and TypeMethodDescriptionvoidcopyTo(PixelPack.PixelSlice other) Copies the contents of this pixel slice to another pixel slice.float[][]get3x3Neighborhood(int uc, int vc, float[][] nh) Returns the pixel values from the 3x3 neighborhood centered at the specified position.float[]getArray()Returns a reference to the data array associated with this pixel slice.Returns aFloatProcessorfor thisPixelPack.PixelSlicesharing the internal pixel data (nothing is copied).Returns aFloatProcessorfor thisPixelPack.PixelSliceby copying the internal pixel data.intReturns the height of the associated image (see alsoGridIndexer2D).intgetIndex()Returns the slice index for this pixel slice, i.e, the component number in the containing pixel pack. -1 is returned if the pixel slice is not associated with a pixel pack.intReturns the length (number of pixels) of the associated 1D pixel array.floatgetVal(int u, int v) Returns the pixel value for the specified image position.intgetWidth()Returns the width of the associated image (see alsoGridIndexer2D).voidsetVal(int u, int v, float val) Sets the pixel value at the specified image position.voidzero()Sets all pixel values to zero.
-
Method Details
-
getVal
Returns the pixel value for the specified image position.- Parameters:
u- the x-positionv- the y-position- Returns:
- the slice value
-
setVal
Sets the pixel value at the specified image position.- Parameters:
u- the x-positionv- the y-positionval- the new value
-
getIndex
Returns the slice index for this pixel slice, i.e, the component number in the containing pixel pack. -1 is returned if the pixel slice is not associated with a pixel pack.- Returns:
- the slice index
-
getArray
Returns a reference to the data array associated with this pixel slice.- Returns:
- the data array
-
getFloatProcessor
Returns aFloatProcessorfor thisPixelPack.PixelSlicesharing the internal pixel data (nothing is copied).- Returns:
- a
FloatProcessor
-
getFloatProcessorCopy
Returns aFloatProcessorfor thisPixelPack.PixelSliceby copying the internal pixel data.- Returns:
- a
FloatProcessor
-
getLength
Returns the length (number of pixels) of the associated 1D pixel array.- Returns:
- the length of the image array
-
getWidth
Returns the width of the associated image (see alsoGridIndexer2D).- Returns:
- the image width
-
getHeight
Returns the height of the associated image (see alsoGridIndexer2D).- Returns:
- the image height
-
zero
Sets all pixel values to zero. -
copyTo
Copies the contents of this pixel slice to another pixel slice.- Parameters:
other- the pixel slice to modified
-
get3x3Neighborhood
Returns the pixel values from the 3x3 neighborhood centered at the specified position. The 3x3 arraynh[x][y]has the coordinates x = 0,..,2 and y = 0,..,2; the value at position[1][1]belongs to the specified position. If a non-null array is supplied, it is filled and returned. If null, a new array is created and returned.- Parameters:
uc- the center x-positionvc- the center y-positionnh- a 3x3 array or null- Returns:
- a 3x3 array of pixel values
-