42#include "itkConfigure.h"
43#include "ITKCommonExport.h"
80#define ITK_NOOP_STATEMENT static_assert(true, "")
91#define ITK_MACROEND_NOOP_STATEMENT ITK_NOOP_STATEMENT
98#define ITK_PRAGMA(x) _Pragma(#x)
106# define ITK_GCC_PRAGMA_PUSH ITK_PRAGMA(GCC diagnostic push)
107# define ITK_GCC_PRAGMA_POP ITK_PRAGMA(GCC diagnostic pop)
108# define ITK_GCC_SUPPRESS_Wfloat_equal ITK_PRAGMA(GCC diagnostic ignored "-Wfloat-equal")
109# define ITK_GCC_SUPPRESS_Wformat_nonliteral ITK_PRAGMA(GCC diagnostic ignored "-Wformat-nonliteral")
110# define ITK_GCC_SUPPRESS_Warray_bounds ITK_PRAGMA(GCC diagnostic ignored "-Warray-bounds")
112# define ITK_GCC_PRAGMA_PUSH
113# define ITK_GCC_PRAGMA_POP
114# define ITK_GCC_SUPPRESS_Wfloat_equal
115# define ITK_GCC_SUPPRESS_Wformat_nonliteral
116# define ITK_GCC_SUPPRESS_Warray_bounds
121#if defined(__GNUC__) && !defined(__clang__)
122# define ITK_GCC_SUPPRESS_Wmaybe_uninitialized ITK_PRAGMA(GCC diagnostic ignored "-Wmaybe-uninitialized")
124# define ITK_GCC_SUPPRESS_Wmaybe_uninitialized
128#if defined(__clang__) && defined(__has_warning)
129# define ITK_CLANG_PRAGMA_PUSH ITK_PRAGMA(clang diagnostic push)
130# define ITK_CLANG_PRAGMA_POP ITK_PRAGMA(clang diagnostic pop)
131# if __has_warning("-Wzero-as-null-pointer-constant")
132# define ITK_CLANG_SUPPRESS_Wzero_as_null_pointer_constant \
133 ITK_PRAGMA(clang diagnostic ignored "-Wzero-as-null-pointer-constant")
135# define ITK_CLANG_SUPPRESS_Wzero_as_null_pointer_constant
137# if __has_warning("-Wduplicate-enum")
138# define ITK_CLANG_SUPPRESS_Wduplicate_enum ITK_PRAGMA(clang diagnostic ignored "-Wduplicate-enum")
140# define ITK_CLANG_SUPPRESS_Wduplicate_enum
143# define ITK_CLANG_PRAGMA_PUSH
144# define ITK_CLANG_PRAGMA_POP
145# define ITK_CLANG_SUPPRESS_Wzero_as_null_pointer_constant
146# define ITK_CLANG_SUPPRESS_Wduplicate_enum
151#define CLANG_PRAGMA_PUSH ITK_CLANG_PRAGMA_PUSH
152#define CLANG_PRAGMA_POP ITK_CLANG_PRAGMA_POP
153#define CLANG_SUPPRESS_Wfloat_equal ITK_GCC_SUPPRESS_Wfloat_equal
157# define ITK_FORMAT_PRINTF(a, b) __attribute__((format(printf, a, b)))
159# define ITK_FORMAT_PRINTF(a, b)
162#if !defined(ITK_LEGACY_REMOVE)
164# define CLANG_SUPPRESS_Wcpp14_extensions \
165 [[deprecated("Remove deprecated CLANG_SUPPRESS_Wcpp14_extensions c++14 warning suppression")]] void * \
166 CLANG_SUPPRESS_Wcpp14_extensions = nullptr;
178# define ITK_GCC_PRAGMA_DIAG(x) ITK_PRAGMA(GCC diagnostic x)
179# define ITK_GCC_PRAGMA_DIAG_PUSH() ITK_GCC_PRAGMA_DIAG(push)
180# define ITK_GCC_PRAGMA_DIAG_POP() ITK_GCC_PRAGMA_DIAG(pop)
182# define ITK_GCC_PRAGMA_DIAG(x)
183# define ITK_GCC_PRAGMA_DIAG_PUSH()
184# define ITK_GCC_PRAGMA_DIAG_POP()
191#if defined(_MSC_VER) && (_MSC_VER < 1920)
192# error "MSVC versions before Visual Studio 2019 are not supported"
194#if defined(__SUNPRO_CC) && (__SUNPRO_CC < 0x5140)
195# error "SUNPro C++ < 5.14.0 is not supported"
197#if defined(__CYGWIN__)
198# error "The Cygwin compiler is not supported"
200#if defined(__BORLANDC__)
201# error "The Borland C compiler is not supported"
203#if defined(__MWERKS__)
204# error "The MetroWerks compiler is not supported"
206#if defined(__GNUC__) && !defined(__clang__) && (__GNUC__ < 7)
207# error "GCC < 7 is not supported"
213# error "The SGI compiler is not supported"
215#if defined(__apple_build_version__) && (__apple_build_version__ < 12000032)
216# error "AppleClang < Xcode 12.4 is not supported"
217#elif defined(__clang__) && (__clang_major__ < 5)
218# error "Clang < 5 is not supported"
222#if defined(_WIN32) || defined(WIN32)
223# define ITK_ABI_IMPORT __declspec(dllimport)
224# define ITK_ABI_EXPORT __declspec(dllexport)
225# define ITK_ABI_HIDDEN
228# define ITK_ABI_IMPORT __attribute__((visibility("default")))
229# define ITK_ABI_EXPORT __attribute__((visibility("default")))
230# define ITK_ABI_HIDDEN __attribute__((visibility("hidden")))
232# define ITK_ABI_IMPORT
233# define ITK_ABI_EXPORT
234# define ITK_ABI_HIDDEN
239#ifndef ITK_TEMPLATE_EXPORT
240# ifdef ITK_TEMPLATE_VISIBILITY_DEFAULT
241# define ITK_TEMPLATE_EXPORT __attribute__((visibility("default")))
243# define ITK_TEMPLATE_EXPORT
248#ifdef ITK_TEMPLATE_VISIBILITY_DEFAULT
249# define ITK_FORCE_EXPORT_MACRO(moduleName) __attribute__((visibility("default")))
251# define ITK_FORCE_EXPORT_MACRO(moduleName) moduleName##_EXPORT
254#ifndef ITK_FORWARD_EXPORT
256# if defined(__APPLE__) && defined(ITK_TEMPLATE_VISIBILITY_DEFAULT) && defined(ITK_BUILD_SHARED_LIBS) && \
257 defined(USE_COMPILER_HIDDEN_VISIBILITY)
258# define ITK_FORWARD_EXPORT __attribute__((visibility("default")))
260# define ITK_FORWARD_EXPORT
286#define itkNewMacro(x) \
287 itkSimpleNewMacro(x); \
288 itkCreateAnotherMacro(x); \
290 ITK_MACROEND_NOOP_STATEMENT
292#define itkSimpleNewMacro(x) \
293 static Pointer New() \
295 Pointer smartPtr = ::itk::ObjectFactory<x>::Create(); \
296 if (smartPtr == nullptr) \
298 smartPtr = new x(); \
300 smartPtr->UnRegister(); \
303 ITK_MACROEND_NOOP_STATEMENT
305#define itkCreateAnotherMacro(x) \
306 ::itk::LightObject::Pointer CreateAnother() const override { return x::New().GetPointer(); } \
307 ITK_MACROEND_NOOP_STATEMENT
309#define itkCloneMacro(x) \
310 Pointer Clone() const \
312 Pointer rval = dynamic_cast<x *>(this->InternalClone().GetPointer()); \
315 ITK_MACROEND_NOOP_STATEMENT
321#define itkFactoryOnlyNewMacro(x) \
322 itkSimpleFactoryOnlyNewMacro(x); \
323 itkCreateAnotherMacro(x); \
325 ITK_MACROEND_NOOP_STATEMENT
327#define itkSimpleFactoryOnlyNewMacro(x) \
328 static auto New() -> Pointer \
330 Pointer smartPtr = ::itk::ObjectFactory<x>::Create(); \
331 if (smartPtr == nullptr) \
333 itkSpecializedMessageExceptionMacro(ExceptionObject, \
334 "Object factory failed to instantiate " << typeid(x).name()); \
336 smartPtr->UnRegister(); \
339 ITK_MACROEND_NOOP_STATEMENT
354#define itkFactorylessNewMacro(x) \
355 static Pointer New() \
357 auto * rawPtr = new x(); \
358 Pointer smartPtr = rawPtr; \
359 rawPtr->UnRegister(); \
362 itkCreateAnotherMacro(x); \
363 ITK_MACROEND_NOOP_STATEMENT
374#define ITK_DISALLOW_COPY_AND_MOVE(TypeName) \
375 TypeName(const TypeName &) = delete; \
376 TypeName & operator=(const TypeName &) = delete; \
377 TypeName(TypeName &&) = delete; \
378 TypeName & operator=(TypeName &&) = delete
380#if !defined(ITK_LEGACY_REMOVE)
381# define ITK_DISALLOW_COPY_AND_ASSIGN(TypeName) ITK_DISALLOW_COPY_AND_MOVE(TypeName)
383# define ITK_DISALLOW_COPY_AND_ASSIGN(TypeName) \
384 static_assert(false, "Replace deprecated ITK_DISALLOW_COPY_AND_ASSIGN with modern ITK_DISALLOW_COPY_AND_MOVE")
396#define ITK_DEFAULT_COPY_AND_MOVE(TypeName) \
397 TypeName(const TypeName &) = default; \
398 TypeName & operator=(const TypeName &) = default; \
399 TypeName(TypeName &&) = default; \
400 TypeName & operator=(TypeName &&) = default
407#if __cplusplus >= 202002L
408# define ITK_EXPERIMENTAL_CXX20_REWRITTEN_UNEQUAL_OPERATOR
414#ifdef ITK_EXPERIMENTAL_CXX20_REWRITTEN_UNEQUAL_OPERATOR
417# define ITK_UNEQUAL_OPERATOR_MEMBER_FUNCTION(TypeName) ITK_MACROEND_NOOP_STATEMENT
421# define ITK_UNEQUAL_OPERATOR_MEMBER_FUNCTION(TypeName) \
422 bool operator!=(const TypeName & other) const { return !(this->operator==(other)); } \
423 ITK_MACROEND_NOOP_STATEMENT
428#define itkInternalGetNameOfClassImplementationMacro(thisClass) \
430 static_assert(std::is_same_v<thisClass, std::remove_const_t<std::remove_reference_t<decltype(*this)>>>, \
431 "The macro argument `" #thisClass \
432 "` appears incorrect! It should correspond with the name of this class!"); \
435 ITK_MACROEND_NOOP_STATEMENT
441#define itkVirtualGetNameOfClassMacro(thisClass) \
442 virtual const char * GetNameOfClass() const itkInternalGetNameOfClassImplementationMacro(thisClass)
444#define itkOverrideGetNameOfClassMacro(thisClass) \
445 const char * GetNameOfClass() const override itkInternalGetNameOfClassImplementationMacro(thisClass)
447#ifdef ITK_FUTURE_LEGACY_REMOVE
448# define itkTypeMacro(thisClass, superclass) \
449 static_assert(false, \
450 "In a future revision of ITK, the macro `itkTypeMacro(thisClass, superclass)` will be removed. " \
451 "Please call `itkOverrideGetNameOfClassMacro(thisClass)` instead!")
452# define itkTypeMacroNoParent(thisClass) \
453 static_assert(false, \
454 "In a future revision of ITK, the macro `itkTypeMacroNoParent(thisClass)` will be removed. " \
455 "Please call `itkVirtualGetNameOfClassMacro(thisClass)` instead!")
461# define itkTypeMacro(thisClass, superclass) itkOverrideGetNameOfClassMacro(thisClass)
462# define itkTypeMacroNoParent(thisClass) itkVirtualGetNameOfClassMacro(thisClass)
475#ifndef ITK_FUTURE_LEGACY_REMOVE
476extern ITKCommon_EXPORT
void
477OutputWindowDisplayText(
const char *);
479extern ITKCommon_EXPORT
void
480OutputWindowDisplayErrorText(
const char *);
482extern ITKCommon_EXPORT
void
483OutputWindowDisplayWarningText(
const char *);
485extern ITKCommon_EXPORT
void
486OutputWindowDisplayGenericOutputText(
const char *);
488extern ITKCommon_EXPORT
void
489OutputWindowDisplayDebugText(
const char *);
493extern ITKCommon_EXPORT
void
494OutputWindowDisplayDebugText(
const char * file,
496 const char * className,
497 const void * objectAddress,
498 const char * message);
500extern ITKCommon_EXPORT
void
501OutputWindowDisplayWarningText(
const char * file,
503 const char * className,
504 const void * objectAddress,
505 const char * message);
507extern ITKCommon_EXPORT
void
508OutputWindowDisplayErrorText(
const char * file,
510 const char * className,
511 const void * objectAddress,
512 const char * message);
514extern ITKCommon_EXPORT
void
515OutputWindowDisplayGenericOutputText(
const char * file,
unsigned int line,
const char * message);
527# define itkDebugMacro(x) ITK_NOOP_STATEMENT
528# define itkDebugStatement(x) ITK_NOOP_STATEMENT
530# define itkDebugMacro(x) \
532 using namespace ::itk::print_helper; \
533 if (this->GetDebug() && ::itk::Object::GetGlobalWarningDisplay()) \
535 std::ostringstream itkmsg; \
537 ::itk::OutputWindowDisplayDebugText(__FILE__, __LINE__, this->GetNameOfClass(), this, itkmsg.str().c_str()); \
540 ITK_MACROEND_NOOP_STATEMENT
543# define itkDebugStatement(x) x
549#define itkWarningMacro(x) \
551 if (::itk::Object::GetGlobalWarningDisplay()) \
553 std::ostringstream itkmsg; \
555 ::itk::OutputWindowDisplayWarningText(__FILE__, __LINE__, this->GetNameOfClass(), this, itkmsg.str().c_str()); \
558 ITK_MACROEND_NOOP_STATEMENT
561#define itkWarningStatement(x) x
563#if defined(ITK_CPP_FUNCTION)
564# if defined(_WIN32) && !defined(__MINGW32__) && !defined(ITK_WRAPPING_PARSER)
565# define ITK_LOCATION __FUNCSIG__
566# elif defined(__GNUC__)
567# define ITK_LOCATION __PRETTY_FUNCTION__
569# define ITK_LOCATION __FUNCTION__
572# define ITK_LOCATION "unknown"
575#define itkDeclareExceptionMacro(newexcp, parentexcp, whatmessage) \
578 class newexcp : public parentexcp \
582 static constexpr const char * const default_exception_message = whatmessage; \
584 using parentexcp::parentexcp; \
585 itkOverrideGetNameOfClassMacro(newexcp); \
588 ITK_MACROEND_NOOP_STATEMENT
591#define itkSpecializedMessageExceptionMacro(ExceptionType, x) \
593 std::ostringstream exceptionDescriptionOutputStringStream; \
594 exceptionDescriptionOutputStringStream << "" x; \
595 throw ::itk::ExceptionType( \
596 std::string{ __FILE__ }, __LINE__, exceptionDescriptionOutputStringStream.str(), std::string{ ITK_LOCATION }); \
598 ITK_MACROEND_NOOP_STATEMENT
600#define itkSpecializedExceptionMacro(ExceptionType) \
601 throw ::itk::ExceptionType( \
602 std::string{ __FILE__ }, __LINE__, ::itk::ExceptionType::default_exception_message, std::string{ ITK_LOCATION });
608#define itkExceptionMacro(x) \
610 std::ostringstream exceptionDescriptionOutputStringStream; \
611 exceptionDescriptionOutputStringStream << "" x; \
612 throw ::itk::ExceptionObject(std::string{ __FILE__ }, \
614 exceptionDescriptionOutputStringStream.str(), \
615 std::string{ ITK_LOCATION }, \
618 ITK_MACROEND_NOOP_STATEMENT
620#define itkExceptionStringMacro(x) \
622 throw ::itk::ExceptionObject( \
623 std::string{ __FILE__ }, __LINE__, std::string{ x }, std::string{ ITK_LOCATION }, this); \
625 ITK_MACROEND_NOOP_STATEMENT
627#define itkGenericExceptionMacro(x) itkSpecializedMessageExceptionMacro(ExceptionObject, x)
629#define itkGenericOutputMacro(x) \
631 if (::itk::Object::GetGlobalWarningDisplay()) \
633 std::ostringstream itkmsg; \
635 ::itk::OutputWindowDisplayGenericOutputText(__FILE__, __LINE__, itkmsg.str().c_str()); \
638 ITK_MACROEND_NOOP_STATEMENT
643#define itkLogMacro(x, y) \
645 if (this->GetLogger()) \
647 this->GetLogger()->Write(::itk::LoggerBase::x, y); \
650 ITK_MACROEND_NOOP_STATEMENT
652#define itkLogMacroStatic(obj, x, y) \
654 if (obj->GetLogger()) \
656 obj->GetLogger()->Write(::itk::LoggerBase::x, y); \
659 ITK_MACROEND_NOOP_STATEMENT
690#if defined(ITK_LEGACY_REMOVE)
691# define itkLegacyMacro(method)
693# if defined(ITK_LEGACY_SILENT) || defined(ITK_LEGACY_TEST)
695# define itkLegacyMacro(method) method
698# define itkLegacyMacro(method) [[deprecated]] method
724#if defined(ITK_LEGACY_SILENT)
725# define itkLegacyBodyMacro(method, version) ITK_NOOP_STATEMENT
726# define itkLegacyReplaceBodyMacro(method, version, replace) ITK_NOOP_STATEMENT
727# define itkGenericLegacyBodyMacro(method, version) ITK_NOOP_STATEMENT
728# define itkGenericLegacyReplaceBodyMacro(method, version, replace) ITK_NOOP_STATEMENT
730# define itkLegacyBodyMacro(method, version) \
731 itkWarningMacro(#method " was deprecated for ITK " #version " and will be removed in a future version.")
732# define itkLegacyReplaceBodyMacro(method, version, replace) \
733 itkWarningMacro(#method " was deprecated for ITK " #version \
734 " and will be removed in a future version. Use " #replace " instead.")
735# define itkGenericLegacyBodyMacro(method, version) \
736 itkGenericOutputMacro(#method " was deprecated for ITK " #version " and will be removed in a future version.")
737# define itkGenericLegacyReplaceBodyMacro(method, version, replace) \
738 itkGenericOutputMacro(#method " was deprecated for ITK " #version \
739 " and will be removed in a future version. Use " #replace " instead.")
746constexpr size_t ITK_CACHE_LINE_ALIGNMENT{ 64 };
754#define itkPadStruct(mincachesize, oldtype, newtype) \
755 struct newtype : public oldtype \
757 char _StructPadding[mincachesize - (sizeof(oldtype) % mincachesize)]; \
764#if defined(ITK_HAS_GNU_ATTRIBUTE_ALIGNED)
765# define itkAlignedTypedef(alignment, oldtype, newtype) using newtype = oldtype __attribute__((aligned(alignment)))
766#elif defined(_MSC_VER)
767# define itkAlignedTypedef(alignment, oldtype, newtype) using newtype = __declspec(align(alignment)) oldtype
769# define itkAlignedTypedef(alignment, oldtype, newtype) using newtype = oldtype
772#if defined(ITK_FUTURE_LEGACY_REMOVE)
795# define ITK_FRIEND_TEMPLATE_FUNCTION_ARGUMENT(T) < >
797# define ITK_FRIEND_TEMPLATE_FUNCTION_ARGUMENT(T) "Macro remove use C++11 compliant declaration of "
813#define itkForLoopAssignmentMacro( \
814 DestinationType, SourceType, DestinationElementType, DestinationArray, SourceArray, NumberOfIterations) \
815 for (unsigned int i = 0; i < NumberOfIterations; ++i) \
817 DestinationArray[i] = static_cast<DestinationElementType>(SourceArray[i]); \
819 ITK_MACROEND_NOOP_STATEMENT
830#define itkForLoopRoundingAndAssignmentMacro( \
831 DestinationType, Sourcrnd_halfintup, DestinationElementType, DestinationArray, SourceArray, NumberOfIterations) \
832 for (unsigned int i = 0; i < NumberOfIterations; ++i) \
834 DestinationArray[i] = ::itk::Math::Round<DestinationElementType>(SourceArray[i]); \
836 ITK_MACROEND_NOOP_STATEMENT
840#if !defined(NDEBUG) && !defined(ITK_WRAPPING)
843# define itkAssertInDebugOrThrowInReleaseMacro(msg) __assert_fail(msg, __FILE__, __LINE__, __ASSERT_FUNCTION);
845# define itkAssertInDebugOrThrowInReleaseMacro(msg) itkGenericExceptionMacro(<< msg);
849# define itkAssertInDebugOrThrowInReleaseMacro(msg) itkGenericExceptionMacro(<< msg);
852#define itkAssertOrThrowMacro(test, message) \
855 std::ostringstream msgstr; \
857 itkAssertInDebugOrThrowInReleaseMacro(msgstr.str().c_str()); \
859 ITK_MACROEND_NOOP_STATEMENT
861#if !defined(NDEBUG) && !defined(ITK_WRAPPING)
862# define itkAssertInDebugAndIgnoreInReleaseMacro(X) assert(X)
864# define itkAssertInDebugAndIgnoreInReleaseMacro(X) ITK_NOOP_STATEMENT
874#ifdef ITK_FUTURE_LEGACY_REMOVE
875# define itkStaticConstMacro(name, type, value) \
876 "Replace itkStaticConstMacro(name, type, value) with `static constexpr type name = value`"
877# define itkGetStaticConstMacro(name) "Replace itkGetStaticConstMacro(name) with `Self::name`"
893# define itkStaticConstMacro(name, type, value) static constexpr type name = value
895# define itkGetStaticConstMacro(name) (Self::name)
899#define ITK_DETAIL_SetInputMacroImpl(virtualKeyword, finalKeyword, name, type) \
900 virtualKeyword void Set##name(const type * _arg) finalKeyword \
902 itkDebugMacro("setting input " #name " to " << _arg); \
903 if (_arg != itkDynamicCastInDebugMode<type *>(this->ProcessObject::GetInput(#name))) \
905 this->ProcessObject::SetInput(#name, const_cast<type *>(_arg)); \
909 ITK_MACROEND_NOOP_STATEMENT
913#define itkVirtualSetInputMacro(name, type) ITK_DETAIL_SetInputMacroImpl(virtual, , name, type)
914#define itkFinalSetInputMacro(name, type) ITK_DETAIL_SetInputMacroImpl(, final, name, type)
915#define itkNonVirtualSetInputMacro(name, type) ITK_DETAIL_SetInputMacroImpl(, , name, type)
916#define itkSetInputMacro(name, type) ITK_DETAIL_SetInputMacroImpl(virtual, , name, type)
920#define ITK_DETAIL_GetInputMacroImpl(virtualKeyword, finalKeyword, name, type) \
921 virtualKeyword const type * Get##name() const finalKeyword \
923 itkDebugMacro("returning input " << #name " of " << this->ProcessObject::GetInput(#name)); \
924 return itkDynamicCastInDebugMode<const type *>(this->ProcessObject::GetInput(#name)); \
926 ITK_MACROEND_NOOP_STATEMENT
930#define itkVirtualGetInputMacro(name, type) ITK_DETAIL_GetInputMacroImpl(virtual, , name, type)
931#define itkFinalGetInputMacro(name, type) ITK_DETAIL_GetInputMacroImpl(, final, name, type)
932#define itkNonVirtualGetInputMacro(name, type) ITK_DETAIL_GetInputMacroImpl(, , name, type)
933#define itkGetInputMacro(name, type) ITK_DETAIL_GetInputMacroImpl(virtual, , name, type)
938#define ITK_DETAIL_SetDecoratedInputMacroImpl(virtualKeyword, finalKeyword, name, type) \
939 virtualKeyword void Set##name##Input(const SimpleDataObjectDecorator<type> * _arg) finalKeyword \
941 itkDebugMacro("setting input " #name " to " << _arg); \
942 if (_arg != itkDynamicCastInDebugMode<SimpleDataObjectDecorator<type> *>(this->ProcessObject::GetInput(#name))) \
944 this->ProcessObject::SetInput(#name, const_cast<SimpleDataObjectDecorator<type> *>(_arg)); \
948 virtualKeyword void Set##name(const SimpleDataObjectDecorator<type> * _arg) finalKeyword \
950 this->Set##name##Input(_arg); \
952 virtualKeyword void Set##name(const type & _arg) finalKeyword \
954 using DecoratorType = SimpleDataObjectDecorator<type>; \
955 itkDebugMacro("setting input " #name " to " << _arg); \
956 const DecoratorType * oldInput = \
957 itkDynamicCastInDebugMode<const DecoratorType *>(this->ProcessObject::GetInput(#name)); \
958 ITK_GCC_PRAGMA_PUSH \
959 ITK_GCC_SUPPRESS_Wfloat_equal \
960 if (oldInput && oldInput->Get() == _arg) \
965 auto newInput = DecoratorType::New(); \
966 newInput->Set(_arg); \
967 this->Set##name##Input(newInput); \
969 ITK_MACROEND_NOOP_STATEMENT
974#define itkVirtualSetDecoratedInputMacro(name, type) ITK_DETAIL_SetDecoratedInputMacroImpl(virtual, , name, type)
975#define itkFinalSetDecoratedInputMacro(name, type) ITK_DETAIL_SetDecoratedInputMacroImpl(, final, name, type)
976#define itkNonVirtualSetDecoratedInputMacro(name, type) ITK_DETAIL_SetDecoratedInputMacroImpl(, , name, type)
977#define itkSetDecoratedInputMacro(name, type) ITK_DETAIL_SetDecoratedInputMacroImpl(virtual, , name, type)
982#define ITK_DETAIL_GetDecoratedInputMacroImpl(virtualKeyword, finalKeyword, name, type) \
983 virtualKeyword const SimpleDataObjectDecorator<type> * Get##name##Input() const finalKeyword \
985 itkDebugMacro("returning input " << #name " of " << this->ProcessObject::GetInput(#name)); \
986 return itkDynamicCastInDebugMode<const SimpleDataObjectDecorator<type> *>(this->ProcessObject::GetInput(#name)); \
988 virtualKeyword const type & Get##name() const finalKeyword \
990 itkDebugMacro("Getting input " #name); \
991 using DecoratorType = SimpleDataObjectDecorator<type>; \
992 const DecoratorType * input = \
993 itkDynamicCastInDebugMode<const DecoratorType *>(this->ProcessObject::GetInput(#name)); \
994 if (input == nullptr) \
996 itkExceptionStringMacro("input" #name " is not set"); \
998 return input->Get(); \
1000 ITK_MACROEND_NOOP_STATEMENT
1004#define itkVirtualGetDecoratedInputMacro(name, type) ITK_DETAIL_GetDecoratedInputMacroImpl(virtual, , name, type)
1005#define itkFinalGetDecoratedInputMacro(name, type) ITK_DETAIL_GetDecoratedInputMacroImpl(, final, name, type)
1006#define itkNonVirtualGetDecoratedInputMacro(name, type) ITK_DETAIL_GetDecoratedInputMacroImpl(, , name, type)
1007#define itkGetDecoratedInputMacro(name, type) ITK_DETAIL_GetDecoratedInputMacroImpl(virtual, , name, type)
1012#define itkVirtualSetGetDecoratedInputMacro(name, type) \
1013 itkVirtualSetDecoratedInputMacro(name, type); \
1014 itkVirtualGetDecoratedInputMacro(name, type)
1015#define itkFinalSetGetDecoratedInputMacro(name, type) \
1016 itkFinalSetDecoratedInputMacro(name, type); \
1017 itkFinalGetDecoratedInputMacro(name, type)
1018#define itkNonVirtualSetGetDecoratedInputMacro(name, type) \
1019 itkNonVirtualSetDecoratedInputMacro(name, type); \
1020 itkNonVirtualGetDecoratedInputMacro(name, type)
1021#define itkSetGetDecoratedInputMacro(name, type) \
1022 itkSetDecoratedInputMacro(name, type); \
1023 itkGetDecoratedInputMacro(name, type)
1028#define ITK_DETAIL_SetDecoratedObjectInputMacroImpl(virtualKeyword, finalKeyword, name, type) \
1029 virtualKeyword void Set##name##Input(const DataObjectDecorator<type> * _arg) finalKeyword \
1031 itkDebugMacro("setting input " #name " to " << _arg); \
1032 if (_arg != itkDynamicCastInDebugMode<DataObjectDecorator<type> *>(this->ProcessObject::GetInput(#name))) \
1034 this->ProcessObject::SetInput(#name, const_cast<DataObjectDecorator<type> *>(_arg)); \
1038 virtualKeyword void Set##name(const type * _arg) finalKeyword \
1040 using DecoratorType = DataObjectDecorator<type>; \
1041 itkDebugMacro("setting input " #name " to " << _arg); \
1042 const DecoratorType * oldInput = \
1043 itkDynamicCastInDebugMode<const DecoratorType *>(this->ProcessObject::GetInput(#name)); \
1044 if (oldInput && oldInput->Get() == _arg) \
1048 auto newInput = DecoratorType::New(); \
1049 newInput->Set(_arg); \
1050 this->Set##name##Input(newInput); \
1052 ITK_MACROEND_NOOP_STATEMENT
1057#define itkVirtualSetDecoratedObjectInputMacro(name, type) \
1058 ITK_DETAIL_SetDecoratedObjectInputMacroImpl(virtual, , name, type)
1059#define itkFinalSetDecoratedObjectInputMacro(name, type) \
1060 ITK_DETAIL_SetDecoratedObjectInputMacroImpl(, final, name, type)
1061#define itkNonVirtualSetDecoratedObjectInputMacro(name, type) \
1062 ITK_DETAIL_SetDecoratedObjectInputMacroImpl(, , name, type)
1063#define itkSetDecoratedObjectInputMacro(name, type) ITK_DETAIL_SetDecoratedObjectInputMacroImpl(virtual, , name, type)
1068#define ITK_DETAIL_GetDecoratedObjectInputMacroImpl(virtualKeyword, finalKeyword, name, type) \
1069 virtualKeyword const DataObjectDecorator<type> * Get##name##Input() const finalKeyword \
1071 itkDebugMacro("returning input " << #name " of " << this->ProcessObject::GetInput(#name)); \
1072 return itkDynamicCastInDebugMode<const DataObjectDecorator<type> *>(this->ProcessObject::GetInput(#name)); \
1074 virtualKeyword const type * Get##name() const finalKeyword \
1076 itkDebugMacro("Getting input " #name); \
1077 using DecoratorType = DataObjectDecorator<type>; \
1078 const DecoratorType * input = \
1079 itkDynamicCastInDebugMode<const DecoratorType *>(this->ProcessObject::GetInput(#name)); \
1080 if (input == nullptr) \
1084 return input->Get(); \
1086 ITK_MACROEND_NOOP_STATEMENT
1091#define itkVirtualGetDecoratedObjectInputMacro(name, type) \
1092 ITK_DETAIL_GetDecoratedObjectInputMacroImpl(virtual, , name, type)
1093#define itkFinalGetDecoratedObjectInputMacro(name, type) \
1094 ITK_DETAIL_GetDecoratedObjectInputMacroImpl(, final, name, type)
1095#define itkNonVirtualGetDecoratedObjectInputMacro(name, type) \
1096 ITK_DETAIL_GetDecoratedObjectInputMacroImpl(, , name, type)
1097#define itkGetDecoratedObjectInputMacro(name, type) ITK_DETAIL_GetDecoratedObjectInputMacroImpl(virtual, , name, type)
1102#define itkVirtualSetGetDecoratedObjectInputMacro(name, type) \
1103 itkVirtualSetDecoratedObjectInputMacro(name, type); \
1104 itkVirtualGetDecoratedObjectInputMacro(name, type)
1105#define itkFinalSetGetDecoratedObjectInputMacro(name, type) \
1106 itkFinalSetDecoratedObjectInputMacro(name, type); \
1107 itkFinalGetDecoratedObjectInputMacro(name, type)
1108#define itkNonVirtualSetGetDecoratedObjectInputMacro(name, type) \
1109 itkNonVirtualSetDecoratedObjectInputMacro(name, type); \
1110 itkNonVirtualGetDecoratedObjectInputMacro(name, type)
1111#define itkSetGetDecoratedObjectInputMacro(name, type) \
1112 itkSetDecoratedObjectInputMacro(name, type); \
1113 itkGetDecoratedObjectInputMacro(name, type)
1126#define ITK_DETAIL_SetMacroImpl(virtualKeyword, finalKeyword, name, type) \
1127 virtualKeyword void Set##name(type _arg) finalKeyword \
1129 itkDebugMacro("setting " #name " to " << _arg); \
1130 ITK_GCC_PRAGMA_PUSH \
1131 ITK_GCC_SUPPRESS_Wfloat_equal \
1132 if (this->m_##name != _arg) \
1134 this->m_##name = std::move(_arg); \
1137 ITK_GCC_PRAGMA_POP \
1139 ITK_MACROEND_NOOP_STATEMENT
1143#define ITK_DETAIL_GetMacroImpl(virtualKeyword, finalKeyword, name, type) \
1144 virtualKeyword type Get##name() finalKeyword { return this->m_##name; } \
1145 ITK_MACROEND_NOOP_STATEMENT
1148#define ITK_DETAIL_GetConstMacroImpl(virtualKeyword, finalKeyword, name, type) \
1149 virtualKeyword type Get##name() const finalKeyword { return this->m_##name; } \
1150 ITK_MACROEND_NOOP_STATEMENT
1153#define ITK_DETAIL_GetConstReferenceMacroImpl(virtualKeyword, finalKeyword, name, type) \
1154 virtualKeyword const type & Get##name() const finalKeyword { return this->m_##name; } \
1155 ITK_MACROEND_NOOP_STATEMENT
1159#define itkVirtualSetMacro(name, type) ITK_DETAIL_SetMacroImpl(virtual, , name, type)
1160#define itkFinalSetMacro(name, type) ITK_DETAIL_SetMacroImpl(, final, name, type)
1161#define itkNonVirtualSetMacro(name, type) ITK_DETAIL_SetMacroImpl(, , name, type)
1162#define itkSetMacro(name, type) ITK_DETAIL_SetMacroImpl(virtual, , name, type)
1167#define itkVirtualGetMacro(name, type) ITK_DETAIL_GetMacroImpl(virtual, , name, type)
1168#define itkFinalGetMacro(name, type) ITK_DETAIL_GetMacroImpl(, final, name, type)
1169#define itkNonVirtualGetMacro(name, type) ITK_DETAIL_GetMacroImpl(, , name, type)
1170#define itkGetMacro(name, type) ITK_DETAIL_GetMacroImpl(virtual, , name, type)
1177#define itkVirtualGetConstMacro(name, type) ITK_DETAIL_GetConstMacroImpl(virtual, , name, type)
1178#define itkFinalGetConstMacro(name, type) ITK_DETAIL_GetConstMacroImpl(, final, name, type)
1179#define itkNonVirtualGetConstMacro(name, type) ITK_DETAIL_GetConstMacroImpl(, , name, type)
1180#define itkGetConstMacro(name, type) ITK_DETAIL_GetConstMacroImpl(virtual, , name, type)
1188#define itkVirtualGetConstReferenceMacro(name, type) ITK_DETAIL_GetConstReferenceMacroImpl(virtual, , name, type)
1189#define itkFinalGetConstReferenceMacro(name, type) ITK_DETAIL_GetConstReferenceMacroImpl(, final, name, type)
1190#define itkNonVirtualGetConstReferenceMacro(name, type) ITK_DETAIL_GetConstReferenceMacroImpl(, , name, type)
1191#define itkGetConstReferenceMacro(name, type) ITK_DETAIL_GetConstReferenceMacroImpl(virtual, , name, type)
1195#define ITK_DETAIL_SetEnumMacroImpl(virtualKeyword, finalKeyword, name, type) \
1196 virtualKeyword void Set##name(const type _arg) finalKeyword \
1198 itkDebugMacro("setting " #name " to " << static_cast<long>(_arg)); \
1199 if (this->m_##name != _arg) \
1201 this->m_##name = _arg; \
1205 ITK_MACROEND_NOOP_STATEMENT
1211#define itkVirtualSetEnumMacro(name, type) ITK_DETAIL_SetEnumMacroImpl(virtual, , name, type)
1212#define itkFinalSetEnumMacro(name, type) ITK_DETAIL_SetEnumMacroImpl(, final, name, type)
1213#define itkNonVirtualSetEnumMacro(name, type) ITK_DETAIL_SetEnumMacroImpl(, , name, type)
1214#define itkSetEnumMacro(name, type) ITK_DETAIL_SetEnumMacroImpl(virtual, , name, type)
1218#define ITK_DETAIL_GetEnumMacroImpl(virtualKeyword, finalKeyword, name, type) \
1219 virtualKeyword type Get##name() const finalKeyword { return this->m_##name; } \
1220 ITK_MACROEND_NOOP_STATEMENT
1225#define itkVirtualGetEnumMacro(name, type) ITK_DETAIL_GetEnumMacroImpl(virtual, , name, type)
1226#define itkFinalGetEnumMacro(name, type) ITK_DETAIL_GetEnumMacroImpl(, final, name, type)
1227#define itkNonVirtualGetEnumMacro(name, type) ITK_DETAIL_GetEnumMacroImpl(, , name, type)
1228#define itkGetEnumMacro(name, type) ITK_DETAIL_GetEnumMacroImpl(virtual, , name, type)
1233#define ITK_DETAIL_SetStringMacroImpl(virtualKeyword, finalKeyword, name) \
1234 virtualKeyword void Set##name(const char * _arg) finalKeyword \
1236 if (_arg && (_arg == this->m_##name)) \
1242 this->m_##name = _arg; \
1246 this->m_##name = ""; \
1250 virtualKeyword void Set##name(const std::string & _arg) finalKeyword { this->Set##name(_arg.c_str()); } \
1251 ITK_MACROEND_NOOP_STATEMENT
1256#define itkVirtualSetStringMacro(name) ITK_DETAIL_SetStringMacroImpl(virtual, , name)
1257#define itkFinalSetStringMacro(name) ITK_DETAIL_SetStringMacroImpl(, final, name)
1258#define itkNonVirtualSetStringMacro(name) ITK_DETAIL_SetStringMacroImpl(, , name)
1259#define itkSetStringMacro(name) ITK_DETAIL_SetStringMacroImpl(virtual, , name)
1263#define ITK_DETAIL_GetStringMacroImpl(virtualKeyword, finalKeyword, name) \
1264 virtualKeyword const char * Get##name() const finalKeyword { return this->m_##name.c_str(); } \
1265 ITK_MACROEND_NOOP_STATEMENT
1270#define itkVirtualGetStringMacro(name) ITK_DETAIL_GetStringMacroImpl(virtual, , name)
1271#define itkFinalGetStringMacro(name) ITK_DETAIL_GetStringMacroImpl(, final, name)
1272#define itkNonVirtualGetStringMacro(name) ITK_DETAIL_GetStringMacroImpl(, , name)
1273#define itkGetStringMacro(name) ITK_DETAIL_GetStringMacroImpl(virtual, , name)
1278#define ITK_DETAIL_SetClampMacroImpl(virtualKeyword, finalKeyword, name, type, min, max) \
1279 virtualKeyword void Set##name(type _arg) finalKeyword \
1281 const type temp_extrema = (_arg <= min ? min : (_arg >= max ? max : _arg)); \
1282 itkDebugMacro("setting " << #name " to " << _arg); \
1283 ITK_GCC_PRAGMA_PUSH \
1284 ITK_GCC_SUPPRESS_Wfloat_equal \
1285 if (this->m_##name != temp_extrema) \
1287 this->m_##name = temp_extrema; \
1290 ITK_GCC_PRAGMA_POP \
1292 ITK_MACROEND_NOOP_STATEMENT
1298#define itkVirtualSetClampMacro(name, type, min, max) ITK_DETAIL_SetClampMacroImpl(virtual, , name, type, min, max)
1299#define itkFinalSetClampMacro(name, type, min, max) ITK_DETAIL_SetClampMacroImpl(, final, name, type, min, max)
1300#define itkNonVirtualSetClampMacro(name, type, min, max) ITK_DETAIL_SetClampMacroImpl(, , name, type, min, max)
1301#define itkSetClampMacro(name, type, min, max) ITK_DETAIL_SetClampMacroImpl(virtual, , name, type, min, max)
1306#define ITK_DETAIL_SetObjectMacroImpl(virtualKeyword, finalKeyword, name, type) \
1307 virtualKeyword void Set##name(type * _arg) finalKeyword \
1309 itkDebugMacro("setting " << #name " to " << _arg); \
1310 if (this->m_##name != _arg) \
1312 this->m_##name = _arg; \
1316 ITK_MACROEND_NOOP_STATEMENT
1321#define itkVirtualSetObjectMacro(name, type) ITK_DETAIL_SetObjectMacroImpl(virtual, , name, type)
1322#define itkFinalSetObjectMacro(name, type) ITK_DETAIL_SetObjectMacroImpl(, final, name, type)
1323#define itkNonVirtualSetObjectMacro(name, type) ITK_DETAIL_SetObjectMacroImpl(, , name, type)
1324#define itkSetObjectMacro(name, type) ITK_DETAIL_SetObjectMacroImpl(virtual, , name, type)
1342#define ITK_DETAIL_GetConstObjectMacroImpl(virtualKeyword, finalKeyword, name, type) \
1343 virtualKeyword const type * Get##name() const finalKeyword { return this->m_##name.GetPointer(); } \
1344 ITK_MACROEND_NOOP_STATEMENT
1349#define itkVirtualGetConstObjectMacro(name, type) ITK_DETAIL_GetConstObjectMacroImpl(virtual, , name, type)
1350#define itkFinalGetConstObjectMacro(name, type) ITK_DETAIL_GetConstObjectMacroImpl(, final, name, type)
1351#define itkNonVirtualGetConstObjectMacro(name, type) ITK_DETAIL_GetConstObjectMacroImpl(, , name, type)
1352#define itkGetConstObjectMacro(name, type) ITK_DETAIL_GetConstObjectMacroImpl(virtual, , name, type)
1357#if defined(ITK_FUTURE_LEGACY_REMOVE)
1364# define ITK_DETAIL_GetObjectMacroImpl(virtualKeyword, finalKeyword, name, type) \
1365 virtualKeyword type * Get##name() finalKeyword \
1367 purposeful_error("itkGetObjectMacro should be replaced with itkGetModifiableObjectMacro."); \
1369 ITK_MACROEND_NOOP_STATEMENT
1372# define ITK_DETAIL_GetModifiableObjectMacroImpl(virtualKeyword, finalKeyword, name, type) \
1373 virtualKeyword type * GetModifiable##name() finalKeyword { return this->m_##name.GetPointer(); } \
1374 ITK_DETAIL_GetConstObjectMacroImpl(virtualKeyword, finalKeyword, name, type)
1378# define ITK_DETAIL_GetObjectMacroImpl(virtualKeyword, finalKeyword, name, type) \
1379 virtualKeyword type * Get##name() finalKeyword { return this->m_##name.GetPointer(); } \
1380 ITK_MACROEND_NOOP_STATEMENT
1383# define ITK_DETAIL_GetModifiableObjectMacroImpl(virtualKeyword, finalKeyword, name, type) \
1384 virtualKeyword type * GetModifiable##name() finalKeyword { return this->m_##name.GetPointer(); } \
1385 ITK_DETAIL_GetConstObjectMacroImpl(virtualKeyword, finalKeyword, name, type); \
1386 ITK_DETAIL_GetObjectMacroImpl(virtualKeyword, finalKeyword, name, type)
1394#define itkVirtualGetObjectMacro(name, type) ITK_DETAIL_GetObjectMacroImpl(virtual, , name, type)
1395#define itkFinalGetObjectMacro(name, type) ITK_DETAIL_GetObjectMacroImpl(, final, name, type)
1396#define itkNonVirtualGetObjectMacro(name, type) ITK_DETAIL_GetObjectMacroImpl(, , name, type)
1397#define itkGetObjectMacro(name, type) ITK_DETAIL_GetObjectMacroImpl(virtual, , name, type)
1399#define itkVirtualGetModifiableObjectMacro(name, type) ITK_DETAIL_GetModifiableObjectMacroImpl(virtual, , name, type)
1400#define itkFinalGetModifiableObjectMacro(name, type) ITK_DETAIL_GetModifiableObjectMacroImpl(, final, name, type)
1401#define itkNonVirtualGetModifiableObjectMacro(name, type) ITK_DETAIL_GetModifiableObjectMacroImpl(, , name, type)
1402#define itkGetModifiableObjectMacro(name, type) ITK_DETAIL_GetModifiableObjectMacroImpl(virtual, , name, type)
1411#define ITK_DETAIL_GetConstReferenceObjectMacroImpl(virtualKeyword, finalKeyword, name, type) \
1412 virtualKeyword const typename type::Pointer & Get##name() const finalKeyword { return this->m_##name; } \
1413 ITK_MACROEND_NOOP_STATEMENT
1418#define itkVirtualGetConstReferenceObjectMacro(name, type) \
1419 ITK_DETAIL_GetConstReferenceObjectMacroImpl(virtual, , name, type)
1420#define itkFinalGetConstReferenceObjectMacro(name, type) \
1421 ITK_DETAIL_GetConstReferenceObjectMacroImpl(, final, name, type)
1422#define itkNonVirtualGetConstReferenceObjectMacro(name, type) \
1423 ITK_DETAIL_GetConstReferenceObjectMacroImpl(, , name, type)
1424#define itkGetConstReferenceObjectMacro(name, type) ITK_DETAIL_GetConstReferenceObjectMacroImpl(virtual, , name, type)
1429#define ITK_DETAIL_SetConstObjectMacroImpl(virtualKeyword, finalKeyword, name, type) \
1430 virtualKeyword void Set##name(const type * _arg) finalKeyword \
1432 itkDebugMacro("setting " << #name " to " << _arg); \
1433 if (this->m_##name != _arg) \
1435 this->m_##name = _arg; \
1439 ITK_MACROEND_NOOP_STATEMENT
1444#define itkVirtualSetConstObjectMacro(name, type) ITK_DETAIL_SetConstObjectMacroImpl(virtual, , name, type)
1445#define itkFinalSetConstObjectMacro(name, type) ITK_DETAIL_SetConstObjectMacroImpl(, final, name, type)
1446#define itkNonVirtualSetConstObjectMacro(name, type) ITK_DETAIL_SetConstObjectMacroImpl(, , name, type)
1447#define itkSetConstObjectMacro(name, type) ITK_DETAIL_SetConstObjectMacroImpl(virtual, , name, type)
1450#define ITK_DETAIL_BooleanMacroImpl(virtualKeyword, finalKeyword, name) \
1451 virtualKeyword void name##On() finalKeyword { this->Set##name(true); } \
1452 virtualKeyword void name##Off() finalKeyword { this->Set##name(false); } \
1453 ITK_MACROEND_NOOP_STATEMENT
1458#define itkVirtualBooleanMacro(name) ITK_DETAIL_BooleanMacroImpl(virtual, , name)
1459#define itkFinalBooleanMacro(name) ITK_DETAIL_BooleanMacroImpl(, final, name)
1460#define itkNonVirtualBooleanMacro(name) ITK_DETAIL_BooleanMacroImpl(, , name)
1461#define itkBooleanMacro(name) ITK_DETAIL_BooleanMacroImpl(virtual, , name)
1472template <
typename MemberContainerType,
typename CopyFromValueType,
typename LoopEndType>
1474ContainerFillWithCheck(MemberContainerType & m,
const CopyFromValueType & c,
const LoopEndType N)
1476 bool value_updated =
false;
1477 for (
unsigned int i = 0; i < N; ++i)
1480 ITK_GCC_SUPPRESS_Wfloat_equal
1484 value_updated =
true;
1488 return value_updated;
1499template <
typename MemberContainerType,
typename CopyFromContainerType,
typename LoopEndType>
1501ContainerCopyWithCheck(MemberContainerType & m,
const CopyFromContainerType & c,
const LoopEndType N)
1503 bool value_updated =
false;
1504 for (LoopEndType i = 0; i < N; ++i)
1507 ITK_GCC_SUPPRESS_Wfloat_equal
1511 value_updated =
true;
1515 return value_updated;
1520#define ITK_DETAIL_SetVectorMacroImpl(virtualKeyword, finalKeyword, name, type, count) \
1521 virtualKeyword void Set##name(type data[]) finalKeyword \
1523 if (ContainerCopyWithCheck(this->m_##name, data, count)) \
1528 ITK_MACROEND_NOOP_STATEMENT
1535#define itkVirtualSetVectorMacro(name, type, count) ITK_DETAIL_SetVectorMacroImpl(virtual, , name, type, count)
1536#define itkFinalSetVectorMacro(name, type, count) ITK_DETAIL_SetVectorMacroImpl(, final, name, type, count)
1537#define itkNonVirtualSetVectorMacro(name, type, count) ITK_DETAIL_SetVectorMacroImpl(, , name, type, count)
1538#define itkSetVectorMacro(name, type, count) ITK_DETAIL_SetVectorMacroImpl(virtual, , name, type, count)
1543#define ITK_DETAIL_GetVectorMacroImpl(virtualKeyword, finalKeyword, name, type, count) \
1544 virtualKeyword type * Get##name() const finalKeyword { return this->m_##name; } \
1545 ITK_MACROEND_NOOP_STATEMENT
1549#define itkVirtualGetVectorMacro(name, type, count) ITK_DETAIL_GetVectorMacroImpl(virtual, , name, type, count)
1550#define itkFinalGetVectorMacro(name, type, count) ITK_DETAIL_GetVectorMacroImpl(, final, name, type, count)
1551#define itkNonVirtualGetVectorMacro(name, type, count) ITK_DETAIL_GetVectorMacroImpl(, , name, type, count)
1552#define itkGetVectorMacro(name, type, count) ITK_DETAIL_GetVectorMacroImpl(virtual, , name, type, count)
1559#define itkGPUKernelClassMacro(kernel) class itkGPUKernelMacro(kernel)
1567#define itkGPUKernelMacro(kernel) \
1571 ITK_DISALLOW_COPY_AND_MOVE(kernel); \
1572 kernel() = delete; \
1573 ~kernel() = delete; \
1574 static const char * GetOpenCLSource(); \
1577#define itkGetOpenCLSourceFromKernelMacro(kernel) \
1578 static const char * GetOpenCLSource() { return kernel::GetOpenCLSource(); } \
1579 ITK_MACROEND_NOOP_STATEMENT
1583#define itkPrintSelfObjectMacro(name) \
1584 if (static_cast<const LightObject *>(this->m_##name) == nullptr) \
1586 os << indent << #name << ": (null)" << std::endl; \
1590 os << indent << #name << ": " << std::endl; \
1591 this->m_##name->Print(os, indent.GetNextIndent()); \
1593 ITK_MACROEND_NOOP_STATEMENT
1598#define itkPrintSelfBooleanMacro(name) \
1599 os << indent << #name << ": " << (this->m_##name ? "On" : "Off") << std::endl; \
1600 ITK_MACROEND_NOOP_STATEMENT
1605#define ITK_DETAIL_SetDecoratedOutputMacroImpl(virtualKeyword, finalKeyword, name, type) \
1606 virtualKeyword void Set##name##Output(const SimpleDataObjectDecorator<type> * _arg) finalKeyword \
1608 itkDebugMacro("setting output " #name " to " << _arg); \
1609 if (_arg != itkDynamicCastInDebugMode<SimpleDataObjectDecorator<type> *>(this->ProcessObject::GetOutput(#name))) \
1611 this->ProcessObject::SetOutput(#name, const_cast<SimpleDataObjectDecorator<type> *>(_arg)); \
1615 virtualKeyword void Set##name(const type & _arg) finalKeyword \
1617 using DecoratorType = SimpleDataObjectDecorator<type>; \
1618 itkDebugMacro("setting output " #name " to " << _arg); \
1619 DecoratorType * output = itkDynamicCastInDebugMode<DecoratorType *>(this->ProcessObject::GetOutput(#name)); \
1622 if (output->Get() == _arg) \
1628 output->Set(_arg); \
1633 auto newOutput = DecoratorType::New(); \
1634 newOutput->Set(_arg); \
1635 this->Set##name##Output(newOutput); \
1638 ITK_MACROEND_NOOP_STATEMENT
1642#define itkVirtualSetDecoratedOutputMacro(name, type) ITK_DETAIL_SetDecoratedOutputMacroImpl(virtual, , name, type)
1643#define itkFinalSetDecoratedOutputMacro(name, type) ITK_DETAIL_SetDecoratedOutputMacroImpl(, final, name, type)
1644#define itkNonVirtualSetDecoratedOutputMacro(name, type) ITK_DETAIL_SetDecoratedOutputMacroImpl(, , name, type)
1645#define itkSetDecoratedOutputMacro(name, type) ITK_DETAIL_SetDecoratedOutputMacroImpl(virtual, , name, type)
1650#define ITK_DETAIL_GetDecoratedOutputMacroImpl(virtualKeyword, finalKeyword, name, type) \
1651 virtualKeyword const SimpleDataObjectDecorator<type> * Get##name##Output() const finalKeyword \
1653 itkDebugMacro("returning output " << #name " of " << this->ProcessObject::GetOutput(#name)); \
1654 return itkDynamicCastInDebugMode<const SimpleDataObjectDecorator<type> *>(this->ProcessObject::GetOutput(#name)); \
1656 virtualKeyword const type & Get##name() const finalKeyword \
1658 itkDebugMacro("Getting output " #name); \
1659 using DecoratorType = SimpleDataObjectDecorator<type>; \
1660 const DecoratorType * output = \
1661 itkDynamicCastInDebugMode<const DecoratorType *>(this->ProcessObject::GetOutput(#name)); \
1662 if (output == nullptr) \
1664 itkExceptionStringMacro("output" #name " is not set"); \
1666 return output->Get(); \
1668 ITK_MACROEND_NOOP_STATEMENT
1672#define itkVirtualGetDecoratedOutputMacro(name, type) ITK_DETAIL_GetDecoratedOutputMacroImpl(virtual, , name, type)
1673#define itkFinalGetDecoratedOutputMacro(name, type) ITK_DETAIL_GetDecoratedOutputMacroImpl(, final, name, type)
1674#define itkNonVirtualGetDecoratedOutputMacro(name, type) ITK_DETAIL_GetDecoratedOutputMacroImpl(, , name, type)
1675#define itkGetDecoratedOutputMacro(name, type) ITK_DETAIL_GetDecoratedOutputMacroImpl(virtual, , name, type)
1679#if defined(ITK_LEGACY_REMOVE) && !defined(ITK_LEGACY_SILENT)
1680# define ITK_FUTURE_DEPRECATED(message) [[deprecated(message)]]
1682# define ITK_FUTURE_DEPRECATED(message)
1685#if __cplusplus >= 202002L
1686# define ITK_NODISCARD(message) [[nodiscard(message)]]
1688# define ITK_NODISCARD(message) [[nodiscard]]
1693#if defined(ITK_LEGACY_REMOVE)
1694# define itkExposeEnumValue(name) \
1695 static_assert(false, "ERROR: Replace static_cast<int>(name) with with proper enumeration instead of integer")
1697# define ITK_NOEXCEPT_OR_THROW static_assert(false, "Replace ITK_NOEXCEPT_OR_THROW with ITK_NOEXCEPT")
1699# define ITK_DELETE_FUNCTION static_assert(false, "ERROR: ITK_DELETE_FUNCTION must be replaced with `= delete`"
1700# define ITK_CONSTEXPR_FUNC static_assert(false, "ERROR: ITK_CONSTEXPR_FUNC must be replaced with 'constexpr'")
1701# define ITK_CONSTEXPR_VAR static_assert(false, "ERROR: ITK_CONSTEXPR_VAR must be replaced with 'constexpr'")
1703# define ITK_FALLTHROUGH static_assert(false, "ERROR: ITK_FALLTHROUGH must be replaced with '[[fallthrough]]'")
1706# define ITK_ALIGNAS static_assert(false, "ERROR: ITK_ALIGNAS must be replaced with 'alignas'")
1707# define ITK_ALIGNOF static_assert(false, "ERROR: ITK_ALIGNOF must be replaced with 'alignof'")
1708# define ITK_DEPRECATED static_assert(false, "ERROR: ITK_DEPRECATED must be replaced with '[[deprecated]]'")
1709# define ITK_DEPRECATED_MSG \
1710 static_assert(false, "ERROR: ITK_DEPRECATED_MSG must be replaced with '[[deprecated(MSG)]]'")
1711# define ITK_CONSTEXPR static_assert(false, "ERROR: ITK_CONSTEXPR must be replaced with 'constexpr'")
1712# define ITK_DELETED_FUNCTION static_assert(false, "ERROR: ITK_DELETED_FUNCTION must be replaced with '= delete'")
1713# define ITK_EXTERN_TEMPLATE static_assert(false, "ERROR: ITK_EXTERN_TEMPLATE must be replaced with 'extern'")
1714# define ITK_FINAL static_assert(false, "ERROR: ITK_FINAL must be replaced with 'final'")
1715# define ITK_NOEXCEPT static_assert(false, "ERROR: ITK_NOEXCEPT must be replaced with 'noexcept'")
1716# define ITK_NOEXCEPT_EXPR static_assert(false, "ERROR: ITK_NOEXCEPT_EXPR must be replaced with 'noexcept'")
1717# define ITK_NULLPTR static_assert(false, "ERROR: ITK_NULLPTR must be replaced with 'nullptr'")
1718# define ITK_OVERRIDE static_assert(false, "ERROR: ITK_OVERRIDE must be replaced with 'override'")
1719# define ITK_STATIC_ASSERT static_assert(false, "ERROR: ITK_STATIC_ASSERT must be replaced with 'static_assert'")
1720# define ITK_STATIC_ASSERT_MSG \
1721 static_assert(false, "ERROR: ITK_STATIC_ASSERT_MSG must be replaced with 'static_assert'")
1722# define ITK_THREAD_LOCAL static_assert(false, "ERROR: ITK_THREAD_LOCAL must be replaced with 'thread_local'")
1725# define ITKv5_CONST static_assert(false, "ERROR: ITKv5_CONST must be replaced with 'const'")
1727# define ITK_ITERATOR_VIRTUAL static_assert(false, "ERROR: ITK_ITERATOR_VIRTUAL must be removed'")
1728# define ITK_ITERATOR_OVERRIDE static_assert(false, "ERROR: ITK_ITERATOR_OVERRIDE must be removed")
1729# define ITK_ITERATOR_FINAL static_assert(false, "ERROR: ITK_ITERATOR_FINAL must be removed")
1738# define itkExposeEnumValue(name) static_cast<int>(name)
1741# define ITK_NOEXCEPT_OR_THROW ITK_NOEXCEPT
1743# define ITK_FALLTHROUGH [[fallthrough]]
1745# define ITK_DELETE_FUNCTION = delete
1747# define ITK_CONSTEXPR_FUNC constexpr
1748# define ITK_CONSTEXPR_VAR constexpr
1751# define ITK_ALIGNAS(X) alignas(X)
1752# define ITK_ALIGNOF(X) alignof(X)
1753# define ITK_DEPRECATED [[deprecated]]
1754# define ITK_DEPRECATED_MSG(MSG) [[deprecated(MSG)]]
1755# define ITK_CONSTEXPR constexpr
1756# define ITK_DELETED_FUNCTION = delete
1757# define ITK_EXTERN_TEMPLATE extern
1758# define ITK_FINAL final
1759# define ITK_NOEXCEPT noexcept
1760# define ITK_NOEXCEPT_EXPR(X) noexcept(X)
1761# define ITK_NULLPTR nullptr
1762# define ITK_OVERRIDE override
1763# define ITK_STATIC_ASSERT(X) static_assert(X, #X)
1764# define ITK_STATIC_ASSERT_MSG(X, MSG) static_assert(X, MSG)
1765# define ITK_THREAD_LOCAL thread_local
1768# define ITKv5_CONST const
1770# define ITK_ITERATOR_VIRTUAL
1771# define ITK_ITERATOR_OVERRIDE
1772# define ITK_ITERATOR_FINAL
1775#define allow_inclusion_of_itkExceptionObject_h
1781#undef allow_inclusion_of_itkExceptionObject_h
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....