20 #ifndef otbDimensionalityReductionModelFactory_hxx
21 #define otbDimensionalityReductionModelFactory_hxx
24 #include "otbConfigure.h"
33 #include "itkMutexLockHolder.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>
102 itk::MutexLockHolder<itk::SimpleMutexLock> lockHolder(mutex);
111 RegisterFactory(LogAutoencoderModelFactory<TInputValue, TOutputValue>::New());
115 template <
class TInputValue,
class TOutputValue>
121 itk::ObjectFactoryBase::UnRegisterFactory(factory);
122 itk::ObjectFactoryBase::RegisterFactory(factory);
125 template <
class TInputValue,
class TOutputValue>
128 itk::MutexLockHolder<itk::SimpleMutexLock> lockHolder(mutex);
130 std::list<itk::ObjectFactoryBase*> factories = itk::ObjectFactoryBase::GetRegisteredFactories();
131 std::list<itk::ObjectFactoryBase*>::iterator itFac;
133 for (itFac = factories.begin(); itFac != factories.end(); ++itFac)
139 itk::ObjectFactoryBase::UnRegisterFactory(som5dFactory);
146 itk::ObjectFactoryBase::UnRegisterFactory(som4dFactory);
153 itk::ObjectFactoryBase::UnRegisterFactory(som3dFactory);
160 itk::ObjectFactoryBase::UnRegisterFactory(som2dFactory);
165 LogAutoencoderModelFactory<TInputValue, TOutputValue>* aeFactory =
dynamic_cast<LogAutoencoderModelFactory<TInputValue, TOutputValue>*
>(*itFac);
168 itk::ObjectFactoryBase::UnRegisterFactory(aeFactory);
175 itk::ObjectFactoryBase::UnRegisterFactory(pcaFactory);