KJB
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
mcmcda_fs.h
Go to the documentation of this file.
1 /* =========================================================================== *
2  |
3  | Copyright (c) 1994-2011 by Kobus Barnard (author)
4  |
5  | Personal and educational use of this code is granted, provided that this
6  | header is kept intact, and that the authorship is not misrepresented, that
7  | its use is acknowledged in publications, and relevant papers are cited.
8  |
9  | For other use contact the author (kobus AT cs DOT arizona DOT edu).
10  |
11  | Please note that the code in this file has not necessarily been adequately
12  | tested. Naturally, there is no guarantee of performance, support, or fitness
13  | for any particular task. Nonetheless, I am interested in hearing about
14  | problems that you encounter.
15  |
16  | Author: Ernesto Brau
17  * =========================================================================== */
18 
19 #ifndef MCMCDA_FS_H_INCLUDED
20 #define MCMCDA_FS_H_INCLUDED
21 
22 #include <vector>
23 #include <string>
24 #include <l/l_sys_io.h>
25 #include <l_cpp/l_exception.h>
26 #include <l_cpp/l_filesystem.h>
27 
28 namespace kjb {
29 namespace mcmcda {
30 
33 {
34 public:
35  std::string experiment_dp;
36  std::string association_dn;
37 
38  std::string association_dp;
39  std::string all_samples_dp;
40  std::string tracked_images_dp;
41  std::string curved_images_dp;
42  std::string curves_dp;
43 
44  std::string association_fp;
45  std::string all_samples_fpf;
46  std::string tracked_images_fpf;
47  std::string curved_images_fpf;
48  std::string curves_fpf;
49 
50  std::vector<std::string> all_samples_fps;
51  std::vector<std::string> tracked_images_fps;
52  std::vector<std::string> curved_images_fps;
53  std::vector<std::string> curves_fps;
54 
56 
58  (
59  const std::string& exp_dp,
60  const std::string& aname
61  ) :
62  experiment_dp(exp_dp),
63  association_dn(aname),
64  //association_dp(exp_dp + "/" + association_dn),
69  //curves_dp(association_dp + "/" + curves_dn),
76  // note regarding the '0' in lines below:
77  // file_names_from_format now tolerates a missing file on index '0',
78  // so it's safe to specify '0' as the first index, even if the
79  // true first index is 1. Also, some old pollen data starts at zero,
80  // so we need to try zero.
81  // --Kyle Nov 18, 2014
86  {}
87 
88  void make_dirs() const
89  {
90  ETX(kjb_c::kjb_mkdir(experiment_dp.c_str()));
91  ETX(kjb_c::kjb_mkdir(association_dp.c_str()));
92  ETX(kjb_c::kjb_mkdir(all_samples_dp.c_str()));
93  ETX(kjb_c::kjb_mkdir(tracked_images_dp.c_str()));
94  ETX(kjb_c::kjb_mkdir(curved_images_dp.c_str()));
95  ETX(kjb_c::kjb_mkdir(curves_dp.c_str()));
96  }
97 
98 public:
99  // sub directory names
100  const static std::string all_samples_dn;
101  const static std::string tracked_images_dn;
102  const static std::string curved_images_dn;
103  const static std::string curves_dn;
104 
105  // file name formats
106  const static std::string association_fn;
107  const static std::string all_samples_fnf;
108  const static std::string tracked_images_fnf;
109  const static std::string curved_images_fnf;
110  const static std::string curves_fnf;
111 };
112 
115 {
116 public:
117  std::string experiment_dp;
118 
119  std::string preprocessed_dp;
120  std::string blobbed_dp;
121  std::string pixels_dp;
122 
123  std::string points_fpf;
124  std::string preprocessed_fpf;
125  std::string blobbed_fpf;
126  std::string pixels_fpf;
127 
128  std::vector<std::string> points_fps;
129  std::vector<std::string> preprocessed_fps;
130  std::vector<std::string> blobbed_fps;
131  std::vector<std::string> pixels_fps;
132 
133  Experiment_directory(const std::string& exp_dir_path) :
134  experiment_dp(exp_dir_path),
135  preprocessed_dp(experiment_dp + "/" + preprocessed_dn),
136  blobbed_dp(experiment_dp + "/" + blobbed_dn),
137  pixels_dp(experiment_dp + "/" + pixels_dn),
138  points_fpf(experiment_dp + "/" + points_fnf),
139  preprocessed_fpf(preprocessed_dp + "/" + preprocessed_fnf),
140  blobbed_fpf(blobbed_dp + "/" + blobbed_fnf),
141  pixels_fpf(pixels_dp + "/" + pixels_fnf),
146  {
147  ETX(kjb_c::kjb_mkdir(experiment_dp.c_str()));
148  ETX(kjb_c::kjb_mkdir(blobbed_dp.c_str()));
149  ETX(kjb_c::kjb_mkdir(pixels_dp.c_str()));
150  }
151 
153  {
154  return Association_directory(experiment_dp, name);
155  }
156 
157 private:
158  // sub directory names
159  static const std::string preprocessed_dn;
160  static const std::string blobbed_dn;
161  static const std::string pixels_dn;
162 
163  // file name formats
164  static const std::string points_fnf;
165  static const std::string preprocessed_fnf;
166  static const std::string blobbed_fnf;
167  static const std::string pixels_fnf;
168 };
169 
170 }} //namespace kjb::mcmcda
171 
172 #endif /*MCMCDAFS_H_INCLUDED */
173 
std::vector< std::string > pixels_fps
Definition: mcmcda_fs.h:131
std::vector< std::string > file_names_from_format(const std::string &name_format, size_t first, size_t num_files)
Expands the format into a set of (existing) file names.
Definition: l_filesystem.cpp:34
#define ETX(a)
Definition: l_exception.h:67
static const std::string curves_fnf
Definition: mcmcda_fs.h:110
std::string curved_images_fpf
Definition: mcmcda_fs.h:47
Later.
Definition: mcmcda_fs.h:32
std::vector< std::string > curves_fps
Definition: mcmcda_fs.h:53
std::string pixels_dp
Definition: mcmcda_fs.h:121
static const std::string curved_images_fnf
Definition: mcmcda_fs.h:109
void make_dirs() const
Definition: mcmcda_fs.h:88
std::string tracked_images_fpf
Definition: mcmcda_fs.h:46
std::string association_dp
Definition: mcmcda_fs.h:38
std::string all_samples_fpf
Definition: mcmcda_fs.h:45
static const std::string all_samples_dn
Definition: mcmcda_fs.h:100
static const std::string curves_dn
Definition: mcmcda_fs.h:103
Association_directory()
Definition: mcmcda_fs.h:55
std::string blobbed_dp
Definition: mcmcda_fs.h:120
static const std::string association_fn
Definition: mcmcda_fs.h:106
static const std::string tracked_images_dn
Definition: mcmcda_fs.h:101
std::string preprocessed_fpf
Definition: mcmcda_fs.h:124
std::string curves_fpf
Definition: mcmcda_fs.h:48
std::string experiment_dp
Definition: mcmcda_fs.h:117
static const std::string all_samples_fnf
Definition: mcmcda_fs.h:107
std::vector< std::string > all_samples_fps
Definition: mcmcda_fs.h:50
std::string blobbed_fpf
Definition: mcmcda_fs.h:125
std::string preprocessed_dp
Definition: mcmcda_fs.h:119
std::string tracked_images_dp
Definition: mcmcda_fs.h:40
Association_directory get_association_dir(const std::string &name)
Definition: mcmcda_fs.h:152
std::string points_fpf
Definition: mcmcda_fs.h:123
std::string experiment_dp
Definition: mcmcda_fs.h:35
std::vector< std::string > points_fps
Definition: mcmcda_fs.h:128
std::string pixels_fpf
Definition: mcmcda_fs.h:126
std::string curved_images_dp
Definition: mcmcda_fs.h:41
std::string association_dn
Definition: mcmcda_fs.h:36
std::vector< std::string > curved_images_fps
Definition: mcmcda_fs.h:52
std::string all_samples_dp
Definition: mcmcda_fs.h:39
static const std::string curved_images_dn
Definition: mcmcda_fs.h:102
std::string association_fp
Definition: mcmcda_fs.h:44
std::string curves_dp
Definition: mcmcda_fs.h:42
Support for error handling exception classes in libKJB.
Later.
Definition: mcmcda_fs.h:114
static const std::string tracked_images_fnf
Definition: mcmcda_fs.h:108
Experiment_directory(const std::string &exp_dir_path)
Definition: mcmcda_fs.h:133
std::vector< std::string > blobbed_fps
Definition: mcmcda_fs.h:130
std::vector< std::string > preprocessed_fps
Definition: mcmcda_fs.h:129
std::vector< std::string > tracked_images_fps
Definition: mcmcda_fs.h:51