Home | Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages |
#include <itkOpenCLSampler.h>
The OpenCLSampler class represents an OpenCL sampler object.
A sampler object describes how to sample an image when the image is read in the kernel. The built-in functions to read from an image in a kernel take a sampler as an argument. The sampler arguments to the image read function can be sampler objects created using OpenCL functions and passed as argument values to the kernel or can be samplers declared inside a kernel. In this section we discuss how sampler objects are created using OpenCL functions.
The GetFilterMode() specifies the type of filter that must be applied when reading an image. This can be {CL_FILTER_NEAREST}, or
{CL_FILTER_LINEAR}.
The GetAddressingMode() specifies how out-of-range image coordinates are handled when reading from an image. This can be set to {CL_ADDRESS_MIRRORED_REPEAT},
{CL_ADDRESS_REPEAT},
{CL_ADDRESS_CLAMP_TO_EDGE},
{CL_ADDRESS_CLAMP} and
{CL_ADDRESS_NONE}.
Samplers are created using OpenCLContext::CreateSampler(), as follows:
Samplers can also be defined as literals in the OpenCL kernel source code, which avoids the need to create an explicit OpenCLSampler value:
The main advantage of OpenCLSampler over literal sampler values is that OpenCLSampler allows the pixel derivation strategy to be modified at runtime.
Definition at line 71 of file itkOpenCLSampler.h.
Public Types | |
enum | AddressingMode { None = 0x1130 , ClampToEdge = 0x1131 , Clamp = 0x1132 , Repeat = 0x1133 , MirroredRepeat = 0x1134 } |
enum | FilterMode { Nearest = 0x1140 , Linear = 0x1141 } |
typedef OpenCLSampler | Self |
Public Member Functions | |
OpenCLSampler::AddressingMode | GetAddressingMode () const |
OpenCLContext * | GetContext () const |
OpenCLSampler::FilterMode | GetFilterMode () const |
bool | GetNormalizedCoordinates () const |
cl_sampler | GetSamplerId () const |
bool | IsNull () const |
OpenCLSampler () | |
OpenCLSampler (const OpenCLSampler &other) | |
OpenCLSampler (OpenCLContext *context, cl_sampler id) | |
OpenCLSampler & | operator= (const OpenCLSampler &other) |
~OpenCLSampler () | |
Private Attributes | |
OpenCLContext * | m_Context |
cl_sampler | m_Id |
Standard class typedefs.
Definition at line 76 of file itkOpenCLSampler.h.
Enumerator | |
---|---|
None | |
ClampToEdge | |
Clamp | |
Repeat | |
MirroredRepeat |
Definition at line 107 of file itkOpenCLSampler.h.
Enumerator | |
---|---|
Nearest | |
Linear |
Definition at line 121 of file itkOpenCLSampler.h.
|
inline |
Constructs a null OpenCL sampler object.
Definition at line 79 of file itkOpenCLSampler.h.
|
inline |
Constructs an OpenCL sampler object from the native identifier id. This class takes over ownership of id and will release it in the destructor. The sampler id will be associated with context.
Definition at line 84 of file itkOpenCLSampler.h.
itk::OpenCLSampler::OpenCLSampler | ( | const OpenCLSampler & | other | ) |
Constructs a copy of other. The {clRetainSampler()} function will be called to update the reference count on GetSamplerId().
itk::OpenCLSampler::~OpenCLSampler | ( | ) |
Releases this OpenCL sampler object by calling {clReleaseSampler()}.
OpenCLSampler::AddressingMode itk::OpenCLSampler::GetAddressingMode | ( | ) | const |
Returns the addressing mode for out-of-range co-ordinates when reading from an image in OpenCL.
|
inline |
Returns the OpenCL context that this sampler was created for; null if not yet created within a context.
Definition at line 148 of file itkOpenCLSampler.h.
OpenCLSampler::FilterMode itk::OpenCLSampler::GetFilterMode | ( | ) | const |
Returns the type of filter to apply when reading from an image in OpenCL.
bool itk::OpenCLSampler::GetNormalizedCoordinates | ( | ) | const |
Returns true if this sampler is using normalized co-ordinates, false otherwise.
|
inline |
Returns the native OpenCL identifier for this sampler; or 0 if the sampler is null.
Definition at line 144 of file itkOpenCLSampler.h.
|
inline |
Returns true if this OpenCL sampler object is null, false otherwise.
Definition at line 127 of file itkOpenCLSampler.h.
OpenCLSampler & itk::OpenCLSampler::operator= | ( | const OpenCLSampler & | other | ) |
Assigns other to this OpenCL sampler object. The current samplerId() will be released with {clReleaseSampler()}, and the new samplerId() will be retained with
{clRetainSampler()}.
|
private |
Definition at line 152 of file itkOpenCLSampler.h.
|
private |
Definition at line 153 of file itkOpenCLSampler.h.
Generated on 1667476801 for elastix by 1.9.4 |