forked from kvtsang/Supera
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ImageMetaMakerFactory.cxx
51 lines (47 loc) · 1.61 KB
/
ImageMetaMakerFactory.cxx
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
#ifndef __IMAGEMETAMAKERFACTORY_CXX__
#define __IMAGEMETAMAKERFACTORY_CXX__
#include "larcv/core/Base/larcv_logger.h"
#include "ImageMetaMakerFactory.h"
#include "ImageMetaFromConfig.h"
#include "PulledPork3DSlicer.h"
#include "Voxel3DSlicer.h"
namespace supera {
ImageMetaMakerBase* CreateImageMetaMaker(const supera::Config_t& cfg)
{
ImageMetaMakerBase* maker = nullptr;
try{
LARCV_SINFO() << "Attempting to construct supera::ImageMetaFromConfig... " << std::endl;
auto const& meta_cfg = cfg.get<supera::Config_t>("MetaConfig");
maker = new ImageMetaFromConfig();
maker->configure(meta_cfg);
LARCV_SINFO() << "Successfully made supera::ImageMetaFromConfig! " << std::endl;
}catch(...){
if(maker) delete maker;
}
if(!maker) {
try{
LARCV_SINFO() << "Attempting to construct supera::PuledPork3DSlicer..." << std::endl;
auto const& meta_cfg = cfg.get<supera::Config_t>("PulledPork");
maker = new PulledPork3DSlicer();
maker->configure(meta_cfg);
LARCV_SINFO() << "Successfully made supera::PulledPork3DSlicer! " << std::endl;
}catch(...){
if(maker) delete maker;
}
}
if(!maker) {
try{
LARCV_SINFO() << "Attempting to construct supera::Voxel3DSlicer..." << std::endl;
auto const& meta_cfg = cfg.get<supera::Config_t>("Voxel3DSlicer");
maker = new Voxel3DSlicer();
maker->configure(meta_cfg);
LARCV_SINFO() << "Successfully made supera::Voxel3DSlicer! " << std::endl;
}catch(...){
if(maker) delete maker;
}
}
LARCV_SINFO() << "Returning supera::ImageMetaMakerBase: " << maker << std::endl;
return maker;
}
}
#endif