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;
170#if defined(__INTEL_COMPILER)
171# define INTEL_PRAGMA_WARN_PUSH ITK_PRAGMA(warning push)
172# define INTEL_PRAGMA_WARN_POP ITK_PRAGMA(warning pop)
173# define INTEL_SUPPRESS_warning_1292 ITK_PRAGMA(warning disable 1292)
175# define INTEL_PRAGMA_WARN_PUSH
176# define INTEL_PRAGMA_WARN_POP
177# define INTEL_SUPPRESS_warning_1292
188#if defined(__GNUC__) && !defined(__INTEL_COMPILER)
189# define ITK_GCC_PRAGMA_DIAG(x) ITK_PRAGMA(GCC diagnostic x)
190# define ITK_GCC_PRAGMA_DIAG_PUSH() ITK_GCC_PRAGMA_DIAG(push)
191# define ITK_GCC_PRAGMA_DIAG_POP() ITK_GCC_PRAGMA_DIAG(pop)
193# define ITK_GCC_PRAGMA_DIAG(x)
194# define ITK_GCC_PRAGMA_DIAG_PUSH()
195# define ITK_GCC_PRAGMA_DIAG_POP()
202#if defined(_MSC_VER) && (_MSC_VER < 1920)
203# error "MSVC versions before Visual Studio 2019 are not supported"
205#if defined(__SUNPRO_CC) && (__SUNPRO_CC < 0x5140)
206# error "SUNPro C++ < 5.14.0 is not supported"
208#if defined(__CYGWIN__)
209# error "The Cygwin compiler is not supported"
211#if defined(__BORLANDC__)
212# error "The Borland C compiler is not supported"
214#if defined(__MWERKS__)
215# error "The MetroWerks compiler is not supported"
217#if defined(__GNUC__) && !defined(__clang__) && !defined(__INTEL_COMPILER) && (__GNUC__ < 7)
218# error "GCC < 7 is not supported"
224# error "The SGI compiler is not supported"
226#if defined(__apple_build_version__) && (__apple_build_version__ < 12000032)
227# error "AppleClang < Xcode 12.4 is not supported"
228#elif defined(__clang__) && (__clang_major__ < 5)
229# error "Clang < 5 is not supported"
231#if defined(__INTEL_COMPILER) && (__INTEL_COMPILER < 1910)
232# error "Intel C++ < 19.1 is not supported4"
236#if defined(_WIN32) || defined(WIN32)
237# define ITK_ABI_IMPORT __declspec(dllimport)
238# define ITK_ABI_EXPORT __declspec(dllexport)
239# define ITK_ABI_HIDDEN
242# define ITK_ABI_IMPORT __attribute__((visibility("default")))
243# define ITK_ABI_EXPORT __attribute__((visibility("default")))
244# define ITK_ABI_HIDDEN __attribute__((visibility("hidden")))
246# define ITK_ABI_IMPORT
247# define ITK_ABI_EXPORT
248# define ITK_ABI_HIDDEN
253#ifndef ITK_TEMPLATE_EXPORT
254# ifdef ITK_TEMPLATE_VISIBILITY_DEFAULT
255# define ITK_TEMPLATE_EXPORT __attribute__((visibility("default")))
257# define ITK_TEMPLATE_EXPORT
262#ifdef ITK_TEMPLATE_VISIBILITY_DEFAULT
263# define ITK_FORCE_EXPORT_MACRO(moduleName) __attribute__((visibility("default")))
265# define ITK_FORCE_EXPORT_MACRO(moduleName) moduleName##_EXPORT
268#ifndef ITK_FORWARD_EXPORT
270# if defined(__APPLE__) && defined(ITK_TEMPLATE_VISIBILITY_DEFAULT) && defined(ITK_BUILD_SHARED_LIBS) && \
271 defined(USE_COMPILER_HIDDEN_VISIBILITY)
272# define ITK_FORWARD_EXPORT __attribute__((visibility("default")))
274# define ITK_FORWARD_EXPORT
300#define itkNewMacro(x) \
301 itkSimpleNewMacro(x); \
302 itkCreateAnotherMacro(x); \
304 ITK_MACROEND_NOOP_STATEMENT
306#define itkSimpleNewMacro(x) \
307 static Pointer New() \
309 Pointer smartPtr = ::itk::ObjectFactory<x>::Create(); \
310 if (smartPtr == nullptr) \
312 smartPtr = new x(); \
314 smartPtr->UnRegister(); \
317 ITK_MACROEND_NOOP_STATEMENT
319#define itkCreateAnotherMacro(x) \
320 ::itk::LightObject::Pointer CreateAnother() const override { return x::New().GetPointer(); } \
321 ITK_MACROEND_NOOP_STATEMENT
323#define itkCloneMacro(x) \
324 Pointer Clone() const \
326 Pointer rval = dynamic_cast<x *>(this->InternalClone().GetPointer()); \
329 ITK_MACROEND_NOOP_STATEMENT
335#define itkFactoryOnlyNewMacro(x) \
336 itkSimpleFactoryOnlyNewMacro(x); \
337 itkCreateAnotherMacro(x); \
339 ITK_MACROEND_NOOP_STATEMENT
341#define itkSimpleFactoryOnlyNewMacro(x) \
342 static auto New() -> Pointer \
344 Pointer smartPtr = ::itk::ObjectFactory<x>::Create(); \
345 if (smartPtr == nullptr) \
347 itkSpecializedMessageExceptionMacro(ExceptionObject, \
348 "Object factory failed to instantiate " << typeid(x).name()); \
350 smartPtr->UnRegister(); \
353 ITK_MACROEND_NOOP_STATEMENT
368#define itkFactorylessNewMacro(x) \
369 static Pointer New() \
371 auto * rawPtr = new x(); \
372 Pointer smartPtr = rawPtr; \
373 rawPtr->UnRegister(); \
376 itkCreateAnotherMacro(x); \
377 ITK_MACROEND_NOOP_STATEMENT
388#define ITK_DISALLOW_COPY_AND_MOVE(TypeName) \
389 TypeName(const TypeName &) = delete; \
390 TypeName & operator=(const TypeName &) = delete; \
391 TypeName(TypeName &&) = delete; \
392 TypeName & operator=(TypeName &&) = delete
394#if !defined(ITK_LEGACY_REMOVE)
395# define ITK_DISALLOW_COPY_AND_ASSIGN(TypeName) ITK_DISALLOW_COPY_AND_MOVE(TypeName)
397# define ITK_DISALLOW_COPY_AND_ASSIGN(TypeName) \
398 static_assert(false, "Replace deprecated ITK_DISALLOW_COPY_AND_ASSIGN with modern ITK_DISALLOW_COPY_AND_MOVE")
410#define ITK_DEFAULT_COPY_AND_MOVE(TypeName) \
411 TypeName(const TypeName &) = default; \
412 TypeName & operator=(const TypeName &) = default; \
413 TypeName(TypeName &&) = default; \
414 TypeName & operator=(TypeName &&) = default
421#if __cplusplus >= 202002L
422# define ITK_EXPERIMENTAL_CXX20_REWRITTEN_UNEQUAL_OPERATOR
428#ifdef ITK_EXPERIMENTAL_CXX20_REWRITTEN_UNEQUAL_OPERATOR
431# define ITK_UNEQUAL_OPERATOR_MEMBER_FUNCTION(TypeName) ITK_MACROEND_NOOP_STATEMENT
435# define ITK_UNEQUAL_OPERATOR_MEMBER_FUNCTION(TypeName) \
436 bool operator!=(const TypeName & other) const { return !(this->operator==(other)); } \
437 ITK_MACROEND_NOOP_STATEMENT
442#define itkInternalGetNameOfClassImplementationMacro(thisClass) \
444 static_assert(std::is_same_v<thisClass, std::remove_const_t<std::remove_reference_t<decltype(*this)>>>, \
445 "The macro argument `" #thisClass \
446 "` appears incorrect! It should correspond with the name of this class!"); \
449 ITK_MACROEND_NOOP_STATEMENT
455#define itkVirtualGetNameOfClassMacro(thisClass) \
456 virtual const char * GetNameOfClass() const itkInternalGetNameOfClassImplementationMacro(thisClass)
458#define itkOverrideGetNameOfClassMacro(thisClass) \
459 const char * GetNameOfClass() const override itkInternalGetNameOfClassImplementationMacro(thisClass)
461#ifdef ITK_FUTURE_LEGACY_REMOVE
462# define itkTypeMacro(thisClass, superclass) \
463 static_assert(false, \
464 "In a future revision of ITK, the macro `itkTypeMacro(thisClass, superclass)` will be removed. " \
465 "Please call `itkOverrideGetNameOfClassMacro(thisClass)` instead!")
466# define itkTypeMacroNoParent(thisClass) \
467 static_assert(false, \
468 "In a future revision of ITK, the macro `itkTypeMacroNoParent(thisClass)` will be removed. " \
469 "Please call `itkVirtualGetNameOfClassMacro(thisClass)` instead!")
475# define itkTypeMacro(thisClass, superclass) itkOverrideGetNameOfClassMacro(thisClass)
476# define itkTypeMacroNoParent(thisClass) itkVirtualGetNameOfClassMacro(thisClass)
489#ifndef ITK_FUTURE_LEGACY_REMOVE
490extern ITKCommon_EXPORT
void
491OutputWindowDisplayText(
const char *);
493extern ITKCommon_EXPORT
void
494OutputWindowDisplayErrorText(
const char *);
496extern ITKCommon_EXPORT
void
497OutputWindowDisplayWarningText(
const char *);
499extern ITKCommon_EXPORT
void
500OutputWindowDisplayGenericOutputText(
const char *);
502extern ITKCommon_EXPORT
void
503OutputWindowDisplayDebugText(
const char *);
507extern ITKCommon_EXPORT
void
508OutputWindowDisplayDebugText(
const char * file,
510 const char * className,
511 const void * objectAddress,
512 const char * message);
514extern ITKCommon_EXPORT
void
515OutputWindowDisplayWarningText(
const char * file,
517 const char * className,
518 const void * objectAddress,
519 const char * message);
521extern ITKCommon_EXPORT
void
522OutputWindowDisplayErrorText(
const char * file,
524 const char * className,
525 const void * objectAddress,
526 const char * message);
528extern ITKCommon_EXPORT
void
529OutputWindowDisplayGenericOutputText(
const char * file,
unsigned int line,
const char * message);
541# define itkDebugMacro(x) ITK_NOOP_STATEMENT
542# define itkDebugStatement(x) ITK_NOOP_STATEMENT
544# define itkDebugMacro(x) \
546 using namespace ::itk::print_helper; \
547 if (this->GetDebug() && ::itk::Object::GetGlobalWarningDisplay()) \
549 std::ostringstream itkmsg; \
551 ::itk::OutputWindowDisplayDebugText(__FILE__, __LINE__, this->GetNameOfClass(), this, itkmsg.str().c_str()); \
554 ITK_MACROEND_NOOP_STATEMENT
557# define itkDebugStatement(x) x
563#define itkWarningMacro(x) \
565 if (::itk::Object::GetGlobalWarningDisplay()) \
567 std::ostringstream itkmsg; \
569 ::itk::OutputWindowDisplayWarningText(__FILE__, __LINE__, this->GetNameOfClass(), this, itkmsg.str().c_str()); \
572 ITK_MACROEND_NOOP_STATEMENT
575#define itkWarningStatement(x) x
577#if defined(ITK_CPP_FUNCTION)
578# if defined(_WIN32) && !defined(__MINGW32__) && !defined(ITK_WRAPPING_PARSER)
579# define ITK_LOCATION __FUNCSIG__
580# elif defined(__GNUC__)
581# define ITK_LOCATION __PRETTY_FUNCTION__
583# define ITK_LOCATION __FUNCTION__
586# define ITK_LOCATION "unknown"
589#define itkDeclareExceptionMacro(newexcp, parentexcp, whatmessage) \
592 class newexcp : public parentexcp \
596 static constexpr const char * const default_exception_message = whatmessage; \
598 using parentexcp::parentexcp; \
599 itkOverrideGetNameOfClassMacro(newexcp); \
602 ITK_MACROEND_NOOP_STATEMENT
605#define itkSpecializedMessageExceptionMacro(ExceptionType, x) \
607 std::ostringstream exceptionDescriptionOutputStringStream; \
608 exceptionDescriptionOutputStringStream << "" x; \
609 throw ::itk::ExceptionType( \
610 std::string{ __FILE__ }, __LINE__, exceptionDescriptionOutputStringStream.str(), std::string{ ITK_LOCATION }); \
612 ITK_MACROEND_NOOP_STATEMENT
614#define itkSpecializedExceptionMacro(ExceptionType) \
615 throw ::itk::ExceptionType( \
616 std::string{ __FILE__ }, __LINE__, ::itk::ExceptionType::default_exception_message, std::string{ ITK_LOCATION });
622#define itkExceptionMacro(x) \
624 std::ostringstream exceptionDescriptionOutputStringStream; \
625 exceptionDescriptionOutputStringStream << "" x; \
626 throw ::itk::ExceptionObject(std::string{ __FILE__ }, \
628 exceptionDescriptionOutputStringStream.str(), \
629 std::string{ ITK_LOCATION }, \
632 ITK_MACROEND_NOOP_STATEMENT
634#define itkExceptionStringMacro(x) \
636 throw ::itk::ExceptionObject( \
637 std::string{ __FILE__ }, __LINE__, std::string{ x }, std::string{ ITK_LOCATION }, this); \
639 ITK_MACROEND_NOOP_STATEMENT
641#define itkGenericExceptionMacro(x) itkSpecializedMessageExceptionMacro(ExceptionObject, x)
643#define itkGenericOutputMacro(x) \
645 if (::itk::Object::GetGlobalWarningDisplay()) \
647 std::ostringstream itkmsg; \
649 ::itk::OutputWindowDisplayGenericOutputText(__FILE__, __LINE__, itkmsg.str().c_str()); \
652 ITK_MACROEND_NOOP_STATEMENT
657#define itkLogMacro(x, y) \
659 if (this->GetLogger()) \
661 this->GetLogger()->Write(::itk::LoggerBase::x, y); \
664 ITK_MACROEND_NOOP_STATEMENT
666#define itkLogMacroStatic(obj, x, y) \
668 if (obj->GetLogger()) \
670 obj->GetLogger()->Write(::itk::LoggerBase::x, y); \
673 ITK_MACROEND_NOOP_STATEMENT
704#if defined(ITK_LEGACY_REMOVE)
705# define itkLegacyMacro(method)
707# if defined(ITK_LEGACY_SILENT) || defined(ITK_LEGACY_TEST)
709# define itkLegacyMacro(method) method
712# define itkLegacyMacro(method) [[deprecated]] method
738#if defined(ITK_LEGACY_SILENT)
739# define itkLegacyBodyMacro(method, version) ITK_NOOP_STATEMENT
740# define itkLegacyReplaceBodyMacro(method, version, replace) ITK_NOOP_STATEMENT
741# define itkGenericLegacyBodyMacro(method, version) ITK_NOOP_STATEMENT
742# define itkGenericLegacyReplaceBodyMacro(method, version, replace) ITK_NOOP_STATEMENT
744# define itkLegacyBodyMacro(method, version) \
745 itkWarningMacro(#method " was deprecated for ITK " #version " and will be removed in a future version.")
746# define itkLegacyReplaceBodyMacro(method, version, replace) \
747 itkWarningMacro(#method " was deprecated for ITK " #version \
748 " and will be removed in a future version. Use " #replace " instead.")
749# define itkGenericLegacyBodyMacro(method, version) \
750 itkGenericOutputMacro(#method " was deprecated for ITK " #version " and will be removed in a future version.")
751# define itkGenericLegacyReplaceBodyMacro(method, version, replace) \
752 itkGenericOutputMacro(#method " was deprecated for ITK " #version \
753 " and will be removed in a future version. Use " #replace " instead.")
760constexpr size_t ITK_CACHE_LINE_ALIGNMENT{ 64 };
768#define itkPadStruct(mincachesize, oldtype, newtype) \
769 struct newtype : public oldtype \
771 char _StructPadding[mincachesize - (sizeof(oldtype) % mincachesize)]; \
778#if defined(ITK_HAS_GNU_ATTRIBUTE_ALIGNED)
779# define itkAlignedTypedef(alignment, oldtype, newtype) using newtype = oldtype __attribute__((aligned(alignment)))
780#elif defined(_MSC_VER)
781# define itkAlignedTypedef(alignment, oldtype, newtype) using newtype = __declspec(align(alignment)) oldtype
783# define itkAlignedTypedef(alignment, oldtype, newtype) using newtype = oldtype
786#if defined(ITK_FUTURE_LEGACY_REMOVE)
809# define ITK_FRIEND_TEMPLATE_FUNCTION_ARGUMENT(T) < >
811# define ITK_FRIEND_TEMPLATE_FUNCTION_ARGUMENT(T) "Macro remove use C++11 compliant declaration of "
827#define itkForLoopAssignmentMacro( \
828 DestinationType, SourceType, DestinationElementType, DestinationArray, SourceArray, NumberOfIterations) \
829 for (unsigned int i = 0; i < NumberOfIterations; ++i) \
831 DestinationArray[i] = static_cast<DestinationElementType>(SourceArray[i]); \
833 ITK_MACROEND_NOOP_STATEMENT
844#define itkForLoopRoundingAndAssignmentMacro( \
845 DestinationType, Sourcrnd_halfintup, DestinationElementType, DestinationArray, SourceArray, NumberOfIterations) \
846 for (unsigned int i = 0; i < NumberOfIterations; ++i) \
848 DestinationArray[i] = ::itk::Math::Round<DestinationElementType>(SourceArray[i]); \
850 ITK_MACROEND_NOOP_STATEMENT
854#if !defined(NDEBUG) && !defined(ITK_WRAPPING)
857# define itkAssertInDebugOrThrowInReleaseMacro(msg) __assert_fail(msg, __FILE__, __LINE__, __ASSERT_FUNCTION);
859# define itkAssertInDebugOrThrowInReleaseMacro(msg) itkGenericExceptionMacro(<< msg);
863# define itkAssertInDebugOrThrowInReleaseMacro(msg) itkGenericExceptionMacro(<< msg);
866#define itkAssertOrThrowMacro(test, message) \
869 std::ostringstream msgstr; \
871 itkAssertInDebugOrThrowInReleaseMacro(msgstr.str().c_str()); \
873 ITK_MACROEND_NOOP_STATEMENT
875#if !defined(NDEBUG) && !defined(ITK_WRAPPING)
876# define itkAssertInDebugAndIgnoreInReleaseMacro(X) assert(X)
878# define itkAssertInDebugAndIgnoreInReleaseMacro(X) ITK_NOOP_STATEMENT
888#ifdef ITK_FUTURE_LEGACY_REMOVE
889# define itkStaticConstMacro(name, type, value) \
890 "Replace itkStaticConstMacro(name, type, value) with `static constexpr type name = value`"
891# define itkGetStaticConstMacro(name) "Replace itkGetStaticConstMacro(name) with `Self::name`"
907# define itkStaticConstMacro(name, type, value) static constexpr type name = value
909# define itkGetStaticConstMacro(name) (Self::name)
913#define ITK_DETAIL_SetInputMacroImpl(virtualKeyword, finalKeyword, name, type) \
914 virtualKeyword void Set##name(const type * _arg) finalKeyword \
916 itkDebugMacro("setting input " #name " to " << _arg); \
917 if (_arg != itkDynamicCastInDebugMode<type *>(this->ProcessObject::GetInput(#name))) \
919 this->ProcessObject::SetInput(#name, const_cast<type *>(_arg)); \
923 ITK_MACROEND_NOOP_STATEMENT
927#define itkVirtualSetInputMacro(name, type) ITK_DETAIL_SetInputMacroImpl(virtual, , name, type)
928#define itkFinalSetInputMacro(name, type) ITK_DETAIL_SetInputMacroImpl(, final, name, type)
929#define itkNonVirtualSetInputMacro(name, type) ITK_DETAIL_SetInputMacroImpl(, , name, type)
930#define itkSetInputMacro(name, type) ITK_DETAIL_SetInputMacroImpl(virtual, , name, type)
934#define ITK_DETAIL_GetInputMacroImpl(virtualKeyword, finalKeyword, name, type) \
935 virtualKeyword const type * Get##name() const finalKeyword \
937 itkDebugMacro("returning input " << #name " of " << this->ProcessObject::GetInput(#name)); \
938 return itkDynamicCastInDebugMode<const type *>(this->ProcessObject::GetInput(#name)); \
940 ITK_MACROEND_NOOP_STATEMENT
944#define itkVirtualGetInputMacro(name, type) ITK_DETAIL_GetInputMacroImpl(virtual, , name, type)
945#define itkFinalGetInputMacro(name, type) ITK_DETAIL_GetInputMacroImpl(, final, name, type)
946#define itkNonVirtualGetInputMacro(name, type) ITK_DETAIL_GetInputMacroImpl(, , name, type)
947#define itkGetInputMacro(name, type) ITK_DETAIL_GetInputMacroImpl(virtual, , name, type)
952#define ITK_DETAIL_SetDecoratedInputMacroImpl(virtualKeyword, finalKeyword, name, type) \
953 virtualKeyword void Set##name##Input(const SimpleDataObjectDecorator<type> * _arg) finalKeyword \
955 itkDebugMacro("setting input " #name " to " << _arg); \
956 if (_arg != itkDynamicCastInDebugMode<SimpleDataObjectDecorator<type> *>(this->ProcessObject::GetInput(#name))) \
958 this->ProcessObject::SetInput(#name, const_cast<SimpleDataObjectDecorator<type> *>(_arg)); \
962 virtualKeyword void Set##name(const SimpleDataObjectDecorator<type> * _arg) finalKeyword \
964 this->Set##name##Input(_arg); \
966 virtualKeyword void Set##name(const type & _arg) finalKeyword \
968 using DecoratorType = SimpleDataObjectDecorator<type>; \
969 itkDebugMacro("setting input " #name " to " << _arg); \
970 const DecoratorType * oldInput = \
971 itkDynamicCastInDebugMode<const DecoratorType *>(this->ProcessObject::GetInput(#name)); \
972 ITK_GCC_PRAGMA_PUSH \
973 ITK_GCC_SUPPRESS_Wfloat_equal \
974 if (oldInput && oldInput->Get() == _arg) \
979 auto newInput = DecoratorType::New(); \
980 newInput->Set(_arg); \
981 this->Set##name##Input(newInput); \
983 ITK_MACROEND_NOOP_STATEMENT
988#define itkVirtualSetDecoratedInputMacro(name, type) ITK_DETAIL_SetDecoratedInputMacroImpl(virtual, , name, type)
989#define itkFinalSetDecoratedInputMacro(name, type) ITK_DETAIL_SetDecoratedInputMacroImpl(, final, name, type)
990#define itkNonVirtualSetDecoratedInputMacro(name, type) ITK_DETAIL_SetDecoratedInputMacroImpl(, , name, type)
991#define itkSetDecoratedInputMacro(name, type) ITK_DETAIL_SetDecoratedInputMacroImpl(virtual, , name, type)
996#define ITK_DETAIL_GetDecoratedInputMacroImpl(virtualKeyword, finalKeyword, name, type) \
997 virtualKeyword const SimpleDataObjectDecorator<type> * Get##name##Input() const finalKeyword \
999 itkDebugMacro("returning input " << #name " of " << this->ProcessObject::GetInput(#name)); \
1000 return itkDynamicCastInDebugMode<const SimpleDataObjectDecorator<type> *>(this->ProcessObject::GetInput(#name)); \
1002 virtualKeyword const type & Get##name() const finalKeyword \
1004 itkDebugMacro("Getting input " #name); \
1005 using DecoratorType = SimpleDataObjectDecorator<type>; \
1006 const DecoratorType * input = \
1007 itkDynamicCastInDebugMode<const DecoratorType *>(this->ProcessObject::GetInput(#name)); \
1008 if (input == nullptr) \
1010 itkExceptionStringMacro("input" #name " is not set"); \
1012 return input->Get(); \
1014 ITK_MACROEND_NOOP_STATEMENT
1018#define itkVirtualGetDecoratedInputMacro(name, type) ITK_DETAIL_GetDecoratedInputMacroImpl(virtual, , name, type)
1019#define itkFinalGetDecoratedInputMacro(name, type) ITK_DETAIL_GetDecoratedInputMacroImpl(, final, name, type)
1020#define itkNonVirtualGetDecoratedInputMacro(name, type) ITK_DETAIL_GetDecoratedInputMacroImpl(, , name, type)
1021#define itkGetDecoratedInputMacro(name, type) ITK_DETAIL_GetDecoratedInputMacroImpl(virtual, , name, type)
1026#define itkVirtualSetGetDecoratedInputMacro(name, type) \
1027 itkVirtualSetDecoratedInputMacro(name, type); \
1028 itkVirtualGetDecoratedInputMacro(name, type)
1029#define itkFinalSetGetDecoratedInputMacro(name, type) \
1030 itkFinalSetDecoratedInputMacro(name, type); \
1031 itkFinalGetDecoratedInputMacro(name, type)
1032#define itkNonVirtualSetGetDecoratedInputMacro(name, type) \
1033 itkNonVirtualSetDecoratedInputMacro(name, type); \
1034 itkNonVirtualGetDecoratedInputMacro(name, type)
1035#define itkSetGetDecoratedInputMacro(name, type) \
1036 itkSetDecoratedInputMacro(name, type); \
1037 itkGetDecoratedInputMacro(name, type)
1042#define ITK_DETAIL_SetDecoratedObjectInputMacroImpl(virtualKeyword, finalKeyword, name, type) \
1043 virtualKeyword void Set##name##Input(const DataObjectDecorator<type> * _arg) finalKeyword \
1045 itkDebugMacro("setting input " #name " to " << _arg); \
1046 if (_arg != itkDynamicCastInDebugMode<DataObjectDecorator<type> *>(this->ProcessObject::GetInput(#name))) \
1048 this->ProcessObject::SetInput(#name, const_cast<DataObjectDecorator<type> *>(_arg)); \
1052 virtualKeyword void Set##name(const type * _arg) finalKeyword \
1054 using DecoratorType = DataObjectDecorator<type>; \
1055 itkDebugMacro("setting input " #name " to " << _arg); \
1056 const DecoratorType * oldInput = \
1057 itkDynamicCastInDebugMode<const DecoratorType *>(this->ProcessObject::GetInput(#name)); \
1058 if (oldInput && oldInput->Get() == _arg) \
1062 auto newInput = DecoratorType::New(); \
1063 newInput->Set(_arg); \
1064 this->Set##name##Input(newInput); \
1066 ITK_MACROEND_NOOP_STATEMENT
1071#define itkVirtualSetDecoratedObjectInputMacro(name, type) \
1072 ITK_DETAIL_SetDecoratedObjectInputMacroImpl(virtual, , name, type)
1073#define itkFinalSetDecoratedObjectInputMacro(name, type) \
1074 ITK_DETAIL_SetDecoratedObjectInputMacroImpl(, final, name, type)
1075#define itkNonVirtualSetDecoratedObjectInputMacro(name, type) \
1076 ITK_DETAIL_SetDecoratedObjectInputMacroImpl(, , name, type)
1077#define itkSetDecoratedObjectInputMacro(name, type) ITK_DETAIL_SetDecoratedObjectInputMacroImpl(virtual, , name, type)
1082#define ITK_DETAIL_GetDecoratedObjectInputMacroImpl(virtualKeyword, finalKeyword, name, type) \
1083 virtualKeyword const DataObjectDecorator<type> * Get##name##Input() const finalKeyword \
1085 itkDebugMacro("returning input " << #name " of " << this->ProcessObject::GetInput(#name)); \
1086 return itkDynamicCastInDebugMode<const DataObjectDecorator<type> *>(this->ProcessObject::GetInput(#name)); \
1088 virtualKeyword const type * Get##name() const finalKeyword \
1090 itkDebugMacro("Getting input " #name); \
1091 using DecoratorType = DataObjectDecorator<type>; \
1092 const DecoratorType * input = \
1093 itkDynamicCastInDebugMode<const DecoratorType *>(this->ProcessObject::GetInput(#name)); \
1094 if (input == nullptr) \
1098 return input->Get(); \
1100 ITK_MACROEND_NOOP_STATEMENT
1105#define itkVirtualGetDecoratedObjectInputMacro(name, type) \
1106 ITK_DETAIL_GetDecoratedObjectInputMacroImpl(virtual, , name, type)
1107#define itkFinalGetDecoratedObjectInputMacro(name, type) \
1108 ITK_DETAIL_GetDecoratedObjectInputMacroImpl(, final, name, type)
1109#define itkNonVirtualGetDecoratedObjectInputMacro(name, type) \
1110 ITK_DETAIL_GetDecoratedObjectInputMacroImpl(, , name, type)
1111#define itkGetDecoratedObjectInputMacro(name, type) ITK_DETAIL_GetDecoratedObjectInputMacroImpl(virtual, , name, type)
1116#define itkVirtualSetGetDecoratedObjectInputMacro(name, type) \
1117 itkVirtualSetDecoratedObjectInputMacro(name, type); \
1118 itkVirtualGetDecoratedObjectInputMacro(name, type)
1119#define itkFinalSetGetDecoratedObjectInputMacro(name, type) \
1120 itkFinalSetDecoratedObjectInputMacro(name, type); \
1121 itkFinalGetDecoratedObjectInputMacro(name, type)
1122#define itkNonVirtualSetGetDecoratedObjectInputMacro(name, type) \
1123 itkNonVirtualSetDecoratedObjectInputMacro(name, type); \
1124 itkNonVirtualGetDecoratedObjectInputMacro(name, type)
1125#define itkSetGetDecoratedObjectInputMacro(name, type) \
1126 itkSetDecoratedObjectInputMacro(name, type); \
1127 itkGetDecoratedObjectInputMacro(name, type)
1140#define ITK_DETAIL_SetMacroImpl(virtualKeyword, finalKeyword, name, type) \
1141 virtualKeyword void Set##name(type _arg) finalKeyword \
1143 itkDebugMacro("setting " #name " to " << _arg); \
1144 ITK_GCC_PRAGMA_PUSH \
1145 ITK_GCC_SUPPRESS_Wfloat_equal \
1146 if (this->m_##name != _arg) \
1148 this->m_##name = std::move(_arg); \
1151 ITK_GCC_PRAGMA_POP \
1153 ITK_MACROEND_NOOP_STATEMENT
1157#define ITK_DETAIL_GetMacroImpl(virtualKeyword, finalKeyword, name, type) \
1158 virtualKeyword type Get##name() finalKeyword { return this->m_##name; } \
1159 ITK_MACROEND_NOOP_STATEMENT
1162#define ITK_DETAIL_GetConstMacroImpl(virtualKeyword, finalKeyword, name, type) \
1163 virtualKeyword type Get##name() const finalKeyword { return this->m_##name; } \
1164 ITK_MACROEND_NOOP_STATEMENT
1167#define ITK_DETAIL_GetConstReferenceMacroImpl(virtualKeyword, finalKeyword, name, type) \
1168 virtualKeyword const type & Get##name() const finalKeyword { return this->m_##name; } \
1169 ITK_MACROEND_NOOP_STATEMENT
1173#define itkVirtualSetMacro(name, type) ITK_DETAIL_SetMacroImpl(virtual, , name, type)
1174#define itkFinalSetMacro(name, type) ITK_DETAIL_SetMacroImpl(, final, name, type)
1175#define itkNonVirtualSetMacro(name, type) ITK_DETAIL_SetMacroImpl(, , name, type)
1176#define itkSetMacro(name, type) ITK_DETAIL_SetMacroImpl(virtual, , name, type)
1181#define itkVirtualGetMacro(name, type) ITK_DETAIL_GetMacroImpl(virtual, , name, type)
1182#define itkFinalGetMacro(name, type) ITK_DETAIL_GetMacroImpl(, final, name, type)
1183#define itkNonVirtualGetMacro(name, type) ITK_DETAIL_GetMacroImpl(, , name, type)
1184#define itkGetMacro(name, type) ITK_DETAIL_GetMacroImpl(virtual, , name, type)
1191#define itkVirtualGetConstMacro(name, type) ITK_DETAIL_GetConstMacroImpl(virtual, , name, type)
1192#define itkFinalGetConstMacro(name, type) ITK_DETAIL_GetConstMacroImpl(, final, name, type)
1193#define itkNonVirtualGetConstMacro(name, type) ITK_DETAIL_GetConstMacroImpl(, , name, type)
1194#define itkGetConstMacro(name, type) ITK_DETAIL_GetConstMacroImpl(virtual, , name, type)
1202#define itkVirtualGetConstReferenceMacro(name, type) ITK_DETAIL_GetConstReferenceMacroImpl(virtual, , name, type)
1203#define itkFinalGetConstReferenceMacro(name, type) ITK_DETAIL_GetConstReferenceMacroImpl(, final, name, type)
1204#define itkNonVirtualGetConstReferenceMacro(name, type) ITK_DETAIL_GetConstReferenceMacroImpl(, , name, type)
1205#define itkGetConstReferenceMacro(name, type) ITK_DETAIL_GetConstReferenceMacroImpl(virtual, , name, type)
1209#define ITK_DETAIL_SetEnumMacroImpl(virtualKeyword, finalKeyword, name, type) \
1210 virtualKeyword void Set##name(const type _arg) finalKeyword \
1212 itkDebugMacro("setting " #name " to " << static_cast<long>(_arg)); \
1213 if (this->m_##name != _arg) \
1215 this->m_##name = _arg; \
1219 ITK_MACROEND_NOOP_STATEMENT
1225#define itkVirtualSetEnumMacro(name, type) ITK_DETAIL_SetEnumMacroImpl(virtual, , name, type)
1226#define itkFinalSetEnumMacro(name, type) ITK_DETAIL_SetEnumMacroImpl(, final, name, type)
1227#define itkNonVirtualSetEnumMacro(name, type) ITK_DETAIL_SetEnumMacroImpl(, , name, type)
1228#define itkSetEnumMacro(name, type) ITK_DETAIL_SetEnumMacroImpl(virtual, , name, type)
1232#define ITK_DETAIL_GetEnumMacroImpl(virtualKeyword, finalKeyword, name, type) \
1233 virtualKeyword type Get##name() const finalKeyword { return this->m_##name; } \
1234 ITK_MACROEND_NOOP_STATEMENT
1239#define itkVirtualGetEnumMacro(name, type) ITK_DETAIL_GetEnumMacroImpl(virtual, , name, type)
1240#define itkFinalGetEnumMacro(name, type) ITK_DETAIL_GetEnumMacroImpl(, final, name, type)
1241#define itkNonVirtualGetEnumMacro(name, type) ITK_DETAIL_GetEnumMacroImpl(, , name, type)
1242#define itkGetEnumMacro(name, type) ITK_DETAIL_GetEnumMacroImpl(virtual, , name, type)
1247#define ITK_DETAIL_SetStringMacroImpl(virtualKeyword, finalKeyword, name) \
1248 virtualKeyword void Set##name(const char * _arg) finalKeyword \
1250 if (_arg && (_arg == this->m_##name)) \
1256 this->m_##name = _arg; \
1260 this->m_##name = ""; \
1264 virtualKeyword void Set##name(const std::string & _arg) finalKeyword { this->Set##name(_arg.c_str()); } \
1265 ITK_MACROEND_NOOP_STATEMENT
1270#define itkVirtualSetStringMacro(name) ITK_DETAIL_SetStringMacroImpl(virtual, , name)
1271#define itkFinalSetStringMacro(name) ITK_DETAIL_SetStringMacroImpl(, final, name)
1272#define itkNonVirtualSetStringMacro(name) ITK_DETAIL_SetStringMacroImpl(, , name)
1273#define itkSetStringMacro(name) ITK_DETAIL_SetStringMacroImpl(virtual, , name)
1277#define ITK_DETAIL_GetStringMacroImpl(virtualKeyword, finalKeyword, name) \
1278 virtualKeyword const char * Get##name() const finalKeyword { return this->m_##name.c_str(); } \
1279 ITK_MACROEND_NOOP_STATEMENT
1284#define itkVirtualGetStringMacro(name) ITK_DETAIL_GetStringMacroImpl(virtual, , name)
1285#define itkFinalGetStringMacro(name) ITK_DETAIL_GetStringMacroImpl(, final, name)
1286#define itkNonVirtualGetStringMacro(name) ITK_DETAIL_GetStringMacroImpl(, , name)
1287#define itkGetStringMacro(name) ITK_DETAIL_GetStringMacroImpl(virtual, , name)
1292#define ITK_DETAIL_SetClampMacroImpl(virtualKeyword, finalKeyword, name, type, min, max) \
1293 virtualKeyword void Set##name(type _arg) finalKeyword \
1295 const type temp_extrema = (_arg <= min ? min : (_arg >= max ? max : _arg)); \
1296 itkDebugMacro("setting " << #name " to " << _arg); \
1297 ITK_GCC_PRAGMA_PUSH \
1298 ITK_GCC_SUPPRESS_Wfloat_equal \
1299 if (this->m_##name != temp_extrema) \
1301 this->m_##name = temp_extrema; \
1304 ITK_GCC_PRAGMA_POP \
1306 ITK_MACROEND_NOOP_STATEMENT
1312#define itkVirtualSetClampMacro(name, type, min, max) ITK_DETAIL_SetClampMacroImpl(virtual, , name, type, min, max)
1313#define itkFinalSetClampMacro(name, type, min, max) ITK_DETAIL_SetClampMacroImpl(, final, name, type, min, max)
1314#define itkNonVirtualSetClampMacro(name, type, min, max) ITK_DETAIL_SetClampMacroImpl(, , name, type, min, max)
1315#define itkSetClampMacro(name, type, min, max) ITK_DETAIL_SetClampMacroImpl(virtual, , name, type, min, max)
1320#define ITK_DETAIL_SetObjectMacroImpl(virtualKeyword, finalKeyword, name, type) \
1321 virtualKeyword void Set##name(type * _arg) finalKeyword \
1323 itkDebugMacro("setting " << #name " to " << _arg); \
1324 if (this->m_##name != _arg) \
1326 this->m_##name = _arg; \
1330 ITK_MACROEND_NOOP_STATEMENT
1335#define itkVirtualSetObjectMacro(name, type) ITK_DETAIL_SetObjectMacroImpl(virtual, , name, type)
1336#define itkFinalSetObjectMacro(name, type) ITK_DETAIL_SetObjectMacroImpl(, final, name, type)
1337#define itkNonVirtualSetObjectMacro(name, type) ITK_DETAIL_SetObjectMacroImpl(, , name, type)
1338#define itkSetObjectMacro(name, type) ITK_DETAIL_SetObjectMacroImpl(virtual, , name, type)
1356#define ITK_DETAIL_GetConstObjectMacroImpl(virtualKeyword, finalKeyword, name, type) \
1357 virtualKeyword const type * Get##name() const finalKeyword { return this->m_##name.GetPointer(); } \
1358 ITK_MACROEND_NOOP_STATEMENT
1363#define itkVirtualGetConstObjectMacro(name, type) ITK_DETAIL_GetConstObjectMacroImpl(virtual, , name, type)
1364#define itkFinalGetConstObjectMacro(name, type) ITK_DETAIL_GetConstObjectMacroImpl(, final, name, type)
1365#define itkNonVirtualGetConstObjectMacro(name, type) ITK_DETAIL_GetConstObjectMacroImpl(, , name, type)
1366#define itkGetConstObjectMacro(name, type) ITK_DETAIL_GetConstObjectMacroImpl(virtual, , name, type)
1371#if defined(ITK_FUTURE_LEGACY_REMOVE)
1378# define ITK_DETAIL_GetObjectMacroImpl(virtualKeyword, finalKeyword, name, type) \
1379 virtualKeyword type * Get##name() finalKeyword \
1381 purposeful_error("itkGetObjectMacro should be replaced with itkGetModifiableObjectMacro."); \
1383 ITK_MACROEND_NOOP_STATEMENT
1386# define ITK_DETAIL_GetModifiableObjectMacroImpl(virtualKeyword, finalKeyword, name, type) \
1387 virtualKeyword type * GetModifiable##name() finalKeyword { return this->m_##name.GetPointer(); } \
1388 ITK_DETAIL_GetConstObjectMacroImpl(virtualKeyword, finalKeyword, name, type)
1392# define ITK_DETAIL_GetObjectMacroImpl(virtualKeyword, finalKeyword, name, type) \
1393 virtualKeyword type * Get##name() finalKeyword { return this->m_##name.GetPointer(); } \
1394 ITK_MACROEND_NOOP_STATEMENT
1397# define ITK_DETAIL_GetModifiableObjectMacroImpl(virtualKeyword, finalKeyword, name, type) \
1398 virtualKeyword type * GetModifiable##name() finalKeyword { return this->m_##name.GetPointer(); } \
1399 ITK_DETAIL_GetConstObjectMacroImpl(virtualKeyword, finalKeyword, name, type); \
1400 ITK_DETAIL_GetObjectMacroImpl(virtualKeyword, finalKeyword, name, type)
1408#define itkVirtualGetObjectMacro(name, type) ITK_DETAIL_GetObjectMacroImpl(virtual, , name, type)
1409#define itkFinalGetObjectMacro(name, type) ITK_DETAIL_GetObjectMacroImpl(, final, name, type)
1410#define itkNonVirtualGetObjectMacro(name, type) ITK_DETAIL_GetObjectMacroImpl(, , name, type)
1411#define itkGetObjectMacro(name, type) ITK_DETAIL_GetObjectMacroImpl(virtual, , name, type)
1413#define itkVirtualGetModifiableObjectMacro(name, type) ITK_DETAIL_GetModifiableObjectMacroImpl(virtual, , name, type)
1414#define itkFinalGetModifiableObjectMacro(name, type) ITK_DETAIL_GetModifiableObjectMacroImpl(, final, name, type)
1415#define itkNonVirtualGetModifiableObjectMacro(name, type) ITK_DETAIL_GetModifiableObjectMacroImpl(, , name, type)
1416#define itkGetModifiableObjectMacro(name, type) ITK_DETAIL_GetModifiableObjectMacroImpl(virtual, , name, type)
1425#define ITK_DETAIL_GetConstReferenceObjectMacroImpl(virtualKeyword, finalKeyword, name, type) \
1426 virtualKeyword const typename type::Pointer & Get##name() const finalKeyword { return this->m_##name; } \
1427 ITK_MACROEND_NOOP_STATEMENT
1432#define itkVirtualGetConstReferenceObjectMacro(name, type) \
1433 ITK_DETAIL_GetConstReferenceObjectMacroImpl(virtual, , name, type)
1434#define itkFinalGetConstReferenceObjectMacro(name, type) \
1435 ITK_DETAIL_GetConstReferenceObjectMacroImpl(, final, name, type)
1436#define itkNonVirtualGetConstReferenceObjectMacro(name, type) \
1437 ITK_DETAIL_GetConstReferenceObjectMacroImpl(, , name, type)
1438#define itkGetConstReferenceObjectMacro(name, type) ITK_DETAIL_GetConstReferenceObjectMacroImpl(virtual, , name, type)
1443#define ITK_DETAIL_SetConstObjectMacroImpl(virtualKeyword, finalKeyword, name, type) \
1444 virtualKeyword void Set##name(const type * _arg) finalKeyword \
1446 itkDebugMacro("setting " << #name " to " << _arg); \
1447 if (this->m_##name != _arg) \
1449 this->m_##name = _arg; \
1453 ITK_MACROEND_NOOP_STATEMENT
1458#define itkVirtualSetConstObjectMacro(name, type) ITK_DETAIL_SetConstObjectMacroImpl(virtual, , name, type)
1459#define itkFinalSetConstObjectMacro(name, type) ITK_DETAIL_SetConstObjectMacroImpl(, final, name, type)
1460#define itkNonVirtualSetConstObjectMacro(name, type) ITK_DETAIL_SetConstObjectMacroImpl(, , name, type)
1461#define itkSetConstObjectMacro(name, type) ITK_DETAIL_SetConstObjectMacroImpl(virtual, , name, type)
1464#define ITK_DETAIL_BooleanMacroImpl(virtualKeyword, finalKeyword, name) \
1465 virtualKeyword void name##On() finalKeyword { this->Set##name(true); } \
1466 virtualKeyword void name##Off() finalKeyword { this->Set##name(false); } \
1467 ITK_MACROEND_NOOP_STATEMENT
1472#define itkVirtualBooleanMacro(name) ITK_DETAIL_BooleanMacroImpl(virtual, , name)
1473#define itkFinalBooleanMacro(name) ITK_DETAIL_BooleanMacroImpl(, final, name)
1474#define itkNonVirtualBooleanMacro(name) ITK_DETAIL_BooleanMacroImpl(, , name)
1475#define itkBooleanMacro(name) ITK_DETAIL_BooleanMacroImpl(virtual, , name)
1486template <
typename MemberContainerType,
typename CopyFromValueType,
typename LoopEndType>
1488ContainerFillWithCheck(MemberContainerType & m,
const CopyFromValueType & c,
const LoopEndType N)
1490 bool value_updated =
false;
1491 for (
unsigned int i = 0; i < N; ++i)
1494 ITK_GCC_SUPPRESS_Wfloat_equal
1498 value_updated =
true;
1502 return value_updated;
1513template <
typename MemberContainerType,
typename CopyFromContainerType,
typename LoopEndType>
1515ContainerCopyWithCheck(MemberContainerType & m,
const CopyFromContainerType & c,
const LoopEndType N)
1517 bool value_updated =
false;
1518 for (LoopEndType i = 0; i < N; ++i)
1521 ITK_GCC_SUPPRESS_Wfloat_equal
1525 value_updated =
true;
1529 return value_updated;
1534#define ITK_DETAIL_SetVectorMacroImpl(virtualKeyword, finalKeyword, name, type, count) \
1535 virtualKeyword void Set##name(type data[]) finalKeyword \
1537 if (ContainerCopyWithCheck(this->m_##name, data, count)) \
1542 ITK_MACROEND_NOOP_STATEMENT
1549#define itkVirtualSetVectorMacro(name, type, count) ITK_DETAIL_SetVectorMacroImpl(virtual, , name, type, count)
1550#define itkFinalSetVectorMacro(name, type, count) ITK_DETAIL_SetVectorMacroImpl(, final, name, type, count)
1551#define itkNonVirtualSetVectorMacro(name, type, count) ITK_DETAIL_SetVectorMacroImpl(, , name, type, count)
1552#define itkSetVectorMacro(name, type, count) ITK_DETAIL_SetVectorMacroImpl(virtual, , name, type, count)
1557#define ITK_DETAIL_GetVectorMacroImpl(virtualKeyword, finalKeyword, name, type, count) \
1558 virtualKeyword type * Get##name() const finalKeyword { return this->m_##name; } \
1559 ITK_MACROEND_NOOP_STATEMENT
1563#define itkVirtualGetVectorMacro(name, type, count) ITK_DETAIL_GetVectorMacroImpl(virtual, , name, type, count)
1564#define itkFinalGetVectorMacro(name, type, count) ITK_DETAIL_GetVectorMacroImpl(, final, name, type, count)
1565#define itkNonVirtualGetVectorMacro(name, type, count) ITK_DETAIL_GetVectorMacroImpl(, , name, type, count)
1566#define itkGetVectorMacro(name, type, count) ITK_DETAIL_GetVectorMacroImpl(virtual, , name, type, count)
1573#define itkGPUKernelClassMacro(kernel) class itkGPUKernelMacro(kernel)
1581#define itkGPUKernelMacro(kernel) \
1585 ITK_DISALLOW_COPY_AND_MOVE(kernel); \
1586 kernel() = delete; \
1587 ~kernel() = delete; \
1588 static const char * GetOpenCLSource(); \
1591#define itkGetOpenCLSourceFromKernelMacro(kernel) \
1592 static const char * GetOpenCLSource() { return kernel::GetOpenCLSource(); } \
1593 ITK_MACROEND_NOOP_STATEMENT
1597#define itkPrintSelfObjectMacro(name) \
1598 if (static_cast<const LightObject *>(this->m_##name) == nullptr) \
1600 os << indent << #name << ": (null)" << std::endl; \
1604 os << indent << #name << ": " << std::endl; \
1605 this->m_##name->Print(os, indent.GetNextIndent()); \
1607 ITK_MACROEND_NOOP_STATEMENT
1612#define itkPrintSelfBooleanMacro(name) \
1613 os << indent << #name << ": " << (this->m_##name ? "On" : "Off") << std::endl; \
1614 ITK_MACROEND_NOOP_STATEMENT
1619#define ITK_DETAIL_SetDecoratedOutputMacroImpl(virtualKeyword, finalKeyword, name, type) \
1620 virtualKeyword void Set##name##Output(const SimpleDataObjectDecorator<type> * _arg) finalKeyword \
1622 itkDebugMacro("setting output " #name " to " << _arg); \
1623 if (_arg != itkDynamicCastInDebugMode<SimpleDataObjectDecorator<type> *>(this->ProcessObject::GetOutput(#name))) \
1625 this->ProcessObject::SetOutput(#name, const_cast<SimpleDataObjectDecorator<type> *>(_arg)); \
1629 virtualKeyword void Set##name(const type & _arg) finalKeyword \
1631 using DecoratorType = SimpleDataObjectDecorator<type>; \
1632 itkDebugMacro("setting output " #name " to " << _arg); \
1633 DecoratorType * output = itkDynamicCastInDebugMode<DecoratorType *>(this->ProcessObject::GetOutput(#name)); \
1636 if (output->Get() == _arg) \
1642 output->Set(_arg); \
1647 auto newOutput = DecoratorType::New(); \
1648 newOutput->Set(_arg); \
1649 this->Set##name##Output(newOutput); \
1652 ITK_MACROEND_NOOP_STATEMENT
1656#define itkVirtualSetDecoratedOutputMacro(name, type) ITK_DETAIL_SetDecoratedOutputMacroImpl(virtual, , name, type)
1657#define itkFinalSetDecoratedOutputMacro(name, type) ITK_DETAIL_SetDecoratedOutputMacroImpl(, final, name, type)
1658#define itkNonVirtualSetDecoratedOutputMacro(name, type) ITK_DETAIL_SetDecoratedOutputMacroImpl(, , name, type)
1659#define itkSetDecoratedOutputMacro(name, type) ITK_DETAIL_SetDecoratedOutputMacroImpl(virtual, , name, type)
1664#define ITK_DETAIL_GetDecoratedOutputMacroImpl(virtualKeyword, finalKeyword, name, type) \
1665 virtualKeyword const SimpleDataObjectDecorator<type> * Get##name##Output() const finalKeyword \
1667 itkDebugMacro("returning output " << #name " of " << this->ProcessObject::GetOutput(#name)); \
1668 return itkDynamicCastInDebugMode<const SimpleDataObjectDecorator<type> *>(this->ProcessObject::GetOutput(#name)); \
1670 virtualKeyword const type & Get##name() const finalKeyword \
1672 itkDebugMacro("Getting output " #name); \
1673 using DecoratorType = SimpleDataObjectDecorator<type>; \
1674 const DecoratorType * output = \
1675 itkDynamicCastInDebugMode<const DecoratorType *>(this->ProcessObject::GetOutput(#name)); \
1676 if (output == nullptr) \
1678 itkExceptionStringMacro("output" #name " is not set"); \
1680 return output->Get(); \
1682 ITK_MACROEND_NOOP_STATEMENT
1686#define itkVirtualGetDecoratedOutputMacro(name, type) ITK_DETAIL_GetDecoratedOutputMacroImpl(virtual, , name, type)
1687#define itkFinalGetDecoratedOutputMacro(name, type) ITK_DETAIL_GetDecoratedOutputMacroImpl(, final, name, type)
1688#define itkNonVirtualGetDecoratedOutputMacro(name, type) ITK_DETAIL_GetDecoratedOutputMacroImpl(, , name, type)
1689#define itkGetDecoratedOutputMacro(name, type) ITK_DETAIL_GetDecoratedOutputMacroImpl(virtual, , name, type)
1693#if defined(ITK_LEGACY_REMOVE) && !defined(ITK_LEGACY_SILENT)
1694# define ITK_FUTURE_DEPRECATED(message) [[deprecated(message)]]
1696# define ITK_FUTURE_DEPRECATED(message)
1699#if __cplusplus >= 202002L
1700# define ITK_NODISCARD(message) [[nodiscard(message)]]
1702# define ITK_NODISCARD(message) [[nodiscard]]
1707#if defined(ITK_LEGACY_REMOVE)
1708# define itkExposeEnumValue(name) \
1709 static_assert(false, "ERROR: Replace static_cast<int>(name) with with proper enumeration instead of integer")
1711# define ITK_NOEXCEPT_OR_THROW static_assert(false, "Replace ITK_NOEXCEPT_OR_THROW with ITK_NOEXCEPT")
1713# define ITK_DELETE_FUNCTION static_assert(false, "ERROR: ITK_DELETE_FUNCTION must be replaced with `= delete`"
1714# define ITK_CONSTEXPR_FUNC static_assert(false, "ERROR: ITK_CONSTEXPR_FUNC must be replaced with 'constexpr'")
1715# define ITK_CONSTEXPR_VAR static_assert(false, "ERROR: ITK_CONSTEXPR_VAR must be replaced with 'constexpr'")
1717# define ITK_FALLTHROUGH static_assert(false, "ERROR: ITK_FALLTHROUGH must be replaced with '[[fallthrough]]'")
1720# define ITK_ALIGNAS static_assert(false, "ERROR: ITK_ALIGNAS must be replaced with 'alignas'")
1721# define ITK_ALIGNOF static_assert(false, "ERROR: ITK_ALIGNOF must be replaced with 'alignof'")
1722# define ITK_DEPRECATED static_assert(false, "ERROR: ITK_DEPRECATED must be replaced with '[[deprecated]]'")
1723# define ITK_DEPRECATED_MSG \
1724 static_assert(false, "ERROR: ITK_DEPRECATED_MSG must be replaced with '[[deprecated(MSG)]]'")
1725# define ITK_CONSTEXPR static_assert(false, "ERROR: ITK_CONSTEXPR must be replaced with 'constexpr'")
1726# define ITK_DELETED_FUNCTION static_assert(false, "ERROR: ITK_DELETED_FUNCTION must be replaced with '= delete'")
1727# define ITK_EXTERN_TEMPLATE static_assert(false, "ERROR: ITK_EXTERN_TEMPLATE must be replaced with 'extern'")
1728# define ITK_FINAL static_assert(false, "ERROR: ITK_FINAL must be replaced with 'final'")
1729# define ITK_NOEXCEPT static_assert(false, "ERROR: ITK_NOEXCEPT must be replaced with 'noexcept'")
1730# define ITK_NOEXCEPT_EXPR static_assert(false, "ERROR: ITK_NOEXCEPT_EXPR must be replaced with 'noexcept'")
1731# define ITK_NULLPTR static_assert(false, "ERROR: ITK_NULLPTR must be replaced with 'nullptr'")
1732# define ITK_OVERRIDE static_assert(false, "ERROR: ITK_OVERRIDE must be replaced with 'override'")
1733# define ITK_STATIC_ASSERT static_assert(false, "ERROR: ITK_STATIC_ASSERT must be replaced with 'static_assert'")
1734# define ITK_STATIC_ASSERT_MSG \
1735 static_assert(false, "ERROR: ITK_STATIC_ASSERT_MSG must be replaced with 'static_assert'")
1736# define ITK_THREAD_LOCAL static_assert(false, "ERROR: ITK_THREAD_LOCAL must be replaced with 'thread_local'")
1739# define ITKv5_CONST static_assert(false, "ERROR: ITKv5_CONST must be replaced with 'const'")
1741# define ITK_ITERATOR_VIRTUAL static_assert(false, "ERROR: ITK_ITERATOR_VIRTUAL must be removed'")
1742# define ITK_ITERATOR_OVERRIDE static_assert(false, "ERROR: ITK_ITERATOR_OVERRIDE must be removed")
1743# define ITK_ITERATOR_FINAL static_assert(false, "ERROR: ITK_ITERATOR_FINAL must be removed")
1752# define itkExposeEnumValue(name) static_cast<int>(name)
1755# define ITK_NOEXCEPT_OR_THROW ITK_NOEXCEPT
1757# define ITK_FALLTHROUGH [[fallthrough]]
1759# define ITK_DELETE_FUNCTION = delete
1761# define ITK_CONSTEXPR_FUNC constexpr
1762# define ITK_CONSTEXPR_VAR constexpr
1765# define ITK_ALIGNAS(X) alignas(X)
1766# define ITK_ALIGNOF(X) alignof(X)
1767# define ITK_DEPRECATED [[deprecated]]
1768# define ITK_DEPRECATED_MSG(MSG) [[deprecated(MSG)]]
1769# define ITK_CONSTEXPR constexpr
1770# define ITK_DELETED_FUNCTION = delete
1771# define ITK_EXTERN_TEMPLATE extern
1772# define ITK_FINAL final
1773# define ITK_NOEXCEPT noexcept
1774# define ITK_NOEXCEPT_EXPR(X) noexcept(X)
1775# define ITK_NULLPTR nullptr
1776# define ITK_OVERRIDE override
1777# define ITK_STATIC_ASSERT(X) static_assert(X, #X)
1778# define ITK_STATIC_ASSERT_MSG(X, MSG) static_assert(X, MSG)
1779# define ITK_THREAD_LOCAL thread_local
1782# define ITKv5_CONST const
1784# define ITK_ITERATOR_VIRTUAL
1785# define ITK_ITERATOR_OVERRIDE
1786# define ITK_ITERATOR_FINAL
1789#define allow_inclusion_of_itkExceptionObject_h
1795#undef allow_inclusion_of_itkExceptionObject_h
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....