#include <vidl2_image_list_istream.h>
Inheritance diagram for vidl2_image_list_istream:

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). | |
| vidl2_image_list_istream::vidl2_image_list_istream | ( | ) |
| vidl2_image_list_istream::vidl2_image_list_istream | ( | const vcl_string & | glob | ) |
| 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] |
| bool vidl2_image_list_istream::open | ( | const vcl_string & | glob | ) | [virtual] |
Open a new stream using a file glob (see vul_file_iterator).
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.
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).
Implements vidl2_istream.
Definition at line 159 of file vidl2_image_list_istream.cxx.
| void vidl2_istream::ref | ( | ) | [inline, inherited] |
| void vidl2_istream::unref | ( | ) | [inline, inherited] |
| int vidl2_istream::ref_count | ( | ) | const [inline, inherited] |
vcl_vector<vcl_string> vidl2_image_list_istream::image_paths_ [private] |
unsigned int vidl2_image_list_istream::index_ [private] |
1.5.1