Interface ImageWrapper<I>
-
- Type Parameters:
I
- Target type representing an image which should be wrapped.
- All Superinterfaces:
AutoCloseable
,Serializable
- All Known Implementing Classes:
AbstractImageWrapper
,BufferedImageWrapper
,FImageWrapper
,Image2Byte
,Image8Byte
,ImageProcessorWrapper
,ImageStackWrapper
,INDArrayWrapper
,JavaCVImageWrapper
,MBFImageWrapper
,OpenCVImageWrapper
,SubImageWrapper
,WritableImageWrapper
public interface ImageWrapper<I> extends AutoCloseable, Serializable
Wrapper interface containing the implemented image-container class
- Since:
- 1.0
- Author:
- Christoph Praschl
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default void
applyColumnFunction(ColumnFunction function, int start, int end, int stride, boolean applyParallel)
Function that is applied for a given columndefault void
applyFunction(PixelFunction function)
Applies the given function for every pixel of the image ifsupportsParallelAccess()
this is done parallel.default void
applyFunction(PixelFunction function, boolean applyParallel)
Applies the given function for every pixel of the imagedefault void
applyFunction(PixelFunction function, int startX, int startY, int endX, int endY)
Applies the given function for the pixels of the image segment defined by [startX, endX] and [startY, endX] ifsupportsParallelAccess()
this is done parallel.default void
applyFunction(PixelFunction function, int startX, int startY, int endX, int endY, int strideX, int strideY, boolean applyParallel)
Applies the given function for the pixels of the image segment defined by [startX, endX] and [startY, endX]void
close()
Overrides signature of close method fromAutoCloseable
Interface to not throw an exceptiondefault void
copyTo(ImageWrapper<?> wrapper)
Copy the image of this wrapper into the given wrapperdefault <X> ImageWrapper<X>
createCopy(Class<X> targetClass)
Creates a copy with the given typedefault <X> ImageWrapper<X>
createCopy(ImageFactory<X> provider)
Creates a copy using the givenImageFactory
default int
getChannels()
ChannelType
getChannelType()
int
getHeight()
I
getImage()
Getter for the wrapped image.Class<I>
getSupportedType()
double
getValue(int x, int y, int channel)
Returns the value for a specific pixel and channeldefault double[]
getValues(int x, int y)
Returns all value for a given coordinatedefault Color
getValuesAsColor(int x, int y)
Returns a color value for the given coordinateint
getWidth()
void
setValue(int x, int y, int channel, double val)
Sets a value for a specific pixel and channeldefault void
setValues(int x, int y, double[] values)
Sets values for the given coordinatedefault void
setValues(int x, int y, Color color)
Sets values for the given coordinatedefault boolean
supportsParallelAccess()
-
-
-
Method Detail
-
getImage
I getImage()
Getter for the wrapped image.- Returns:
- Returns the wrapped image.
-
getWidth
int getWidth()
- Returns:
- The image width
-
getHeight
int getHeight()
- Returns:
- The image height
-
getChannels
default int getChannels()
- Returns:
- The number of channels
-
getChannelType
ChannelType getChannelType()
- Returns:
- The channelType of the image
-
close
void close()
Overrides signature of close method fromAutoCloseable
Interface to not throw an exception- Specified by:
close
in interfaceAutoCloseable
-
getValue
double getValue(int x, int y, int channel)
Returns the value for a specific pixel and channel- Parameters:
x
- the x-coordinate of the pixely
- the y-coordinate of the pixelchannel
- the channel to select of a specific pixel- Returns:
- the value for the pixel and channel
-
getValues
default double[] getValues(int x, int y)
Returns all value for a given coordinate- Parameters:
x
- the x-coordinate of the pixely
- the y-coordinate of the pixel- Returns:
- all pixel values at the given position
-
getValuesAsColor
default Color getValuesAsColor(int x, int y)
Returns a color value for the given coordinate- Parameters:
x
- the x-coordinate of the pixely
- the y-coordinate of the pixel- Returns:
- color value of the given position
-
setValue
void setValue(int x, int y, int channel, double val)
Sets a value for a specific pixel and channel- Parameters:
x
- the x-coordinate of the pixely
- the y-coordinate of the pixelchannel
- the channel to select of a specific pixelval
- the value for the pixel and channel
-
setValues
default void setValues(int x, int y, double[] values)
Sets values for the given coordinate- Parameters:
x
- the x-coordinate of the pixely
- the y-coordinate of the pixelvalues
- values for the given coordinate
-
setValues
default void setValues(int x, int y, Color color)
Sets values for the given coordinate- Parameters:
x
- the x-coordinate of the pixely
- the y-coordinate of the pixelcolor
- to be set at the given coordinate
-
supportsParallelAccess
default boolean supportsParallelAccess()
- Returns:
- true iff the image wrapper supports parallel write access. Else false
-
applyFunction
default void applyFunction(PixelFunction function)
Applies the given function for every pixel of the image ifsupportsParallelAccess()
this is done parallel. Note: This function does not change pixels per default; only if you call image.setValue() in the givenPixelFunction
!- Parameters:
function
- function applied for ever pixel
-
applyFunction
default void applyFunction(PixelFunction function, int startX, int startY, int endX, int endY)
Applies the given function for the pixels of the image segment defined by [startX, endX] and [startY, endX] ifsupportsParallelAccess()
this is done parallel. Note: This function does not change pixels per default; only if you call image.setValue() in the givenPixelFunction
!- Parameters:
function
- function applied for ever pixelstartX
- start x coordinate of image segmentstartY
- start y coordinate of image segmentendX
- end x coordinate of image segmentendY
- end y coordinate of image segment
-
applyFunction
default void applyFunction(PixelFunction function, boolean applyParallel)
Applies the given function for every pixel of the image- Parameters:
applyParallel
- flag which decides if function is applied in parallel (ATTENTION: when using this in combination withfor the given image; Always check {@link ImageWrapper#supportsParallelAccess()}!
function
- function applied for ever pixel
-
applyFunction
default void applyFunction(PixelFunction function, int startX, int startY, int endX, int endY, int strideX, int strideY, boolean applyParallel)
Applies the given function for the pixels of the image segment defined by [startX, endX] and [startY, endX]- Parameters:
function
- function applied for ever pixelstartX
- start x coordinate of image segmentstartY
- start y coordinate of image segmentendX
- end x coordinate of image segmentendY
- end y coordinate of image segmentstrideX
- stride for the x coordinate (e.g. take every, every-second, every-third, ... element)strideY
- stride for the y coordinate (e.g. take every, every-second, every-third, ... element)applyParallel
- flag which decides if function is applied in parallel (ATTENTION: when using this in combination withfor the given image; Always check {@link ImageWrapper#supportsParallelAccess()}!
-
applyColumnFunction
default void applyColumnFunction(ColumnFunction function, int start, int end, int stride, boolean applyParallel)
Function that is applied for a given column- Parameters:
function
- to be appliedstart
- start columnend
- end columnstride
- stride for the y coordinate (e.g. take every, every-second, every-third, ... element)applyParallel
- flag which decides if function is applied in parallel (ATTENTION: when using this in combination withfor the given image; Always check {@link ImageWrapper#supportsParallelAccess()}!
-
copyTo
default void copyTo(ImageWrapper<?> wrapper)
Copy the image of this wrapper into the given wrapper- Parameters:
wrapper
- target
-
createCopy
default <X> ImageWrapper<X> createCopy(ImageFactory<X> provider)
Creates a copy using the givenImageFactory
- Type Parameters:
X
- type of wrapped image- Parameters:
provider
- provider- Returns:
- copy of this
-
createCopy
default <X> ImageWrapper<X> createCopy(Class<X> targetClass)
Creates a copy with the given type- Type Parameters:
X
- type of wrapped image- Parameters:
targetClass
- type of the copy- Returns:
- copy of this
- Since:
- 2.0
-
-