NPL
Neurological Programs and Libraries
npl::Pixel3DView< T > Class Template Reference

The purpose of this class is to view an image as a 3D image rather than a ND image. Therefore all dimensions above the third will be ignored and index 0 will be used. More...

#include <accessors.h>

Inherits npl::NDView< T >.

Public Member Functions

 Pixel3DView (std::shared_ptr< NDArray > in)
 
 Pixel3DView ()
 
operator() (int64_t x=0, int64_t y=0, int64_t z=0)
 Gets value at array index and then casts to T. More...
 
get (int64_t x, int64_t y, int64_t z)
 Gets value at array index and then casts to T. More...
 
void set (int64_t x, int64_t y, int64_t z, T v)
 Gets value at array index and then casts to T. More...
 
void setArray (ptr< NDArray > in)
 
get (size_t len, int64_t *index)
 Gets value at array index and then casts to T. More...
 
void set (size_t len, const int64_t *index, T v)
 Casts to the appropriate type then sets array at given index. More...
 
void set (const std::vector< int64_t > &index, T v)
 Casts to the appropriate type then sets array at given index. More...
 
void set (int64_t index, T v)
 Casts to the appropriate type then sets array at given index. More...
 
int64_t tlen ()
 

Protected Member Functions

operator[] (int64_t i)
 
get (const std::vector< int64_t > &i)
 
operator[] (const std::vector< int64_t > &i)
 

Static Protected Member Functions

template<typename U >
static T castgetStatic (void *ptr)
 This is a wrapper function that will be called to safely cast from the underlying type. More...
 
template<typename U >
static void castsetStatic (void *ptr, const T &val)
 This is a wrapper function that will be called to safely cast to the underlying type. More...
 

Protected Attributes

std::shared_ptr< NDArrayparent
 Where to get the dat a from. Also the shared_ptr prevents dealloc. More...
 
T(* castget )(void *ptr)
 Function pointer to the correct function for casting from the underlying type. More...
 
void(* castset )(void *ptr, const T &v)
 Function pointer to the correct function for casting to the underlying type. This should be set during construction. More...
 

Detailed Description

template<typename T>
class npl::Pixel3DView< T >

The purpose of this class is to view an image as a 3D image rather than a ND image. Therefore all dimensions above the third will be ignored and index 0 will be used.

Template Parameters
TType of value to cast and return

Definition at line 495 of file accessors.h.

Constructor & Destructor Documentation

template<typename T >
npl::Pixel3DView< T >::Pixel3DView ( std::shared_ptr< NDArray in)
inline

Definition at line 498 of file accessors.h.

template<typename T >
npl::Pixel3DView< T >::Pixel3DView ( )

Member Function Documentation

template<typename T >
template<typename U >
static T npl::NDView< T >::castgetStatic ( void *  ptr)
inlinestaticprotectedinherited

This is a wrapper function that will be called to safely cast from the underlying type.

Template Parameters
UUnderlying type of pixel, figured out in the constructor
Parameters
ptrPointer to memory where the pixel is.
Returns
Correctly cast value

Definition at line 272 of file accessors.h.

template<typename T >
template<typename U >
static void npl::NDView< T >::castsetStatic ( void *  ptr,
const T &  val 
)
inlinestaticprotectedinherited

This is a wrapper function that will be called to safely cast to the underlying type.

Template Parameters
UUnderlying type of pixel, figured out in the constructor
Parameters
ptrPointer to memory where the pixel is.
valnew value to write

Definition at line 287 of file accessors.h.

template<typename T >
T npl::NDView< T >::get ( size_t  len,
int64_t *  index 
)
inlineinherited

Gets value at array index and then casts to T.

Parameters
lenlength of index array
indexn-d index to access
Returns
value

Definition at line 186 of file accessors.h.

template<typename T >
T npl::Pixel3DView< T >::get ( int64_t  x,
int64_t  y,
int64_t  z 
)
inline

Gets value at array index and then casts to T.

Returns
value

Definition at line 520 of file accessors.h.

template<typename T >
T npl::Pixel3DView< T >::get ( const std::vector< int64_t > &  i)
inlineprotected

Definition at line 545 of file accessors.h.

template<typename T >
T npl::Pixel3DView< T >::operator() ( int64_t  x = 0,
int64_t  y = 0,
int64_t  z = 0 
)
inline

Gets value at array index and then casts to T.

Returns
value

Definition at line 507 of file accessors.h.

template<typename T >
T npl::Pixel3DView< T >::operator[] ( int64_t  i)
inlineprotected

Definition at line 544 of file accessors.h.

template<typename T >
T npl::Pixel3DView< T >::operator[] ( const std::vector< int64_t > &  i)
inlineprotected

Definition at line 546 of file accessors.h.

template<typename T >
void npl::NDView< T >::set ( size_t  len,
const int64_t *  index,
v 
)
inlineinherited

Casts to the appropriate type then sets array at given index.

Parameters
lenlength of index array
indexn-d index to access
vvalue to set at index
Returns
current value

Definition at line 218 of file accessors.h.

template<typename T >
void npl::NDView< T >::set ( const std::vector< int64_t > &  index,
v 
)
inlineinherited

Casts to the appropriate type then sets array at given index.

Parameters
vvalue to set at index
indexn-d index to access
Returns
current value

Definition at line 234 of file accessors.h.

template<typename T >
void npl::NDView< T >::set ( int64_t  index,
v 
)
inlineinherited

Casts to the appropriate type then sets array at given index.

Parameters
vvalue to set at index
indexn-d index to access
Returns
current value

Definition at line 250 of file accessors.h.

template<typename T >
void npl::Pixel3DView< T >::set ( int64_t  x,
int64_t  y,
int64_t  z,
v 
)
inline

Gets value at array index and then casts to T.

Returns
value

Definition at line 533 of file accessors.h.

template<typename T >
void npl::NDView< T >::setArray ( ptr< NDArray in)
inlineinherited

Definition at line 73 of file accessors.h.

template<typename T >
int64_t npl::NDView< T >::tlen ( )
inlineinherited

Definition at line 258 of file accessors.h.

Member Data Documentation

template<typename T >
T(* npl::NDView< T >::castget) (void *ptr)
protectedinherited

Function pointer to the correct function for casting from the underlying type.

Parameters
ptrlocation in memory where the pixel is stored

Definition at line 303 of file accessors.h.

template<typename T >
void(* npl::NDView< T >::castset) (void *ptr, const T &v)
protectedinherited

Function pointer to the correct function for casting to the underlying type. This should be set during construction.

Parameters
ptrpointer to memory
vvalue to cast and write

Definition at line 313 of file accessors.h.

template<typename T >
std::shared_ptr<NDArray> npl::NDView< T >::parent
protectedinherited

Where to get the dat a from. Also the shared_ptr prevents dealloc.

Definition at line 290 of file accessors.h.


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