20 #include <itkLightObject.h>
43 return dynamic_cast<T*
>(_itkObject.GetPointer());
47 itk::LightObject::Pointer _itkObject;
75 if (!outputFieldName) {
77 "Passed field name pointer is nullptr. Ignoring call.");
85 _baseField = module.
addBase(outputFieldName);
87 _baseField->setBaseValue(&_baseWrapper);
96 if (!inputFieldName) {
98 "Passed field name pointer is nullptr. Ignoring call.");
106 _baseField = module.
addBase(inputFieldName);
115 _baseWrapper.setITKPointer(newObject);
142 return _baseWrapper.template getITKPointer<OBJ_TYPE>();
156 WRAPPER_CLASS_NAME* wrapperBasePtr = _baseField->getTypedBaseValue<WRAPPER_CLASS_NAME*>();
157 return wrapperBasePtr ? wrapperBasePtr->template getITKPointer<OBJ_TYPE>() :
nullptr;
180 #define ML_CREATE_ITK_POINTER_WRAPPER_H(CLASS_NAME, PARENT_BASE_CLASS_NAME, ML_EXPORT_MACRO) \
183 class ML_EXPORT_MACRO ITK##CLASS_NAME##Wrapper : public PARENT_BASE_CLASS_NAME \
186 ITK##CLASS_NAME##Wrapper() = default; \
190 ML_CLASS_HEADER(ITK##CLASS_NAME##Wrapper); \
193 typedef ITKTypedPointerWrapper<CLASS_NAME, ITK##CLASS_NAME##Wrapper> CLASS_NAME##Wrapper; \
202 #define ML_CREATE_ITK_POINTER_WRAPPER_CPP(CLASS_NAME, PARENT_BASE_CLASS_NAME) \
205 ML_CLASS_SOURCE(ITK##CLASS_NAME##Wrapper, PARENT_BASE_CLASS_NAME);
Field to encapsulate a pointer to an ML base object.
void addAllowedType(const RuntimeType *allowedType)
Adds type to the list of allowed types.
Class representing general ML objects that support import/export via strings (setPersistentState() an...
BaseField * addBase(const char *name)
Creates a Base field with name and adds it to the container. Default value is NULL.
Class to create a Base wrapper around an object of a certain template type.
BaseField * getInputBaseField()
For legacy reasons there are two fields for getting the base field.
void addInputBaseField(Module &module, const char *inputFieldName)
Method to add a base field to the passed Module module.
WRAPPER_CLASS_NAME _baseWrapper
Reference to the Base object wrapping the ITK object pointer.
OBJ_TYPE::Pointer getWrappedOutputObject()
Return the pointer to the wrapped object.
ITKTypedPointerWrapper()
Constructor.
BaseField * getOutputBaseField()
For legacy reasons there are two fields for getting the base field.
void addOutputBaseField(Module &module, const char *outputFieldName)
Method to add a base field to the passed Module module.
OBJ_TYPE::Pointer getWrappedInputObject()
Return the pointer to the wrapped input object, if it is of the correct type, otherwise a nullptr.
void setNewOutputBaseFieldObject(OBJ_TYPE::Pointer newObject)
Set base field so that it points to the new object.
Helper class to have a common base class for all derived wrapper.
ML_ABSTRACT_CLASS_HEADER(ITKWrapperBase)
Register this class abstractly.
ITKWrapperBase()
Private on purpose to avoid instantiations.
void setITKPointer(itk::LightObject::Pointer obj)
T::Pointer getITKPointer()
Base class for an image processing module of the ML.
#define ML_BAD_POINTER_OR_0
A pointer is NULL or a value is NULL or 0 where it should not be.
#define ML_BAD_STATE
The current state of an object is not appropriate for an operation.
#define ML_PRINT_ERROR(FUNC_NAME, REASON, HANDLING)
Like ML_PRINT_ERROR_DUMP(FUNC_NAME, REASON, HANDLING, RT_OBJ) without a runtime object to be dumped.
#define MLITK_SUPPORT_EXPORT
When included by other libraries MLITK_SUPPORT_EXPORT is compiled as import symbol.