Loading...
Searching...
No Matches
itkOpenCLImage.h
Go to the documentation of this file.
/*=========================================================================
*
* Copyright UMC Utrecht and contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0.txt
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*=========================================================================*/
#ifndef itkOpenCLImage_h
#define itkOpenCLImage_h
#include "itkOpenCLMemoryObject.h"
#include "itkOpenCLImageFormat.h"
#include "itkOpenCLEvent.h"
#include "itkOpenCLSize.h"
namespace itk
{
// Forward declaration
class OpenCLBuffer;
class ITKOpenCL_EXPORT OpenCLImage : public OpenCLMemoryObject
{
public:
using Self = OpenCLImage;
using Superclass = OpenCLMemoryObject;
OpenCLImage() = default;
OpenCLImage(OpenCLContext * context, const cl_mem id)
: OpenCLMemoryObject(context, id)
{}
OpenCLImage(const OpenCLImage & other);
OpenCLImage &
operator=(const OpenCLImage & other);
OpenCLImageFormat
GetFormat() const;
std::size_t
GetElementSizeInBytes() const;
std::size_t
GetRowSizeInBytes() const;
std::size_t
GetSliceSizeInBytes() const;
std::size_t
GetDimension() const;
std::size_t
GetWidth() const;
std::size_t
GetHeight() const;
std::size_t
GetDepth() const;
bool
Read(void * data,
const OpenCLSize & origin,
const OpenCLSize & region,
const std::size_t rowPitch = 0,
const std::size_t slicePitch = 0);
OpenCLEvent
ReadAsync(void * data,
const OpenCLSize & origin,
const OpenCLSize & region,
const OpenCLEventList & event_list = OpenCLEventList(),
const std::size_t rowPitch = 0,
const std::size_t slicePitch = 0);
bool
Write(const void * data,
const OpenCLSize & origin,
const OpenCLSize & region,
const std::size_t rowPitch = 0,
const std::size_t slicePitch = 0);
OpenCLEvent
WriteAsync(const void * data,
const OpenCLSize & origin,
const OpenCLSize & region,
const OpenCLEventList & event_list = OpenCLEventList(),
const std::size_t rowPitch = 0,
const std::size_t slicePitch = 0);
void *
Map(const OpenCLMemoryObject::Access access,
const OpenCLSize & origin,
const OpenCLSize & region,
std::size_t * rowPitch = 0,
std::size_t * slicePitch = 0);
OpenCLEvent
MapAsync(void ** data,
const OpenCLMemoryObject::Access access,
const OpenCLSize & origin,
const OpenCLSize & region,
const OpenCLEventList & event_list = OpenCLEventList(),
std::size_t * rowPitch = 0,
std::size_t * slicePitch = 0);
bool
Copy(const OpenCLImage & dest, const OpenCLSize & origin, const OpenCLSize & region, const OpenCLSize & destOrigin);
OpenCLEvent
CopyAsync(const OpenCLImage & dest,
const OpenCLSize & origin,
const OpenCLSize & region,
const OpenCLSize & destOrigin,
const OpenCLEventList & event_list = OpenCLEventList());
bool
Copy(const OpenCLBuffer & dest,
const OpenCLSize & origin,
const OpenCLSize & region,
const std::size_t dst_offset = 0);
OpenCLEvent
CopyAsync(const OpenCLBuffer & dest,
const OpenCLSize & origin,
const OpenCLSize & region,
const OpenCLEventList & event_list = OpenCLEventList(),
const std::size_t dst_offset = 0);
#ifdef CL_VERSION_1_2
static void
SetImageDescription(cl_image_desc & imageDescription, const OpenCLImageFormat & format, const OpenCLSize & size);
#endif
protected:
std::size_t
GetImageInfo(const cl_image_info name) const;
void
SetOrigin(std::size_t * origin_t, const OpenCLSize & origin) const;
void
SetRegion(std::size_t * region_t, const OpenCLSize & region) const;
void
SetSize(std::size_t * region_t, const OpenCLSize & region, const std::size_t value) const;
friend class OpenCLBuffer;
};
template <typename charT, typename traits>
inline std::basic_ostream<charT, traits> &
operator<<(std::basic_ostream<charT, traits> & strm, const OpenCLImage & image)
{
if (image.IsNull())
{
strm << "OpenCLImage(null)";
return strm;
}
const char indent = ' ';
strm << "OpenCLImage\n"
<< indent << "Element size(bytes): " << image.GetElementSizeInBytes() << '\n'
<< indent << "Row size(bytes): " << image.GetRowSizeInBytes() << '\n'
<< indent << "Slice size(bytes): " << image.GetSliceSizeInBytes() << '\n'
<< indent << "Dimension: " << image.GetDimension() << '\n'
<< indent << "Width: " << image.GetWidth() << '\n'
<< indent << "Height: " << image.GetHeight() << '\n'
<< indent << "Depth: " << image.GetDepth() << std::endl;
// Stream OpenCLMemoryObject
const OpenCLMemoryObject & memObj = image;
strm << memObj;
return strm;
}
} // end namespace itk
#endif /* itkOpenCLImage_h */
itk::OpenCLBuffer
The OpenCLBuffer class represents an OpenCL buffer object.
Definition itkOpenCLBuffer.h:54
itk::OpenCLContext
The OpenCLContext class represents an OpenCL context.
Definition itkOpenCLContext.h:77
itk::OpenCLEventList
OpenCLEventList class represents a list of OpenCLEvent objects.
Definition itkOpenCLEventList.h:33
itk::OpenCLEvent
OpenCLEvent class represents an OpenCL event object.
Definition itkOpenCLEvent.h:93
itk::OpenCLImageFormat
The OpenCLImageFormat class represents the format of a OpenCLImage.
Definition itkOpenCLImageFormat.h:35
itk::OpenCLImage
The OpenCLImage class represents an image object is used to store a one, two or three dimensional tex...
Definition itkOpenCLImage.h:39
itk::OpenCLImage::GetRowSizeInBytes
std::vcl_size_t GetRowSizeInBytes() const
itk::OpenCLImage::GetElementSizeInBytes
std::vcl_size_t GetElementSizeInBytes() const
itk::OpenCLImage::ReadAsync
OpenCLEvent ReadAsync(void *data, const OpenCLSize &origin, const OpenCLSize &region, const OpenCLEventList &event_list=OpenCLEventList(), const std::vcl_size_t rowPitch=0, const std::vcl_size_t slicePitch=0)
itk::OpenCLImage::Copy
bool Copy(const OpenCLImage &dest, const OpenCLSize &origin, const OpenCLSize &region, const OpenCLSize &destOrigin)
itk::OpenCLImage::GetWidth
std::vcl_size_t GetWidth() const
itk::OpenCLImage::SetOrigin
void SetOrigin(std::vcl_size_t *origin_t, const OpenCLSize &origin) const
itk::OpenCLImage::OpenCLBuffer
friend class OpenCLBuffer
Definition itkOpenCLImage.h:258
itk::OpenCLImage::operator=
OpenCLImage & operator=(const OpenCLImage &other)
itk::OpenCLImage::Write
bool Write(const void *data, const OpenCLSize &origin, const OpenCLSize &region, const std::vcl_size_t rowPitch=0, const std::vcl_size_t slicePitch=0)
itk::OpenCLImage::GetSliceSizeInBytes
std::vcl_size_t GetSliceSizeInBytes() const
itk::OpenCLImage::OpenCLImage
OpenCLImage()=default
itk::OpenCLImage::OpenCLImage
OpenCLImage(const OpenCLImage &other)
itk::OpenCLImage::GetDimension
std::vcl_size_t GetDimension() const
itk::OpenCLImage::GetDepth
std::vcl_size_t GetDepth() const
itk::OpenCLImage::Copy
bool Copy(const OpenCLBuffer &dest, const OpenCLSize &origin, const OpenCLSize &region, const std::vcl_size_t dst_offset=0)
itk::OpenCLImage::OpenCLImage
OpenCLImage(OpenCLContext *context, const cl_mem id)
Definition itkOpenCLImage.h:52
itk::OpenCLImage::Map
void * Map(const OpenCLMemoryObject::Access access, const OpenCLSize &origin, const OpenCLSize &region, std::vcl_size_t *rowPitch=0, std::vcl_size_t *slicePitch=0)
itk::OpenCLImage::CopyAsync
OpenCLEvent CopyAsync(const OpenCLImage &dest, const OpenCLSize &origin, const OpenCLSize &region, const OpenCLSize &destOrigin, const OpenCLEventList &event_list=OpenCLEventList())
itk::OpenCLImage::SetSize
void SetSize(std::vcl_size_t *region_t, const OpenCLSize &region, const std::vcl_size_t value) const
itk::OpenCLImage::SetRegion
void SetRegion(std::vcl_size_t *region_t, const OpenCLSize &region) const
itk::OpenCLImage::CopyAsync
OpenCLEvent CopyAsync(const OpenCLBuffer &dest, const OpenCLSize &origin, const OpenCLSize &region, const OpenCLEventList &event_list=OpenCLEventList(), const std::vcl_size_t dst_offset=0)
itk::OpenCLImage::Self
OpenCLImage Self
Definition itkOpenCLImage.h:42
itk::OpenCLImage::GetFormat
OpenCLImageFormat GetFormat() const
itk::OpenCLImage::GetHeight
std::vcl_size_t GetHeight() const
itk::OpenCLImage::Superclass
OpenCLMemoryObject Superclass
Definition itkOpenCLImage.h:43
itk::OpenCLImage::WriteAsync
OpenCLEvent WriteAsync(const void *data, const OpenCLSize &origin, const OpenCLSize &region, const OpenCLEventList &event_list=OpenCLEventList(), const std::vcl_size_t rowPitch=0, const std::vcl_size_t slicePitch=0)
itk::OpenCLImage::Read
bool Read(void *data, const OpenCLSize &origin, const OpenCLSize &region, const std::vcl_size_t rowPitch=0, const std::vcl_size_t slicePitch=0)
itk::OpenCLImage::MapAsync
OpenCLEvent MapAsync(void **data, const OpenCLMemoryObject::Access access, const OpenCLSize &origin, const OpenCLSize &region, const OpenCLEventList &event_list=OpenCLEventList(), std::vcl_size_t *rowPitch=0, std::vcl_size_t *slicePitch=0)
itk::OpenCLImage::GetImageInfo
std::vcl_size_t GetImageInfo(const cl_image_info name) const
itk::OpenCLMemoryObject::OpenCLMemoryObject
OpenCLMemoryObject(OpenCLContext *context=0)
Definition itkOpenCLMemoryObject.h:42
itk::OpenCLMemoryObject::Access
Access
Definition itkOpenCLMemoryObject.h:87
itk::OpenCLMemoryObject::IsNull
bool IsNull() const
Definition itkOpenCLMemoryObject.h:95
itk::OpenCLSize
The OpenCLSize class defines the size of an item of work for an OpenCL kernel.
Definition itkOpenCLSize.h:50
itkOpenCLEvent.h
ITKOpenCL_EXPORT
#define ITKOpenCL_EXPORT
Definition itkOpenCLExport.h:33
itkOpenCLImageFormat.h
itkOpenCLMemoryObject.h
itkOpenCLSize.h
itk
Definition itkAdvancedImageToImageMetric.h:43
itk::operator<<
std::basic_ostream< charT, traits > & operator<<(std::basic_ostream< charT, traits > &strm, const OpenCLCommandQueue &queue)
Definition itkOpenCLCommandQueue.h:135

Generated on 1768596610 for elastix by 1.15.0 |