Class SubImageWrapper<I>
- java.lang.Object
-
- science.aist.imaging.api.domain.wrapper.SubImageWrapper<I>
-
- Type Parameters:
I
- The type of the image
- All Implemented Interfaces:
Serializable
,AutoCloseable
,ImageWrapper<I>
public class SubImageWrapper<I> extends Object implements ImageWrapper<I>
Class that represents a sub ROI of a referenced image
- Since:
- 1.0
- Author:
- Christoph Praschl
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description SubImageWrapper(ImageWrapper<I> reference, int startX, int startY, int width, int height)
SubImageWrapper(ImageWrapper<I> reference, JavaRectangle2D roi)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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 exceptionint
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 channelint
getWidth()
void
setValue(int x, int y, int channel, double val)
Sets a value for a specific pixel and channelboolean
supportsParallelAccess()
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface science.aist.imaging.api.domain.wrapper.ImageWrapper
applyColumnFunction, applyFunction, applyFunction, applyFunction, copyTo, createCopy, createCopy, getValues, getValuesAsColor, setValues, setValues
-
-
-
-
Constructor Detail
-
SubImageWrapper
public SubImageWrapper(ImageWrapper<I> reference, JavaRectangle2D roi)
-
SubImageWrapper
public SubImageWrapper(ImageWrapper<I> reference, int startX, int startY, int width, int height)
-
-
Method Detail
-
getImage
public I getImage()
Description copied from interface:ImageWrapper
Getter for the wrapped image.- Specified by:
getImage
in interfaceImageWrapper<I>
- Returns:
- Attention: returns the referenced image not the sub image! If you want to get the sub image create a deep copy using
ImageWrapper.createCopy(ImageFactory)
orImageWrapper.copyTo(ImageWrapper)
-
getWidth
public int getWidth()
- Specified by:
getWidth
in interfaceImageWrapper<I>
- Returns:
- The image width
-
getHeight
public int getHeight()
- Specified by:
getHeight
in interfaceImageWrapper<I>
- Returns:
- The image height
-
getChannelType
public ChannelType getChannelType()
- Specified by:
getChannelType
in interfaceImageWrapper<I>
- Returns:
- The channelType of the image
-
close
public void close()
Description copied from interface:ImageWrapper
Overrides signature of close method fromAutoCloseable
Interface to not throw an exception- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceImageWrapper<I>
-
getValue
public double getValue(int x, int y, int channel)
Description copied from interface:ImageWrapper
Returns the value for a specific pixel and channel- Specified by:
getValue
in interfaceImageWrapper<I>
- 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
-
setValue
public void setValue(int x, int y, int channel, double val)
Description copied from interface:ImageWrapper
Sets a value for a specific pixel and channel- Specified by:
setValue
in interfaceImageWrapper<I>
- 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
-
getChannels
public int getChannels()
- Specified by:
getChannels
in interfaceImageWrapper<I>
- Returns:
- The number of channels
-
supportsParallelAccess
public boolean supportsParallelAccess()
- Specified by:
supportsParallelAccess
in interfaceImageWrapper<I>
- Returns:
- true iff the image wrapper supports parallel write access. Else false
-
applyFunction
public void applyFunction(PixelFunction function, int startX, int startY, int endX, int endY, int strideX, int strideY, boolean applyParallel)
Description copied from interface:ImageWrapper
Applies the given function for the pixels of the image segment defined by [startX, endX] and [startY, endX]- Specified by:
applyFunction
in interfaceImageWrapper<I>
- 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()}!
-
getSupportedType
public Class<I> getSupportedType()
- Specified by:
getSupportedType
in interfaceImageWrapper<I>
- Returns:
- the supported image type.
-
-