Skip to content

Pylon::CPylonDataComponent#

Provides methods for accessing a single component of CPylonDataContainer. More…

#include <pylon/PylonDataComponent.h>

Public Functions#

Name
CPylonDataComponent()
Creates an empty component.
CPylonDataComponent(const CPylonDataComponent & rhs)
Creates a copy of an existing component.
~CPylonDataComponent()
Destroys a pylon data component object.
CPylonDataComponent & operator=(const CPylonDataComponent & rhs)
Assigns the data of another component to this component by copying.
operator const Pylon::IImage &() const
Provides a Pylon::IImage interface to the component.
bool IsValid() const
Can be used to check whether the component is valid.
EComponentType GetComponentType() const
Get the type of data this component contains.
EPixelType GetPixelType() const
Get the type of pixels this component contains.
uint32_t GetWidth() const
Get the current number of columns.
uint32_t GetHeight() const
Get the current number of rows.
uint32_t GetOffsetX() const
Get the starting column.
uint32_t GetOffsetY() const
Get the starting row.
size_t GetPaddingX() const
Get the number of extra bytes at the end of each row.
const void * GetData() const
Get the pointer to the data contained in the component.
size_t GetDataSize() const
Get the size of the buffer returned by Pylon::CPylonDataComponent::GetData().
uint64_t GetTimeStamp() const
Get the camera-specific time the data was created on the camera.
bool GetStride(size_t & strideBytes) const
Get the stride in bytes for the component.

Detailed Description#

class Pylon::CPylonDataComponent;

Provides methods for accessing a single component of CPylonDataContainer.

Attention: Any CPylonDataContainer or CPylonDataComponent will hold a reference to the CGrabResultData from which it has been created. To allow the instant camera to reuse the CGrabResultData and prevent buffer underruns, you must destroy the CPylonDataContainer and all its CPylonDataComponent objects.

Thread Safety:

This class is not thread-safe. If you access the same instance from multiple threads, you must make sure to synchronize the access accordingly.

Some cameras can return complex grab results consisting of multiple components. For example, Basler blaze cameras return a data stream that is composed of range, intensity, and confidence components. To access the individual components, you can use the CPylonDataContainer class.

A CPylonDataContainer can hold one or more components. You can obtain a container by calling Pylon::CGrabResultData::GetDataContainer(). You can then use the container to query for the number of components by calling Pylon::CGrabResultData::GetDataComponentCount(). To retrieve a specific component, you can call Pylon::CGrabResultData::GetDataComponent(). Each component in the container can be used to access the actual data, e.g., the range values, and its metadata.

Public Functions Documentation#

function CPylonDataComponent#

CPylonDataComponent()

Creates an empty component.

Error Safety:

Does not throw C++ exceptions.

Thread Safety:

This class is not thread-safe. If you access the same instance from multiple threads, you must make sure to synchronize the access accordingly.

The default constructor will create an empty component.

function CPylonDataComponent#

CPylonDataComponent(
    const CPylonDataComponent & rhs
)

Creates a copy of an existing component.

Parameters:

  • rhs Source component to copy.

Error Safety:

Does not throw C++ exceptions.

Thread Safety:

This class is not thread-safe. If you access the same instance from multiple threads, you must make sure to synchronize the access accordingly.

When creating a copy of a component, only the reference to the data in the container is copied. The actual data pointed to by Pylon::CPylonDataComponent::GetData() will not be copied.

function ~CPylonDataComponent#

~CPylonDataComponent()

Destroys a pylon data component object.

Error Safety:

Does not throw C++ exceptions.

Thread Safety:

This class is not thread-safe. If you access the same instance from multiple threads, you must make sure to synchronize the access accordingly.

function operator=#

CPylonDataComponent & operator=(
    const CPylonDataComponent & rhs
)

Assigns the data of another component to this component by copying.

Parameters:

  • rhs Source component to copy.

Postcondition:

  • Any container previously referenced is released.
  • The container of the component passed is referenced.
  • No container is referenced if the component passed is invalid.

Error Safety:

Does not throw C++ exceptions.

Thread Safety:

This class is not thread-safe. If you access the same instance from multiple threads, you must make sure to synchronize the access accordingly.

When assigning a copy of a component, only the metadata is copied. The actual data pointed to by Pylon::CPylonDataComponent::GetData() will not be copied.

function operator const Pylon::IImage &#

operator const Pylon::IImage &() const

Provides a Pylon::IImage interface to the component.

Attention: The returned reference is only valid as long as the component is not destroyed.

Error Safety:

Does not throw C++ exceptions.

Thread Safety:

This class is not thread-safe. If you access the same instance from multiple threads, you must make sure to synchronize the access accordingly.

This cast operator allows passing the component to image format converters, save functions, or any other functions that require an IImage object. The returned image is invalid if the component is invalid or cannot be converted to an image.

function IsValid#

bool IsValid() const

Can be used to check whether the component is valid.

Return: Returns false if the component does not contain valid data or hasn't been initialized yet.

Error Safety:

Does not throw C++ exceptions.

