vidl2_image_list_istream Class Reference

#include <vidl2_image_list_istream.h>

Inheritance diagram for vidl2_image_list_istream:

vidl2_istream List of all members.

Detailed Description

A video input stream from a list of images on disk.

This istream will try to open and validate (but not read image data from) every file in a list of file paths. The paths to valid image files are maintained, but only one image is opened at a time. Keeping a list of open file descriptors (via vil_image_resource_sptr) was found to be problematic. The number of simultaneously open files is limited on many platforms. The paths are tested for validity at the "open" stage rather than the "stream" stage so that we have random access to the frames (i.e. the stream is seekable).

Definition at line 27 of file vidl2_image_list_istream.h.


Public Member Functions

 vidl2_image_list_istream ()
 Constructor - default.
 vidl2_image_list_istream (const vcl_string &glob)
 Constructor - from a file glob string.
 vidl2_image_list_istream (const vcl_vector< vcl_string > &paths)
 Constructor - from a vector of file paths.
virtual ~vidl2_image_list_istream ()
 Destructor.
virtual bool open (const vcl_string &glob)
 Open a new stream using a file glob (see vul_file_iterator).
virtual bool open (const vcl_vector< vcl_string > &paths)
 Open a new stream using a vector of file paths.
virtual void close ()
 Close the stream.
virtual bool is_open () const
 Return true if the stream is open for reading.
virtual bool is_valid () const
 Return true if the stream is in a valid state.
virtual bool is_seekable () const
 Return true if the stream support seeking.
virtual int num_frames () const
 Return the number of frames if known.
virtual unsigned int frame_number () const
 Return the current frame number.
virtual bool advance ()
 Advance to the next frame (but do not open the next image).
virtual vidl2_frame_sptr read_frame ()
 Read the next frame from the stream.
virtual vidl2_frame_sptr current_frame ()
 Return the current frame in the stream.
vcl_string current_path () const
 Return the path to the current image in the stream.
virtual bool seek_frame (unsigned int frame_number)
 Seek to the given frame number (but do not load the image).
void ref ()
 Increment reference count.
void unref ()
 Decrement reference count.
int ref_count () const
 Number of objects referring to this data.

Private Attributes

vcl_vector< vcl_string > image_paths_
 The vector of images.
unsigned int index_
 The current index.
vidl2_frame_sptr current_frame_
 The current frame (cached).

Constructor & Destructor Documentation

vidl2_image_list_istream::vidl2_image_list_istream (  ) 

Constructor - default.

Definition at line 30 of file vidl2_image_list_istream.cxx.

vidl2_image_list_istream::vidl2_image_list_istream ( const vcl_string &  glob  ) 

Constructor - from a file glob string.

Definition at line 36 of file vidl2_image_list_istream.cxx.

vidl2_image_list_istream::vidl2_image_list_istream ( const vcl_vector< vcl_string > &  paths  ) 

Constructor - from a vector of file paths.

virtual vidl2_image_list_istream::~vidl2_image_list_istream (  )  [inline, virtual]

Destructor.

Definition at line 41 of file vidl2_image_list_istream.h.


Member Function Documentation

bool vidl2_image_list_istream::open ( const vcl_string &  glob  )  [virtual]

Open a new stream using a file glob (see vul_file_iterator).

Note:
files are loaded in alphanumeric order by path name

Definition at line 44 of file vidl2_image_list_istream.cxx.

bool vidl2_image_list_istream::open ( const vcl_vector< vcl_string > &  paths  )  [virtual]

Open a new stream using a vector of file paths.

Note:
all files are tested and only valid image files are retained

Definition at line 81 of file vidl2_image_list_istream.cxx.

void vidl2_image_list_istream::close (  )  [virtual]

Close the stream.

Implements vidl2_istream.

Definition at line 99 of file vidl2_image_list_istream.cxx.

virtual bool vidl2_image_list_istream::is_open (  )  const [inline, virtual]

Return true if the stream is open for reading.

Implements vidl2_istream.

Definition at line 57 of file vidl2_image_list_istream.h.

virtual bool vidl2_image_list_istream::is_valid (  )  const [inline, virtual]

Return true if the stream is in a valid state.

Implements vidl2_istream.

Definition at line 60 of file vidl2_image_list_istream.h.

virtual bool vidl2_image_list_istream::is_seekable (  )  const [inline, virtual]

Return true if the stream support seeking.

Implements vidl2_istream.

Definition at line 64 of file vidl2_image_list_istream.h.

virtual int vidl2_image_list_istream::num_frames (  )  const [inline, virtual]

Return the number of frames if known.

returns -1 for non-seekable streams

Implements vidl2_istream.

Definition at line 68 of file vidl2_image_list_istream.h.

virtual unsigned int vidl2_image_list_istream::frame_number (  )  const [inline, virtual]

Return the current frame number.

Implements vidl2_istream.

Definition at line 71 of file vidl2_image_list_istream.h.

bool vidl2_image_list_istream::advance (  )  [virtual]

Advance to the next frame (but do not open the next image).

Implements vidl2_istream.

Definition at line 110 of file vidl2_image_list_istream.cxx.

vidl2_frame_sptr vidl2_image_list_istream::read_frame (  )  [virtual]

Read the next frame from the stream.

Implements vidl2_istream.

Definition at line 122 of file vidl2_image_list_istream.cxx.

vidl2_frame_sptr vidl2_image_list_istream::current_frame (  )  [virtual]

Return the current frame in the stream.

Implements vidl2_istream.

Definition at line 131 of file vidl2_image_list_istream.cxx.

vcl_string vidl2_image_list_istream::current_path (  )  const

Return the path to the current image in the stream.

Definition at line 146 of file vidl2_image_list_istream.cxx.

bool vidl2_image_list_istream::seek_frame ( unsigned int  frame_number  )  [virtual]

Seek to the given frame number (but do not load the image).

Returns:
true if successful

Implements vidl2_istream.

Definition at line 159 of file vidl2_image_list_istream.cxx.

void vidl2_istream::ref (  )  [inline, inherited]

Increment reference count.

Definition at line 67 of file vidl2_istream.h.

void vidl2_istream::unref (  )  [inline, inherited]

Decrement reference count.

Definition at line 70 of file vidl2_istream.h.

int vidl2_istream::ref_count (  )  const [inline, inherited]

Number of objects referring to this data.

Definition at line 73 of file vidl2_istream.h.


Member Data Documentation

vcl_vector<vcl_string> vidl2_image_list_istream::image_paths_ [private]

The vector of images.

Definition at line 92 of file vidl2_image_list_istream.h.

unsigned int vidl2_image_list_istream::index_ [private]

The current index.

Definition at line 95 of file vidl2_image_list_istream.h.

vidl2_frame_sptr vidl2_image_list_istream::current_frame_ [private]

The current frame (cached).

Definition at line 98 of file vidl2_image_list_istream.h.


The documentation for this class was generated from the following files:
Generated on Sat Sep 6 05:21:57 2008 for contrib/brl/bbas/vidl2 by  doxygen 1.5.1