PetaVision  Alpha
ImageLayer.hpp
1 #ifndef IMAGELAYER_HPP_
2 #define IMAGELAYER_HPP_
3 
4 #include "InputLayer.hpp"
5 #include "structures/Image.hpp"
6 
7 namespace PV {
8 
9 class ImageLayer : public InputLayer {
10 
11  protected:
12  ImageLayer() {}
13  virtual int countInputImages() override;
14  virtual Response::Status registerData(Checkpointer *checkpointer) override;
15  void populateFileList();
16  virtual Buffer<float> retrieveData(int inputIndex) override;
17  virtual std::string describeInput(int index) override;
18  void readImage(std::string filename);
19 
20  public:
21  ImageLayer(const char *name, HyPerCol *hc);
22  virtual ~ImageLayer() {}
23  virtual std::string const &
24  getCurrentFilename(int localBatchElement, int mpiBatchIndex) const override;
25 
26  protected:
27  std::unique_ptr<Image> mImage = nullptr;
28 
29  // Automatically set if the inputPath ends in .txt. Determines whether this layer represents a
30  // collection of files.
31  bool mUsingFileList = false;
32 
33  // List of filenames to iterate over
34  std::vector<std::string> mFileList;
35 
36  // Template for a temporary path for downloading URLs that appear in file list.
37  std::string mURLDownloadTemplate;
38 }; // end class ImageLayer
39 } // end namespace PV
40 
41 #endif // IMAGELAYER_HPP_
virtual int countInputImages() override
Definition: ImageLayer.cpp:14
virtual std::string describeInput(int index) override
Definition: ImageLayer.cpp:160
virtual std::string const & getCurrentFilename(int localBatchElement, int mpiBatchIndex) const override
Definition: ImageLayer.cpp:32
virtual Buffer< float > retrieveData(int inputIndex) override
Definition: ImageLayer.cpp:77