Package net.haesleinhuepf.clij.clearcl
Class ClearCLHostImageBuffer
- java.lang.Object
-
- net.haesleinhuepf.clij.clearcl.abs.ClearCLBase
-
- net.haesleinhuepf.clij.clearcl.abs.ClearCLMemBase
-
- net.haesleinhuepf.clij.clearcl.ClearCLHostImageBuffer
-
- All Implemented Interfaces:
AutoCloseable,ClearCLImageInterface,ClearCLMemInterface,net.haesleinhuepf.clij.coremem.interfaces.SizedInBytes
public class ClearCLHostImageBuffer extends ClearCLMemBase implements ClearCLMemInterface, ClearCLImageInterface
ClearCLHostImageBuffer is the ClearCL abstraction for CPU RAM images.- Author:
- royer
-
-
Constructor Summary
Constructors Constructor Description ClearCLHostImageBuffer(ClearCLContext pClearCLContext, net.haesleinhuepf.clij.coremem.ContiguousMemoryInterface pContiguousMemoryInterface, net.haesleinhuepf.clij.coremem.enums.NativeTypeEnum pNativeType, long pNumberOfChannels, long... pDimensions)Creates a host image buffer from a context, an existing contiguous memory object, native type, number of channels, and dimensions.ClearCLHostImageBuffer(ClearCLContext pClearCLContext, net.haesleinhuepf.clij.coremem.enums.NativeTypeEnum pNativeType, long pNumberOfChannels, long... pDimensions)Creates a host image buffer from a context, native type, number of channels, and dimensions.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ClearCLHostImageBufferallocateSameAs(ClearCLImageInterface pClearCLImage)Allocates a host image buffer of same dimensions than a given image.voidclose()voidcopyTo(ClearCLBuffer pBuffer, boolean pBlockingWrite)Copies the contents of this image to a given buffer.voidcopyTo(ClearCLImage pImage, boolean pBlockingWrite)Copies the contents of this image to a given image.ClearCLContextgetContext()Returns ClearCL context associated to this OpenCL mem object.net.haesleinhuepf.clij.coremem.ContiguousMemoryInterfacegetContiguousMemory()Returns the contiguous memory object used to store the data.long[]getDimensions()Returns this image dimensions.HostAccessTypegetHostAccessType()Returns host access typeStringgetName()net.haesleinhuepf.clij.coremem.enums.NativeTypeEnumgetNativeType()Returns native typelonggetNumberOfChannels()Returns the number of channels in this imagelonggetPixelSizeInBytes()Returns pixel/voxel size in byteslonggetSizeInBytes()voidreadFrom(Buffer pBuffer, boolean pBlockingRead)Copies image into NIO buffervoidreadFrom(net.haesleinhuepf.clij.coremem.ContiguousMemoryInterface pContiguousMemory, boolean pBlockingRead)Copies image from CoreMem contiguous memoryvoidsetName(String name)StringtoString()voidwriteTo(Buffer pBuffer, boolean pBlockingWrite)Copies image into NIO buffervoidwriteTo(net.haesleinhuepf.clij.coremem.ContiguousMemoryInterface pContiguousMemory, boolean pBlockingWrite)Copies image into CoreMem contiguous memory-
Methods inherited from class net.haesleinhuepf.clij.clearcl.abs.ClearCLMemBase
addListener, getKernelAccessType, getMemAllocMode, notifyListenersOfChange, removeListener
-
Methods inherited from class net.haesleinhuepf.clij.clearcl.abs.ClearCLBase
getBackend, getPeerPointer, setPeerPointer
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface net.haesleinhuepf.clij.clearcl.interfaces.ClearCLImageInterface
getBackend, getDepth, getDimension, getHeight, getPeerPointer, getVolume, getWidth
-
Methods inherited from interface net.haesleinhuepf.clij.clearcl.interfaces.ClearCLMemInterface
addListener, getKernelAccessType, getMemAllocMode, notifyListenersOfChange
-
-
-
-
Field Detail
-
name
protected String name
-
-
Constructor Detail
-
ClearCLHostImageBuffer
public ClearCLHostImageBuffer(ClearCLContext pClearCLContext, net.haesleinhuepf.clij.coremem.enums.NativeTypeEnum pNativeType, long pNumberOfChannels, long... pDimensions)
Creates a host image buffer from a context, native type, number of channels, and dimensions.- Parameters:
pClearCLContext- contextpNativeType- native typepNumberOfChannels- number of channelspDimensions- dimensions
-
ClearCLHostImageBuffer
public ClearCLHostImageBuffer(ClearCLContext pClearCLContext, net.haesleinhuepf.clij.coremem.ContiguousMemoryInterface pContiguousMemoryInterface, net.haesleinhuepf.clij.coremem.enums.NativeTypeEnum pNativeType, long pNumberOfChannels, long... pDimensions)
Creates a host image buffer from a context, an existing contiguous memory object, native type, number of channels, and dimensions.- Parameters:
pClearCLContext- contextpContiguousMemoryInterface- contiguous memorypNativeType- native typepNumberOfChannels- number of channelspDimensions- dimensions
-
-
Method Detail
-
allocateSameAs
public static ClearCLHostImageBuffer allocateSameAs(ClearCLImageInterface pClearCLImage)
Allocates a host image buffer of same dimensions than a given image.- Parameters:
pClearCLImage- image template- Returns:
- newly allocated image.
-
getContext
public ClearCLContext getContext()
Description copied from interface:ClearCLMemInterfaceReturns ClearCL context associated to this OpenCL mem object.- Specified by:
getContextin interfaceClearCLMemInterface- Returns:
- context
-
getContiguousMemory
public net.haesleinhuepf.clij.coremem.ContiguousMemoryInterface getContiguousMemory()
Returns the contiguous memory object used to store the data.- Returns:
- contiguous memory used internally
-
getHostAccessType
public HostAccessType getHostAccessType()
Description copied from class:ClearCLMemBaseReturns host access type- Specified by:
getHostAccessTypein interfaceClearCLMemInterface- Overrides:
getHostAccessTypein classClearCLMemBase- Returns:
- host acess type
-
getDimensions
public long[] getDimensions()
Description copied from interface:ClearCLImageInterfaceReturns this image dimensions.- Specified by:
getDimensionsin interfaceClearCLImageInterface- Returns:
- dimensions
-
getNativeType
public net.haesleinhuepf.clij.coremem.enums.NativeTypeEnum getNativeType()
Description copied from interface:ClearCLImageInterfaceReturns native type- Specified by:
getNativeTypein interfaceClearCLImageInterface- Returns:
- native type
-
getPixelSizeInBytes
public long getPixelSizeInBytes()
Description copied from interface:ClearCLImageInterfaceReturns pixel/voxel size in bytes- Specified by:
getPixelSizeInBytesin interfaceClearCLImageInterface- Returns:
- pixel/voxel size in bytes
-
getNumberOfChannels
public long getNumberOfChannels()
Description copied from interface:ClearCLImageInterfaceReturns the number of channels in this image- Specified by:
getNumberOfChannelsin interfaceClearCLImageInterface- Returns:
- number of channels
-
getSizeInBytes
public long getSizeInBytes()
- Specified by:
getSizeInBytesin interfacenet.haesleinhuepf.clij.coremem.interfaces.SizedInBytes
-
copyTo
public void copyTo(ClearCLImage pImage, boolean pBlockingWrite)
Description copied from interface:ClearCLImageInterfaceCopies the contents of this image to a given image.- Specified by:
copyToin interfaceClearCLImageInterface- Parameters:
pImage- destination imagepBlockingWrite- trueblocking call, false asynchronous call
-
copyTo
public void copyTo(ClearCLBuffer pBuffer, boolean pBlockingWrite)
Description copied from interface:ClearCLImageInterfaceCopies the contents of this image to a given buffer.- Specified by:
copyToin interfaceClearCLImageInterface- Parameters:
pBuffer- destination bufferpBlockingWrite- trueblocking call, false asynchronous call
-
writeTo
public void writeTo(net.haesleinhuepf.clij.coremem.ContiguousMemoryInterface pContiguousMemory, boolean pBlockingWrite)Description copied from interface:ClearCLImageInterfaceCopies image into CoreMem contiguous memory- Specified by:
writeToin interfaceClearCLImageInterface- Parameters:
pContiguousMemory- contiguous memorypBlockingWrite- trueblocking call, false asynchronous call
-
writeTo
public void writeTo(Buffer pBuffer, boolean pBlockingWrite)
Description copied from interface:ClearCLImageInterfaceCopies image into NIO buffer- Specified by:
writeToin interfaceClearCLImageInterface- Parameters:
pBuffer- NIO bufferpBlockingWrite- trueblocking call, false asynchronous call
-
readFrom
public void readFrom(net.haesleinhuepf.clij.coremem.ContiguousMemoryInterface pContiguousMemory, boolean pBlockingRead)Description copied from interface:ClearCLImageInterfaceCopies image from CoreMem contiguous memory- Specified by:
readFromin interfaceClearCLImageInterface- Parameters:
pContiguousMemory- contiguous memorypBlockingRead- trueblocking call, false asynchronous call
-
readFrom
public void readFrom(Buffer pBuffer, boolean pBlockingRead)
Description copied from interface:ClearCLImageInterfaceCopies image into NIO buffer- Specified by:
readFromin interfaceClearCLImageInterface- Parameters:
pBuffer- NIO bufferpBlockingRead- trueblocking call, false asynchronous call
-
setName
public void setName(String name)
- Specified by:
setNamein interfaceClearCLImageInterface
-
getName
public String getName()
- Specified by:
getNamein interfaceClearCLImageInterface
-
toString
public String toString()
- Overrides:
toStringin classClearCLMemBase
-
close
public void close()
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceClearCLImageInterface- Specified by:
closein classClearCLBase
-
-