YaDICs  V04.14.a
Yet another Digital Image Correlation software: platform dedicated to 2/3D Fluid and Solid kinematics field measurements.
 All Classes Files Functions Variables Pages
Cimage_file.h
Go to the documentation of this file.
1 /**********************************************************************
2  * Copyright (C) 2012, The YaDICs Project Developers.
3  * See the COPYRIGHT file at the top-level directory of this distribution ./COPYRIGHT.
4  * See ./COPYING file for copying and redistribution conditions.
5  *
6  * This file is part of YaDICs.
7  * YaDICs is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * YaDICs is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with YaDICs. If not, see <http://www.gnu.org/licenses/>.
19  *
20  * Information about how to use the software are provided at http://yadic.univ-lille1.fr/
21  **********************************************************************/
22 
23 
24 #ifndef CIMAGE_FILE
25 #define CIMAGE_FILE
26 
35 #include "Cimage.h"
36 
37 template<typename Timg>
38 class Cimage_file: public Cimage<Timg>
39 {
40 
41 
42  public:
43 
45  {// constructor
46 
47  this->class_name = "Image : file";
48 
49  }
50 
51  virtual void init(CParameterNetCDF &fp)
52  {// image list parameters
53 
54  load_paths(fp);
56 
57  }
58 
59  virtual void load_paths(CParameterNetCDF &fp)
60  {// load images and mask paths from cdl
61 
62  //load the image and mask directory path
63  int error;
64  std::string att_name = "path";
65  error = fp.loadAttribute(att_name,this->m_dirPath);//load "path" attribute from "image_list" variable
66  att_name = "mask";
67  error = fp.loadAttribute(att_name,this->m_maskName);//load mask name
68 
70  this->m_list.var_name = this->m_name;
72  this->m_list.load(this->m_paramPath);
74  this->m_dim_sample = this->m_list.depth();
76  this->m_dim_image = this->m_list.height();
77 
78  printf("\n\n\n\n\n\n--------\nCalcul under progress\n--------\n\n\n");
79 
80  }
81 
82  virtual void load_images(CImg<char> &list, std::string &dir, const int &sample)
83  {// load images from paths
84 
85  this->m_img.assign(this->m_dim_image);
86 
87  cimglist_for(this->m_img,ind)
88  {// for image ref and def and eventually more
89 
90  this->m_img[ind].load((dir + std::string(list.get_shared_row(ind,sample))).c_str());
92  this->m_img[ind].channel(0);
93  printf("img%i : %s\n\n",ind,(dir + std::string(list.get_shared_row(ind,sample))).c_str());
94 
95  }
96 
97  printf("\n");
98 
99  this->m_dim = 0;
100  if (this->dim(0)>1){this->m_dim++;};
101  if (this->dim(1)>1){this->m_dim++;};
102  if (this->dim(2)>1){this->m_dim++;};
103 
104  }
105 
106 };
107 
108 #endif
load image and mask from cdl and store fields. It also creates a resized version of data in the case ...
Definition: Cimage_file.h:38
virtual void load_images(CImg< char > &list, std::string &dir, const int &sample)
Definition: Cimage_file.h:82
Definition: Cimage.h:57
virtual void load_paths(CParameterNetCDF &fp)
Definition: Cimage_file.h:59