20 #ifndef otbDimensionalityReductionModelFactory_hxx
21 #define otbDimensionalityReductionModelFactory_hxx
24 #include "otbConfigure.h"
39 template <
class TInputValue,
class TTargetValue>
40 using LogAutoencoderModelFactory = AutoencoderModelFactory<TInputValue, TTargetValue, shark::LogisticNeuron>;
43 template <
class TInputValue,
class TTargetValue>
46 template <
class TInputValue,
class TTargetValue>
49 template <
class TInputValue,
class TTargetValue>
52 template <
class TInputValue,
class TTargetValue>
56 template <
class TInputValue,
class TOutputValue>
60 RegisterBuiltInFactories();
62 std::list<DimensionalityReductionModelTypePointer> possibleDimensionalityReductionModel;
63 std::list<LightObject::Pointer> allobjects = itk::ObjectFactoryBase::CreateAllInstance(
"DimensionalityReductionModel");
65 for (std::list<LightObject::Pointer>::iterator i = allobjects.begin(); i != allobjects.end(); ++i)
70 possibleDimensionalityReductionModel.push_back(io);
74 std::cerr <<
"Error DimensionalityReductionModel Factory did not return an DimensionalityReductionModel: " << (*i)->
GetNameOfClass() << std::endl;
78 for (
typename std::list<DimensionalityReductionModelTypePointer>::iterator k = possibleDimensionalityReductionModel.begin();
79 k != possibleDimensionalityReductionModel.end(); ++k)
83 if ((*k)->CanReadFile(path))
88 else if (mode == WriteMode)
90 if ((*k)->CanWriteFile(path))
99 template <
class TInputValue,
class TOutputValue>
104 std::lock_guard<std::mutex> lockHolder(mutex);
113 RegisterFactory(LogAutoencoderModelFactory<TInputValue, TOutputValue>::New());
117 template <
class TInputValue,
class TOutputValue>
123 itk::ObjectFactoryBase::UnRegisterFactory(factory);
124 itk::ObjectFactoryBase::RegisterFactory(factory);
127 template <
class TInputValue,
class TOutputValue>
130 std::lock_guard<std::mutex> lockHolder(mutex);
132 std::list<itk::ObjectFactoryBase*> factories = itk::ObjectFactoryBase::GetRegisteredFactories();
133 std::list<itk::ObjectFactoryBase*>::iterator itFac;
135 for (itFac = factories.begin(); itFac != factories.end(); ++itFac)
141 itk::ObjectFactoryBase::UnRegisterFactory(som5dFactory);
148 itk::ObjectFactoryBase::UnRegisterFactory(som4dFactory);
155 itk::ObjectFactoryBase::UnRegisterFactory(som3dFactory);
162 itk::ObjectFactoryBase::UnRegisterFactory(som2dFactory);
167 LogAutoencoderModelFactory<TInputValue, TOutputValue>* aeFactory =
dynamic_cast<LogAutoencoderModelFactory<TInputValue, TOutputValue>*
>(*itFac);
170 itk::ObjectFactoryBase::UnRegisterFactory(aeFactory);
177 itk::ObjectFactoryBase::UnRegisterFactory(pcaFactory);
static DimensionalityReductionModelTypePointer CreateDimensionalityReductionModel(const std::string &path, FileModeType mode)
static void RegisterBuiltInFactories()
DimensionalityReductionModelType::Pointer DimensionalityReductionModelTypePointer
static void CleanFactories()
static void RegisterFactory(itk::ObjectFactoryBase *factory)
MachineLearningModel is the base class for all classifier objects (SVM, KNN, Random Forests,...
virtual const char * GetNameOfClass() const
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.