-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMultiStackReader.h
More file actions
106 lines (84 loc) · 3.37 KB
/
MultiStackReader.h
File metadata and controls
106 lines (84 loc) · 3.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
/*
* File: StackReader.h
* Author: Marc
*
* Created on October 27, 2010, 4:32 PM
*
* used to read compressed stacks (generated by LinearStackCompressor or its subclasses)
* from disk
* this is the highest level reading function in the library;
*
* create the stackreader by passing a file name
* access frames using the getFrame command
* generate a meta data file using getSupplementalData
*
* in separate projects:
* see also the supplemental dll wrapper: StackReaderWrapper
* see also the example movie player: StackPlayer
*
* example usage:
* StackReader sr("\\\\labnas2\\Phototaxis\\exponentialstack.mmf"); //open stack for reading
* sr.createSupplementalDataFile("c:\\testcs5_dat.dat"); //create a metadata file
* sr.playMovie(); //play a movie on the screen
* (C) Marc Gershow; licensed under the Creative Commons Attribution Share Alike 3.0 United States License.
* To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/3.0/us/ or send a letter to
* Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA.
*
*/
#ifndef MULTISTACKREADER_H
#define MULTISTACKREADER_H
#include "StackReader.h"
#include "StaticBackgroundCompressor.h"
#include "ExtraDataWriter.h"
#include <map>
#include <string>
#include <cv.h>
class MultiStackReader : public StackReader {
public:
MultiStackReader();
MultiStackReader(const char *fname);
MultiStackReader(const std::vector<std::string>fnames);
virtual ~MultiStackReader();
virtual void setInputFileName (const char *fname);
virtual void setInputFileName (const std::vector<std::string>fnames);
virtual void openInputFile ();
virtual void closeInputFile ();
virtual void getBackground (int frameNum, IplImage **dst, int frameRange = 0);
virtual void getFrame (int frameNum, IplImage **dst);
virtual void annotatedFrame (int frameNum, IplImage **dst);
virtual CvSize getImageSize ();
virtual ExtraDataWriter *getSupplementalData();
/* virtual ExtraDataWriter *addToSupplementalData(ExtraDataWriter *edw, int frameOffset);
* when combining multiple stacks into one analysis file, use addToSupplementalData to create a combined metadata file
* if edw == NULL, creates the EDW
* same as getSupplementalData, with two differences
* FrameNumber (add) = FrameNumber (get) + frameOffset
* LocalFrameNumber (add) = FrameNumber (get)
*/
virtual ExtraDataWriter *addToSupplementalData(ExtraDataWriter *edw = NULL, int frameOffset = 0);
virtual bool dataFileOk();
virtual inline int getTotalFrames () {
return totalFrames;
}
virtual inline bool isError() {
return iserror;
}
virtual inline std::string getError() {
return errormessage;
}
virtual std::string diagnostics();
virtual CvRect getLargestROI ();
virtual const ImageMetaData* getMetaData(int frameNum);
static std::vector<std::string> parseFileNameInput (const char *fname);
virtual int getKeyFrameInterval();
protected:
std::vector<std::pair<StackReader *, int> > sr;
std::vector<std::string> fnames;
std::vector<int> endFrames;
virtual void init();
virtual void checkError();
virtual int findStackReader(int frameNumber);
private:
MultiStackReader(const MultiStackReader& orig);
};
#endif /* MULTISTACKREADER_H */