Thread Safety:

This class is not thread-safe. If you access the same instance from multiple threads, you must make sure to synchronize the access accordingly.

function GetComponentType#

EComponentType GetComponentType() const

Get the type of data this component contains.

Return: Returns the type of data in this component. See Pylon::EComponentType for values.

Error Safety:

Does not throw C++ exceptions.

Thread Safety:

This class is not thread-safe. If you access the same instance from multiple threads, you must make sure to synchronize the access accordingly.

Use this function to distinguish between different component types like intensity values or range values. See Pylon::EComponentType for values.

function GetPixelType#

EPixelType GetPixelType() const

Get the type of pixels this component contains.

Return: Returns an enumeration value describing the pixels in the component. See Pylon::EPixelType for values. If the component does not contain valid data or contains a unknown pixel format, PixelType_Unknown is returned.

Note Not all components contain pixel data. Only components of type ComponentType_Intensity, ComponentType_Range, and ComponentType_Confidence return a valid pixel type.

Error Safety:

Does not throw C++ exceptions.

Thread Safety:

This class is not thread-safe. If you access the same instance from multiple threads, you must make sure to synchronize the access accordingly.

Use this function to determine how to interpret the data returned by Pylon::CPylonDataComponent::GetData().

function GetWidth#

uint32_t GetWidth() const

Get the current number of columns.

Return: Returns the current number of columns or 0 if the component is invalid.

Error Safety:

Does not throw C++ exceptions.

Thread Safety:

This class is not thread-safe. If you access the same instance from multiple threads, you must make sure to synchronize the access accordingly.

function GetHeight#

uint32_t GetHeight() const

Get the current number of rows.

Return: Returns the current number of rows or 0 if the component is invalid.

Error Safety:

Does not throw C++ exceptions.

Thread Safety:

This class is not thread-safe. If you access the same instance from multiple threads, you must make sure to synchronize the access accordingly.

function GetOffsetX#

uint32_t GetOffsetX() const

Get the starting column.

Return: Returns the starting column.

Error Safety:

Does not throw C++ exceptions.

Thread Safety:

This class is not thread-safe. If you access the same instance from multiple threads, you must make sure to synchronize the access accordingly.

function GetOffsetY#

uint32_t GetOffsetY() const

Get the starting row.

Return: Returns the starting row.

Error Safety:

Does not throw C++ exceptions.

Thread Safety:

This class is not thread-safe. If you access the same instance from multiple threads, you must make sure to synchronize the access accordingly.

function GetPaddingX#

size_t GetPaddingX() const

Get the number of extra bytes at the end of each row.

Return: Returns the number of extra bytes at the end of each row.

Error Safety:

Does not throw C++ exceptions.

Thread Safety:

This class is not thread-safe. If you access the same instance from multiple threads, you must make sure to synchronize the access accordingly.

function GetData#

const void * GetData() const

Get the pointer to the data contained in the component.

Return: Returns a pointer to the data contained in the component.

Error Safety:

Does not throw C++ exceptions.

Use this pointer to access the data in this component. The size in bytes of the buffer can be obtained by calling Pylon::CPylonDataComponent::GetDataSize(). Call Pylon::CPylonDataComponent::GetPixelFormat() and other methods to determine how to interpret the data.

function GetDataSize#

size_t GetDataSize() const

Get the size of the buffer returned by Pylon::CPylonDataComponent::GetData().

Return: Returns the size in bytes of the buffer returned by Pylon::CPylonDataComponent::GetData().

Error Safety:

Does not throw C++ exceptions.

Thread Safety:

This class is not thread-safe. If you access the same instance from multiple threads, you must make sure to synchronize the access accordingly.

function GetTimeStamp#

uint64_t GetTimeStamp() const

Get the camera-specific time the data was created on the camera.

Return: Returns the camera-specific time the data was created on the camera or 0 if the time is not available.

Note Timestamp generation is available only on some camera models.

Error Safety:

Does not throw C++ exceptions.

Thread Safety:

This class is not thread-safe. If you access the same instance from multiple threads, you must make sure to synchronize the access accordingly.

function GetStride#

bool GetStride(
    size_t & strideBytes
) const

Get the stride in bytes for the component.

Parameters:

  • strideBytes On successful return, the stride value can be read from this output parameter.

Return: Returns true if the stride could be computed successfully and is returned in the output parameter. Returns false if the preconditions are not met or the component doesn't contain valid data. If the function returns false, the value of strideBytes is undefined.

Precondition:

  • The component type must be [Pylon::ComponentType_Intensity](namespace_pylon.md, [Pylon::ComponentType_Range](namespace_pylon.md, or [Pylon::ComponentType_Confidence](namespace_pylon.md.
  • The preconditions of ComputeStride() must be met.

Error Safety:

Does not throw C++ exceptions.

Thread Safety:

This class is not thread-safe. If you access the same instance from multiple threads, you must make sure to synchronize the access accordingly.

This method uses Pylon::ComputeStride() to compute the component's stride value. The stride describes the amount of bytes to advance from one row to the next.