Package net.sourceforge.jiu.filters
Class BorderSampleGenerator
- java.lang.Object
-
- net.sourceforge.jiu.filters.BorderSampleGenerator
-
public abstract class BorderSampleGenerator extends Object
Abstract base class for classes that fill anint
array with samples from a rectangular region of an image's channel by (1) copyingint
samples from anIntegerImage
object and by (2) generating samples that lie outside of the image. To be used byConvolutionKernelFilter
and other operations that require rectangular parts of an image that may not lie fully inside of the image.- Since:
- 0.10.0
- Author:
- Marco Schmidt
-
-
Field Summary
Fields Modifier and Type Field Description private int
areaHeight
private int
areaWidth
private int
channelIndex
private IntegerImage
image
-
Constructor Summary
Constructors Constructor Description BorderSampleGenerator(IntegerImage integerImage, int areaWidth, int areaHeight)
Initialize width and height of the area to be covered in every call tofill(int, int, int[])
, also provides the image to be used for data copying.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract void
fill(int x, int y, int[] samples)
Fills the argument array with samples from the current channel of the image given to the constructor, generating samples that lie outside of the image.int
getAreaHeight()
Returns the number of rows from which data is copied or generated with every call tofill(int, int, int[])
.int
getAreaWidth()
Returns the number of columns from which data is copied or generated with every call tofill(int, int, int[])
.int
getChannelIndex()
Returns the index of the channel of the image from which data is copied.IntegerImage
getImage()
Returns the image from which data is copied.void
setChannelIndex(int newChannelIndex)
Sets the channel from which data is copied infill(int, int, int[])
.
-
-
-
Field Detail
-
areaWidth
private int areaWidth
-
areaHeight
private int areaHeight
-
channelIndex
private int channelIndex
-
image
private IntegerImage image
-
-
Constructor Detail
-
BorderSampleGenerator
public BorderSampleGenerator(IntegerImage integerImage, int areaWidth, int areaHeight)
Initialize width and height of the area to be covered in every call tofill(int, int, int[])
, also provides the image to be used for data copying. The current channel is set to 0.- Parameters:
integerImage
- the image from which samples will be copiedareaWidth
- number of columns of the area to be covered infill(int, int, int[])
areaHeight
- number of rows of the area to be covered infill(int, int, int[])
-
-
Method Detail
-
fill
public abstract void fill(int x, int y, int[] samples)
Fills the argument array with samples from the current channel of the image given to the constructor, generating samples that lie outside of the image. The samples are copied (or generated) from the row y to row y + areaHeight - 1, and within each row from column x to x + areaWidth - 1.The implementation of this method is left to the child classes. There are different ways to generate new samples, and each child class is supposed to implement another way. Obviously, the child classes also must copy samples from the image.
- Parameters:
x
- leftmost column to be copied or generatedy
- top row to be copied or generatedsamples
- array to which samples will be written; must have at leastgetAreaWidth()
timesgetAreaHeight()
elements
-
getAreaHeight
public int getAreaHeight()
Returns the number of rows from which data is copied or generated with every call tofill(int, int, int[])
.- Returns:
- number or rows of a fill area
-
getAreaWidth
public int getAreaWidth()
Returns the number of columns from which data is copied or generated with every call tofill(int, int, int[])
.- Returns:
- number or columns of a fill area
-
getChannelIndex
public int getChannelIndex()
Returns the index of the channel of the image from which data is copied.- Returns:
- number or rows
- See Also:
setChannelIndex(int)
-
getImage
public IntegerImage getImage()
Returns the image from which data is copied.- Returns:
- image object
-
setChannelIndex
public void setChannelIndex(int newChannelIndex)
Sets the channel from which data is copied infill(int, int, int[])
.- See Also:
getChannelIndex()
-
-