SbImageDataAccessor Class Reference
[Images]

ImageViz Class used to retrieve data from an SoImageDataAdapter. More...

#include <ImageViz/SbImageDataAccessor.h>

List of all members.

Classes

class  Region
 A region must be an ordered set with a first voxel and for each voxel a next voxel, else we cannot associate a buffer to this region. More...
class  SubVolumeRegion
 Region representing a 3D box. More...

Public Member Functions

SbImageDataVoxel getVoxel (const SbVec4i32 &pos)
double getVoxel (int x, int y, int z=0, int t=0, int c=0)
bool setVoxel (double value, int x, int y, int z=0, int t=0, int c=0)
bool getRow (SoCpuBufferObject *values, int y, int z=0, int t=0, int c=0)
bool getRow (std::vector< double > &values, int y, int z=0, int t=0, int c=0)
bool setRow (const SoCpuBufferObject *values, int y, int z=0, int t=0, int c=0)
bool setRow (const std::vector< double > &values, int y, int z=0, int t=0, int c=0)
bool getColumn (SoCpuBufferObject *values, int x, int z=0, int t=0, int c=0)
bool getColumn (std::vector< double > &values, int x, int z=0, int t=0, int c=0)
bool setColumn (const SoCpuBufferObject *values, int x, int z=0, int t=0, int c=0)
bool setColumn (const std::vector< double > &values, int x, int z=0, int t=0, int c=0)
SoMemoryDataAdaptercopyRegion (const Region &region, const SbChannelList &channels)
SoMemoryDataAdaptercopyRegion (const Region &region)
SoImageDataAdaptergetImageAdapter () const

Static Public Member Functions

static SubVolumeRegion createFullRegion (SoImageDataAdapter *image)
static SubVolumeRegion createSliceRegion (SoImageDataAdapter *image, uint32_t sliceNumber)

Friends

class SoImageDataAdapter

Detailed Description

ImageViz Class used to retrieve data from an SoImageDataAdapter.

Class used to retrieve data from an SoImageDataAdapter.

To create an SbImageDataAccessor, call the getDataAccessor() method on the SoImageDataAdaptor.

To get an SoMemoryDataAdapter containing the data from a region, call copyRegion() with an instance of a class implementing the Region interface. You can use the predefined Region class SubVolumeRegion and the helper methods, e.g. createSliceRegion(), for convenience. Note that the returned data are stored in CPU memory. This class does not aim to support out of core access. Make sure you have enough free memory when requesting data.

SEE ALSO

SoImageDataAdapter, SbImageDataVoxel

See related examples:

ExtractingROI


Member Function Documentation

SoMemoryDataAdapter* SbImageDataAccessor::copyRegion ( const Region region  ) 

Returns an SoMemoryDataAdapter corresponding to the requested region.

The data are copied and can be accessed in read/write. Returned buffer data are interleaved, i.e. if request for RGB buffer, data will be RGBRGBRGB... Data are then organized line by line, slice by slice, volume by volume. Ptr[0] is 1st channel of 1st voxel of 1st line of 1st slice of 1st volume. Ptr[nbChannel * regionWidth] is 1st channel of 1st voxel of 2nd line of 1st volume, and so on. The returned buffer is the requested region with all channels. There is no intersection with image extent or image available channels. Any data outside of image are considered to be zeros.

SoMemoryDataAdapter* SbImageDataAccessor::copyRegion ( const Region region,
const SbChannelList channels 
)

Returns an SoMemoryDataAdapter corresponding to the requested region.

The data are copied and can be accessed in read/write. Returned buffer data are interleaved, i.e. if request for RGB buffer, data will be RGBRGBRGB... Data are then organized line by line, slice by slice, volume by volume. Ptr[0] is 1st channel of 1st voxel of 1st line of 1st slice of 1st volume. Ptr[nbChannel * regionWidth] is 1st channel of 1st voxel of 2nd line of 1st volume, and so on. The returned buffer is the intersection of requested region and requested channels. There is no intersection with image extent or image available channels. Any data outside of image are considered to be zeros.

static SubVolumeRegion SbImageDataAccessor::createFullRegion ( SoImageDataAdapter image  )  [static]

Helper to create a SubVolumeRegion corresponding to the whole region of the given image.

static SubVolumeRegion SbImageDataAccessor::createSliceRegion ( SoImageDataAdapter image,
uint32_t  sliceNumber 
) [static]

Helper to create a SubVolumeRegion corresponding to one slice of the given image.

