24 #ifndef CFIELD_OPTICALFLOW_INTEGRATED_BLOCK
25 #define CFIELD_OPTICALFLOW_INTEGRATED_BLOCK
29 #define cimg_plugin "plugins/add_fileformat.h"
30 #define cimg_use_netcdf
32 #ifdef cimg_use_netcdf
33 #include "../NetCDF.Tool/struct_parameter_NetCDF.h"
36 #define cimg_plugin2 "plugins/netcdf_file_format4CImg2.h"
37 #define cimglist_plugin2 "plugins/netcdf_file_format4CImgList2.h"
38 #include "../CImg.Tool/CImg_NetCDF.h"
42 #include "Cfield_opticalFlow_integrated.h"
48 template<
typename T,
typename Timg>
57 this->class_name =
"Field : Optical Flow Integrated per Block";
61 virtual void init(CParameterNetCDF &fp)
72 this->m_mode.assign(this->m_pShape->m_dof, oMesh.grid_dims(0),oMesh.grid_dims(1),oMesh.grid_dims(2),1, 0);
82 std::vector<int> md, pos;
83 md.clear();pos.clear();
84 for (
int i = 0; i<this->m_pShape->m_mods.size(); i++)
86 if (this->m_pShape->m_mods[i].compare(0,2,
"Tx") == 0)
87 {pos.push_back(i);md.push_back(0);}
88 if (this->m_pShape->m_mods[i].compare(0,2,
"Ty") == 0)
89 {pos.push_back(i);md.push_back(1);}
90 if (this->m_pShape->m_mods[i].compare(0,2,
"Tz") == 0)
91 {pos.push_back(i);md.push_back(2);}
94 if ((oShape_prev.m_name).compare(0,5,
"OFFEM") == 0)
97 for (
int i=0; i<pos.size(); i++)
100 modes_prev[md[i]].resize(this->grid_dims(0),this->grid_dims(1),this->grid_dims(2),this->grid_dims(3),3);
101 modes_cur[pos[i]] = modes_prev[md[i]];
106 else if((oShape_prev.m_name).compare(0,2,
"IC") == 0)
110 CImgList<T> U(oMesh.num_var(), modes_prev[0].width(), modes_prev[0].height(), modes_prev[0].depth(), 1, 0);
111 cimglist_for(U, mode)
112 {U[mode] = modes_prev[mode+2];}
114 for (
int i=0; i<pos.size(); i++)
117 U[md[i]].resize(this->grid_dims(0),this->grid_dims(1),this->grid_dims(2),this->grid_dims(3),3);
118 modes_cur[pos[i]] = U[md[i]];
123 else if((oShape_prev.m_name).compare(0,4,
"OFIB") == 0)
127 if (modes_cur.size() == modes_prev.size())
128 {this->Field2Field(modes_prev, modes_cur);}
130 {printf(
"warning : modes have been changes for multi-scale OFIB strategy!!!");}
133 else if((oShape_prev.m_name).compare(0,3,
"OFI") == 0)
137 CImgList<T> U(oMesh.num_var(), modes_cur[0].width(), modes_cur[0].height(), modes_cur[0].depth(), 1, 0);
138 this->OFIU(oMesh, oImage, oShape_prev, ref_prev, nodes_prev, modes_prev, U);
140 for (
int i=0; i<pos.size(); i++)
142 modes_cur[pos[i]] = U[md[i]];
virtual void exec(const Cimage< Timg > &oImage, const Cmesh< T, Timg > &oMesh, CImgList< T > &modes_prev, CshapeFunction< T, Timg > &oShape_prev, const std::vector< T > &ref_prev, const CImgList< T > &nodes_prev)
Definition: Cfield.h:100
This is the mother class of shape function objets (virtual pure).
Definition: CshapeFunction.h:48
Cfield_opticalFlow_integrated_block()
Definition: Cfield_opticalFlow_integrated_block.h:54
In this class, specific projection field method is implemented. In the case of O.F.F.E.M. the node value must be identified through a projection, so "fromField2Mod" implements a parallelized loop over image pixel and identifies modes from a least square method strategy.
Definition: Cfield_opticalFlow_integrated.h:50
virtual void init(CParameterNetCDF &fp)
Definition: Cfield_opticalFlow_integrated_block.h:61
virtual void init(CParameterNetCDF &fp)
Definition: Cfield_opticalFlow_integrated.h:63
In this class, specific projection field method is implemented. In the case of O.F.F.E.M. the node value must be identified through a projection, so "fromField2Mod" implements a parallelized loop over image pixel and identifies modes from a least square method strategy.
Definition: Cfield_opticalFlow_integrated_block.h:49
virtual void exec(const Cimage< Timg > &oImage, const Cmesh< T, Timg > &oMesh, CImgList< T > &modes_prev, CshapeFunction< T, Timg > &oShape_prev, const std::vector< T > &ref_prev, const CImgList< T > &nodes_prev)
Definition: Cfield_opticalFlow_integrated_block.h:68