iLab Neuromorphic Robotics Toolkit  0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
nrt::Layout< T > Class Template Reference

#include <nrt/Core/Image/Layout.H>

template<class T>
class nrt::Layout< T >

Represents tiled layouts of arbitrary numbers of images of different sizes.

If you want to build up a big image of different individual images (e.g., for display), you have three basic choices:

  • use a series of nested concatX() and concatY() calls, which is convenient syntactically but is inefficient because each pixel is copied multiple times, once for each concat call.
  • make a single output image and use a series of inplacePaste() or inplaceEmbed() calls to put the various pieces in place; this is efficient but requires manual tabulation of the various corner locations of the different tiles.
  • with the Layout class, we get both efficiency and syntactical convenience. Instead of concatX() and concatY(), we use hcat() and vcat() which construct Layout objects (with arbitrary nesting); none of these calls involves any pixel copying. Instead we just keep track of the tile structure that is desired. Then when the final Layout has been constructed, it can be rendered into an Image in a single pass with the render() call.

For example, where previously you would have done

now with Layout you would do

Examples:
tests/test-Image.C, and tests/test-Pyramid.C.

Definition at line 98 of file Layout.H.

Public Member Functions

 Layout (nrt::LayoutDir const d=nrt::LayoutDir::H)
 Default constructor, no image, no dims, just a direction.
 
 Layout (nrt::Image< T > const p, nrt::LayoutDir const d=nrt::LayoutDir::H)
 Construct from just one image.
 
 Layout (nrt::Layout< T > const &p1, nrt::Layout< T > const &p2, nrt::LayoutDir const d)
 Construct from two other Layout objects.
 
 Layout (nrt::ImageSet< T > const &imgs, nrt::LayoutDir const d)
 Construct from an ImageSet.
 
 Layout (std::vector< Layout< T > > const &layouts, nrt::LayoutDir const d)
 Construct from a vector of Layout objects.
 
bool empty () const
 Returns true if we have no image yet.
 
nrt::Dims< int32 > const & dims () const
 Returns the dims of the image that would be created by render()
 
int32 width () const
 Returns the width of the image that would be created by render()
 
int32 height () const
 Returns the height of the image that would be created by render()
 
LayoutDir dir () const
 Returns our direction.
 
int32 size () const
 Returns our size, i.e., our number of parts.
 
Layout< T > const & part (int32 const i) const
 Return a part.
 
nrt::Image< T > leaf () const
 Return our leaf Image.
 
nrt::Image< T > render () const
 Render into an Image, using black as background color.
 
nrt::Image< T > render (T const &bgcol) const
 Render into an Image, using supplied background color.
 
void renderInto (Image< T > &x, Point2D< int > const &p) const
 Render into an existing Image.
 

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