bool SbImageDataAccessor::getColumn ( std::vector< double > &  values,
int  x,
int  z = 0,
int  t = 0,
int  c = 0 
)
bool SbImageDataAccessor::getColumn ( SoCpuBufferObject values,
int  x,
int  z = 0,
int  t = 0,
int  c = 0 
)

Get values of the full column at specified coordinates.

Parameters:
values a buffer to retrieve voxel values of one component at specified column position as an array of double. SoCpuBufferObject cannot be NULL. If its size does not match the required one, it is resized.
x column coordinate
z depth coordinate. Default is 0. Useful for 2D images.
t time coordinate. Default is 0.
c component number. Default is 0.
Returns:
true if the column is correctly read. false otherwise
SoImageDataAdapter* SbImageDataAccessor::getImageAdapter (  )  const [inline]

Returns the SoImageDataAdapter associated with this DataAccessor.

bool SbImageDataAccessor::getRow ( std::vector< double > &  values,
int  y,
int  z = 0,
int  t = 0,
int  c = 0 
)
bool SbImageDataAccessor::getRow ( SoCpuBufferObject values,
int  y,
int  z = 0,
int  t = 0,
int  c = 0 
)

Get values of the full row at specified coordinates.

Parameters:
values a buffer to retrieve voxel values of one component at specified row position as an array of double. SoCpuBufferObject cannot be NULL. If its size does not match the required one, it is resized.
y row coordinate
z depth coordinate. Default is 0. Useful for 2D images.
t time coordinate. Default is 0.
c component number. Default is 0.
Returns:
true if the row is correctly read. false otherwise
double SbImageDataAccessor::getVoxel ( int  x,
int  y,
int  z = 0,
int  t = 0,
int  c = 0 
)

Returns value of voxel at specified position.

See also getVoxel( const SbVec4i32& pos ). Any request outside of the image will return 0. If the specified channel is not in image channel range, 0.0 will be returned.

Parameters:
x column coordinate
y row coordinate
z depth coordinate. Default is 0. Useful for 2D images.
t time coordinate. Default is 0.
c component number. Default is 0.
SbImageDataVoxel SbImageDataAccessor::getVoxel ( const SbVec4i32 pos  ) 

Returns voxel at specified position.

pos[0], pos[1] and pos[2] refer to width, height and depth of image. Pos[3] refers to timestep. Any request outside of the image will return 0. If the specified channel is not in image channel range, 0 will be returned.

bool SbImageDataAccessor::setColumn ( const std::vector< double > &  values,
int  x,
int  z = 0,
int  t = 0,
int  c = 0 
)
bool SbImageDataAccessor::setColumn ( const SoCpuBufferObject values,
int  x,
int  z = 0,
int  t = 0,
int  c = 0 
)

Set values to a column at specified coordinates.

Parameters:
values to set one component of the specified column as an array of double. SoCpuBufferObject cannot be NULL. If its size does not match the required one, false is returned.
x column coordinate
z depth coordinate. Default is 0. Useful for 2D images.
t time coordinate. Default is 0.
c component number. Default is 0.
Returns:
true if the column is correctly written on image false otherwise
bool SbImageDataAccessor::setRow ( const std::vector< double > &  values,
int  y,
int  z = 0,
int  t = 0,
int  c = 0 
)
bool SbImageDataAccessor::setRow ( const SoCpuBufferObject values,
int  y,
int  z = 0,
int  t = 0,
int  c = 0 
)

Set values to a row at specified coordinates.

Parameters:
values to set one component of the specified row as an array of double. SoCpuBufferObject cannot be NULL. If its size does not match the required one, false is returned.
y row coordinate
z depth coordinate. Default is 0. Useful for 2D images.
t time coordinate. Default is 0.
c component number. Default is 0.
Returns:
true if the row is correctly written on image false otherwise
bool SbImageDataAccessor::setVoxel ( double  value,
int  x,
int  y,
int  z = 0,
int  t = 0,
int  c = 0 
)

Set the value of voxel at specified coordinates.

Parameters:
value to set one component at specified position
x column coordinate
y row coordinate
z depth coordinate. Default is 0. Useful for 2D images.
t time coordinate. Default is 0.
c component number. Default is 0.
Returns:
true if the voxel is written on image false otherwise

Friends And Related Function Documentation

friend class SoImageDataAdapter [friend]

Only SoImageDataAdapter is allowed to create an SbImageDataAccessor.


The documentation for this class was generated from the following file:

Open Inventor Toolkit reference manual, generated on 15 Mar 2023
Copyright © Thermo Fisher Scientific All rights reserved.
http://www.openinventor.com/