42#include "itkConfigure.h"
43#include "ITKCommonExport.h"
57#define ITK_STRINGIFY_HELPER(x) #x
58#define ITK_STRINGIFY(x) ITK_STRINGIFY_HELPER(x)
84#define ITK_NOOP_STATEMENT static_assert(true, "")
95#define ITK_MACROEND_NOOP_STATEMENT ITK_NOOP_STATEMENT
102#define ITK_PRAGMA(x) _Pragma(#x)
110# define ITK_GCC_PRAGMA_PUSH ITK_PRAGMA(GCC diagnostic push)
111# define ITK_GCC_PRAGMA_POP ITK_PRAGMA(GCC diagnostic pop)
112# define ITK_GCC_SUPPRESS_Wfloat_equal ITK_PRAGMA(GCC diagnostic ignored "-Wfloat-equal")
113# define ITK_GCC_SUPPRESS_Wformat_nonliteral ITK_PRAGMA(GCC diagnostic ignored "-Wformat-nonliteral")
114# define ITK_GCC_SUPPRESS_Warray_bounds ITK_PRAGMA(GCC diagnostic ignored "-Warray-bounds")
116# define ITK_GCC_PRAGMA_PUSH
117# define ITK_GCC_PRAGMA_POP
118# define ITK_GCC_SUPPRESS_Wfloat_equal
119# define ITK_GCC_SUPPRESS_Wformat_nonliteral
120# define ITK_GCC_SUPPRESS_Warray_bounds
125#if defined(__GNUC__) && !defined(__clang__)
126# define ITK_GCC_SUPPRESS_Wmaybe_uninitialized ITK_PRAGMA(GCC diagnostic ignored "-Wmaybe-uninitialized")
128# define ITK_GCC_SUPPRESS_Wmaybe_uninitialized
132#if defined(__clang__) && defined(__has_warning)
133# define ITK_CLANG_PRAGMA_PUSH ITK_PRAGMA(clang diagnostic push)
134# define ITK_CLANG_PRAGMA_POP ITK_PRAGMA(clang diagnostic pop)
135# if __has_warning("-Wzero-as-null-pointer-constant")
136# define ITK_CLANG_SUPPRESS_Wzero_as_null_pointer_constant \
137 ITK_PRAGMA(clang diagnostic ignored "-Wzero-as-null-pointer-constant")
139# define ITK_CLANG_SUPPRESS_Wzero_as_null_pointer_constant
141# if __has_warning("-Wduplicate-enum")
142# define ITK_CLANG_SUPPRESS_Wduplicate_enum ITK_PRAGMA(clang diagnostic ignored "-Wduplicate-enum")
144# define ITK_CLANG_SUPPRESS_Wduplicate_enum
147# define ITK_CLANG_PRAGMA_PUSH
148# define ITK_CLANG_PRAGMA_POP
149# define ITK_CLANG_SUPPRESS_Wzero_as_null_pointer_constant
150# define ITK_CLANG_SUPPRESS_Wduplicate_enum
155#define CLANG_PRAGMA_PUSH ITK_CLANG_PRAGMA_PUSH
156#define CLANG_PRAGMA_POP ITK_CLANG_PRAGMA_POP
157#define CLANG_SUPPRESS_Wfloat_equal ITK_GCC_SUPPRESS_Wfloat_equal
161# define ITK_FORMAT_PRINTF(a, b) __attribute__((format(printf, a, b)))
163# define ITK_FORMAT_PRINTF(a, b)
166#if !defined(ITK_LEGACY_REMOVE)
168# define CLANG_SUPPRESS_Wcpp14_extensions \
169 [[deprecated("Remove deprecated CLANG_SUPPRESS_Wcpp14_extensions c++14 warning suppression")]] void * \
170 CLANG_SUPPRESS_Wcpp14_extensions = nullptr;
182# define ITK_GCC_PRAGMA_DIAG(x) ITK_PRAGMA(GCC diagnostic x)
183# define ITK_GCC_PRAGMA_DIAG_PUSH() ITK_GCC_PRAGMA_DIAG(push)
184# define ITK_GCC_PRAGMA_DIAG_POP() ITK_GCC_PRAGMA_DIAG(pop)
186# define ITK_GCC_PRAGMA_DIAG(x)
187# define ITK_GCC_PRAGMA_DIAG_PUSH()
188# define ITK_GCC_PRAGMA_DIAG_POP()
195#if defined(_MSC_VER) && (_MSC_VER < 1920)
196# error "MSVC versions before Visual Studio 2019 are not supported"
198#if defined(__SUNPRO_CC) && (__SUNPRO_CC < 0x5140)
199# error "SUNPro C++ < 5.14.0 is not supported"
201#if defined(__CYGWIN__)
202# error "The Cygwin compiler is not supported"
204#if defined(__BORLANDC__)
205# error "The Borland C compiler is not supported"
207#if defined(__MWERKS__)
208# error "The MetroWerks compiler is not supported"
210#if defined(__GNUC__) && !defined(__clang__) && (__GNUC__ < 7)
211# error "GCC < 7 is not supported"
217# error "The SGI compiler is not supported"
219#if defined(__apple_build_version__) && (__apple_build_version__ < 12000032)
220# error "AppleClang < Xcode 12.4 is not supported"
221#elif defined(__clang__) && (__clang_major__ < 5)
222# error "Clang < 5 is not supported"
226#if defined(_WIN32) || defined(WIN32)
227# define ITK_ABI_IMPORT __declspec(dllimport)
228# define ITK_ABI_EXPORT __declspec(dllexport)
229# define ITK_ABI_HIDDEN
232# define ITK_ABI_IMPORT __attribute__((visibility("default")))
233# define ITK_ABI_EXPORT __attribute__((visibility("default")))
234# define ITK_ABI_HIDDEN __attribute__((visibility("hidden")))
236# define ITK_ABI_IMPORT
237# define ITK_ABI_EXPORT
238# define ITK_ABI_HIDDEN
243#ifndef ITK_TEMPLATE_EXPORT
244# ifdef ITK_TEMPLATE_VISIBILITY_DEFAULT
245# define ITK_TEMPLATE_EXPORT __attribute__((visibility("default")))
247# define ITK_TEMPLATE_EXPORT
252#ifdef ITK_TEMPLATE_VISIBILITY_DEFAULT
253# define ITK_FORCE_EXPORT_MACRO(moduleName) __attribute__((visibility("default")))
255# define ITK_FORCE_EXPORT_MACRO(moduleName) moduleName##_EXPORT
258#ifndef ITK_FORWARD_EXPORT
260# if defined(__APPLE__) && defined(ITK_TEMPLATE_VISIBILITY_DEFAULT) && defined(ITK_BUILD_SHARED_LIBS) && \
261 defined(USE_COMPILER_HIDDEN_VISIBILITY)
262# define ITK_FORWARD_EXPORT __attribute__((visibility("default")))
264# define ITK_FORWARD_EXPORT
290#define itkNewMacro(x) \
291 itkSimpleNewMacro(x); \
292 itkCreateAnotherMacro(x); \
294 ITK_MACROEND_NOOP_STATEMENT
296#define itkSimpleNewMacro(x) \
297 static Pointer New() \
299 Pointer smartPtr = ::itk::ObjectFactory<x>::Create(); \
300 if (smartPtr == nullptr) \
302 smartPtr = new x(); \
304 smartPtr->UnRegister(); \
307 ITK_MACROEND_NOOP_STATEMENT
309#define itkCreateAnotherMacro(x) \
310 ::itk::LightObject::Pointer CreateAnother() const override { return x::New().GetPointer(); } \
311 ITK_MACROEND_NOOP_STATEMENT
313#define itkCloneMacro(x) \
314 Pointer Clone() const \
316 Pointer rval = dynamic_cast<x *>(this->InternalClone().GetPointer()); \
319 ITK_MACROEND_NOOP_STATEMENT
325#define itkFactoryOnlyNewMacro(x) \
326 itkSimpleFactoryOnlyNewMacro(x); \
327 itkCreateAnotherMacro(x); \
329 ITK_MACROEND_NOOP_STATEMENT
331#define itkSimpleFactoryOnlyNewMacro(x) \
332 static auto New() -> Pointer \
334 Pointer smartPtr = ::itk::ObjectFactory<x>::Create(); \
335 if (smartPtr == nullptr) \
337 itkSpecializedMessageExceptionMacro(ExceptionObject, \
338 "Object factory failed to instantiate " << typeid(x).name()); \
340 smartPtr->UnRegister(); \
343 ITK_MACROEND_NOOP_STATEMENT
358#define itkFactorylessNewMacro(x) \
359 static Pointer New() \
361 auto * rawPtr = new x(); \
362 Pointer smartPtr = rawPtr; \
363 rawPtr->UnRegister(); \
366 itkCreateAnotherMacro(x); \
367 ITK_MACROEND_NOOP_STATEMENT
378#define ITK_DISALLOW_COPY_AND_MOVE(TypeName) \
379 TypeName(const TypeName &) = delete; \
380 TypeName & operator=(const TypeName &) = delete; \
381 TypeName(TypeName &&) = delete; \
382 TypeName & operator=(TypeName &&) = delete
384#if !defined(ITK_LEGACY_REMOVE)
385# define ITK_DISALLOW_COPY_AND_ASSIGN(TypeName) ITK_DISALLOW_COPY_AND_MOVE(TypeName)
387# define ITK_DISALLOW_COPY_AND_ASSIGN(TypeName) \
388 static_assert(false, "Replace deprecated ITK_DISALLOW_COPY_AND_ASSIGN with modern ITK_DISALLOW_COPY_AND_MOVE")
400#define ITK_DEFAULT_COPY_AND_MOVE(TypeName) \
401 TypeName(const TypeName &) = default; \
402 TypeName & operator=(const TypeName &) = default; \
403 TypeName(TypeName &&) = default; \
404 TypeName & operator=(TypeName &&) = default
411#if __cplusplus >= 202002L
412# define ITK_EXPERIMENTAL_CXX20_REWRITTEN_UNEQUAL_OPERATOR
418#ifdef ITK_EXPERIMENTAL_CXX20_REWRITTEN_UNEQUAL_OPERATOR
421# define ITK_UNEQUAL_OPERATOR_MEMBER_FUNCTION(TypeName) ITK_MACROEND_NOOP_STATEMENT
425# define ITK_UNEQUAL_OPERATOR_MEMBER_FUNCTION(TypeName) \
426 bool operator!=(const TypeName & other) const { return !(this->operator==(other)); } \
427 ITK_MACROEND_NOOP_STATEMENT
432#define itkInternalGetNameOfClassImplementationMacro(thisClass) \
434 static_assert(std::is_same_v<thisClass, std::remove_const_t<std::remove_reference_t<decltype(*this)>>>, \
435 "The macro argument `" #thisClass \
436 "` appears incorrect! It should correspond with the name of this class!"); \
439 ITK_MACROEND_NOOP_STATEMENT
445#define itkVirtualGetNameOfClassMacro(thisClass) \
446 virtual const char * GetNameOfClass() const itkInternalGetNameOfClassImplementationMacro(thisClass)
448#define itkOverrideGetNameOfClassMacro(thisClass) \
449 const char * GetNameOfClass() const override itkInternalGetNameOfClassImplementationMacro(thisClass)
451#ifdef ITK_FUTURE_LEGACY_REMOVE
452# define itkTypeMacro(thisClass, superclass) \
453 static_assert(false, \
454 "In a future revision of ITK, the macro `itkTypeMacro(thisClass, superclass)` will be removed. " \
455 "Please call `itkOverrideGetNameOfClassMacro(thisClass)` instead!")
456# define itkTypeMacroNoParent(thisClass) \
457 static_assert(false, \
458 "In a future revision of ITK, the macro `itkTypeMacroNoParent(thisClass)` will be removed. " \
459 "Please call `itkVirtualGetNameOfClassMacro(thisClass)` instead!")
465# define itkTypeMacro(thisClass, superclass) itkOverrideGetNameOfClassMacro(thisClass)
466# define itkTypeMacroNoParent(thisClass) itkVirtualGetNameOfClassMacro(thisClass)
479#ifndef ITK_FUTURE_LEGACY_REMOVE
480extern ITKCommon_EXPORT
void
481OutputWindowDisplayText(
const char *);
483extern ITKCommon_EXPORT
void
484OutputWindowDisplayErrorText(
const char *);
486extern ITKCommon_EXPORT
void
487OutputWindowDisplayWarningText(
const char *);
489extern ITKCommon_EXPORT
void
490OutputWindowDisplayGenericOutputText(
const char *);
492extern ITKCommon_EXPORT
void
493OutputWindowDisplayDebugText(
const char *);
497extern ITKCommon_EXPORT
void
498OutputWindowDisplayDebugText(
const char * file,
500 const char * className,
501 const void * objectAddress,
502 const char * message);
504extern ITKCommon_EXPORT
void
505OutputWindowDisplayWarningText(
const char * file,
507 const char * className,
508 const void * objectAddress,
509 const char * message);
511extern ITKCommon_EXPORT
void
512OutputWindowDisplayErrorText(
const char * file,
514 const char * className,
515 const void * objectAddress,
516 const char * message);
518extern ITKCommon_EXPORT
void
519OutputWindowDisplayGenericOutputText(
const char * file,
unsigned int line,
const char * message);
531# define itkDebugMacro(x) ITK_NOOP_STATEMENT
532# define itkDebugStatement(x) ITK_NOOP_STATEMENT
534# define itkDebugMacro(x) \
536 using namespace ::itk::print_helper; \
537 if (this->GetDebug() && ::itk::Object::GetGlobalWarningDisplay()) \
539 std::ostringstream itkmsg; \
541 ::itk::OutputWindowDisplayDebugText(__FILE__, __LINE__, this->GetNameOfClass(), this, itkmsg.str().c_str()); \
544 ITK_MACROEND_NOOP_STATEMENT
547# define itkDebugStatement(x) x
553#define itkWarningMacro(x) \
555 if (::itk::Object::GetGlobalWarningDisplay()) \
557 std::ostringstream itkmsg; \
559 ::itk::OutputWindowDisplayWarningText(__FILE__, __LINE__, this->GetNameOfClass(), this, itkmsg.str().c_str()); \
562 ITK_MACROEND_NOOP_STATEMENT
565#define itkWarningStatement(x) x
567#if defined(ITK_CPP_FUNCTION)
568# if defined(_WIN32) && !defined(__MINGW32__) && !defined(ITK_WRAPPING_PARSER)
569# define ITK_LOCATION __FUNCSIG__
570# elif defined(__GNUC__)
571# define ITK_LOCATION __PRETTY_FUNCTION__
573# define ITK_LOCATION __FUNCTION__
576# define ITK_LOCATION "unknown"
579#define itkDeclareExceptionMacro(newexcp, parentexcp, whatmessage) \
582 class newexcp : public parentexcp \
586 static constexpr const char * const default_exception_message = whatmessage; \
588 using parentexcp::parentexcp; \
589 itkOverrideGetNameOfClassMacro(newexcp); \
592 ITK_MACROEND_NOOP_STATEMENT
595#define itkSpecializedMessageExceptionMacro(ExceptionType, x) \
597 std::ostringstream exceptionDescriptionOutputStringStream; \
598 exceptionDescriptionOutputStringStream << "" x; \
599 throw ::itk::ExceptionType( \
600 std::string{ __FILE__ }, __LINE__, exceptionDescriptionOutputStringStream.str(), std::string{ ITK_LOCATION }); \
602 ITK_MACROEND_NOOP_STATEMENT
604#define itkSpecializedExceptionMacro(ExceptionType) \
605 throw ::itk::ExceptionType( \
606 std::string{ __FILE__ }, __LINE__, ::itk::ExceptionType::default_exception_message, std::string{ ITK_LOCATION });
612#define itkExceptionMacro(x) \
614 std::ostringstream exceptionDescriptionOutputStringStream; \
615 exceptionDescriptionOutputStringStream << "" x; \
616 throw ::itk::ExceptionObject(std::string{ __FILE__ }, \
618 exceptionDescriptionOutputStringStream.str(), \
619 std::string{ ITK_LOCATION }, \
622 ITK_MACROEND_NOOP_STATEMENT
624#define itkExceptionStringMacro(x) \
626 throw ::itk::ExceptionObject( \
627 std::string{ __FILE__ }, __LINE__, std::string{ x }, std::string{ ITK_LOCATION }, this); \
629 ITK_MACROEND_NOOP_STATEMENT
631#define itkGenericExceptionMacro(x) itkSpecializedMessageExceptionMacro(ExceptionObject, x)
633#define itkGenericOutputMacro(x) \
635 if (::itk::Object::GetGlobalWarningDisplay()) \
637 std::ostringstream itkmsg; \
639 ::itk::OutputWindowDisplayGenericOutputText(__FILE__, __LINE__, itkmsg.str().c_str()); \
642 ITK_MACROEND_NOOP_STATEMENT
647#define itkLogMacro(x, y) \
649 if (this->GetLogger()) \
651 this->GetLogger()->Write(::itk::LoggerBase::x, y); \
654 ITK_MACROEND_NOOP_STATEMENT
656#define itkLogMacroStatic(obj, x, y) \
658 if (obj->GetLogger()) \
660 obj->GetLogger()->Write(::itk::LoggerBase::x, y); \
663 ITK_MACROEND_NOOP_STATEMENT
694#if defined(ITK_LEGACY_REMOVE)
695# define itkLegacyMacro(method)
697# if defined(ITK_LEGACY_SILENT) || defined(ITK_LEGACY_TEST)
699# define itkLegacyMacro(method) method
702# define itkLegacyMacro(method) [[deprecated]] method
728#if defined(ITK_LEGACY_SILENT)
729# define itkLegacyBodyMacro(method, version) ITK_NOOP_STATEMENT
730# define itkLegacyReplaceBodyMacro(method, version, replace) ITK_NOOP_STATEMENT
731# define itkGenericLegacyBodyMacro(method, version) ITK_NOOP_STATEMENT
732# define itkGenericLegacyReplaceBodyMacro(method, version, replace) ITK_NOOP_STATEMENT
734# define itkLegacyBodyMacro(method, version) \
735 itkWarningMacro(#method " was deprecated for ITK " #version " and will be removed in a future version.")
736# define itkLegacyReplaceBodyMacro(method, version, replace) \
737 itkWarningMacro(#method " was deprecated for ITK " #version \
738 " and will be removed in a future version. Use " #replace " instead.")
739# define itkGenericLegacyBodyMacro(method, version) \
740 itkGenericOutputMacro(#method " was deprecated for ITK " #version " and will be removed in a future version.")
741# define itkGenericLegacyReplaceBodyMacro(method, version, replace) \
742 itkGenericOutputMacro(#method " was deprecated for ITK " #version \
743 " and will be removed in a future version. Use " #replace " instead.")
750constexpr size_t ITK_CACHE_LINE_ALIGNMENT{ 64 };
758#define itkPadStruct(mincachesize, oldtype, newtype) \
759 struct newtype : public oldtype \
761 char _StructPadding[mincachesize - (sizeof(oldtype) % mincachesize)]; \
768#if defined(ITK_HAS_GNU_ATTRIBUTE_ALIGNED)
769# define itkAlignedTypedef(alignment, oldtype, newtype) using newtype = oldtype __attribute__((aligned(alignment)))
770#elif defined(_MSC_VER)
771# define itkAlignedTypedef(alignment, oldtype, newtype) using newtype = __declspec(align(alignment)) oldtype
773# define itkAlignedTypedef(alignment, oldtype, newtype) using newtype = oldtype
776#if defined(ITK_FUTURE_LEGACY_REMOVE)
799# define ITK_FRIEND_TEMPLATE_FUNCTION_ARGUMENT(T) < >
801# define ITK_FRIEND_TEMPLATE_FUNCTION_ARGUMENT(T) "Macro remove use C++11 compliant declaration of "
817#define itkForLoopAssignmentMacro( \
818 DestinationType, SourceType, DestinationElementType, DestinationArray, SourceArray, NumberOfIterations) \
819 for (unsigned int i = 0; i < NumberOfIterations; ++i) \
821 DestinationArray[i] = static_cast<DestinationElementType>(SourceArray[i]); \
823 ITK_MACROEND_NOOP_STATEMENT
834#define itkForLoopRoundingAndAssignmentMacro( \
835 DestinationType, Sourcrnd_halfintup, DestinationElementType, DestinationArray, SourceArray, NumberOfIterations) \
836 for (unsigned int i = 0; i < NumberOfIterations; ++i) \
838 DestinationArray[i] = ::itk::Math::Round<DestinationElementType>(SourceArray[i]); \
840 ITK_MACROEND_NOOP_STATEMENT
844#if !defined(NDEBUG) && !defined(ITK_WRAPPING)
847# define itkAssertInDebugOrThrowInReleaseMacro(msg) __assert_fail(msg, __FILE__, __LINE__, __ASSERT_FUNCTION);
849# define itkAssertInDebugOrThrowInReleaseMacro(msg) itkGenericExceptionMacro(<< msg);
853# define itkAssertInDebugOrThrowInReleaseMacro(msg) itkGenericExceptionMacro(<< msg);
856#define itkAssertOrThrowMacro(test, message) \
859 std::ostringstream msgstr; \
861 itkAssertInDebugOrThrowInReleaseMacro(msgstr.str().c_str()); \
863 ITK_MACROEND_NOOP_STATEMENT
865#if !defined(NDEBUG) && !defined(ITK_WRAPPING)
866# define itkAssertInDebugAndIgnoreInReleaseMacro(X) assert(X)
868# define itkAssertInDebugAndIgnoreInReleaseMacro(X) ITK_NOOP_STATEMENT
878#ifdef ITK_FUTURE_LEGACY_REMOVE
879# define itkStaticConstMacro(name, type, value) \
880 "Replace itkStaticConstMacro(name, type, value) with `static constexpr type name = value`"
881# define itkGetStaticConstMacro(name) "Replace itkGetStaticConstMacro(name) with `Self::name`"
897# define itkStaticConstMacro(name, type, value) static constexpr type name = value
899# define itkGetStaticConstMacro(name) (Self::name)
903#define ITK_DETAIL_SetInputMacroImpl(virtualKeyword, finalKeyword, name, type) \
904 virtualKeyword void Set##name(const type * _arg) finalKeyword \
906 itkDebugMacro("setting input " #name " to " << _arg); \
907 if (_arg != itkDynamicCastInDebugMode<type *>(this->ProcessObject::GetInput(#name))) \
909 this->ProcessObject::SetInput(#name, const_cast<type *>(_arg)); \
913 ITK_MACROEND_NOOP_STATEMENT
917#define itkVirtualSetInputMacro(name, type) ITK_DETAIL_SetInputMacroImpl(virtual, , name, type)
918#define itkFinalSetInputMacro(name, type) ITK_DETAIL_SetInputMacroImpl(, final, name, type)
919#define itkNonVirtualSetInputMacro(name, type) ITK_DETAIL_SetInputMacroImpl(, , name, type)
920#define itkSetInputMacro(name, type) ITK_DETAIL_SetInputMacroImpl(virtual, , name, type)
924#define ITK_DETAIL_GetInputMacroImpl(virtualKeyword, finalKeyword, name, type) \
925 virtualKeyword const type * Get##name() const finalKeyword \
927 itkDebugMacro("returning input " << #name " of " << this->ProcessObject::GetInput(#name)); \
928 return itkDynamicCastInDebugMode<const type *>(this->ProcessObject::GetInput(#name)); \
930 ITK_MACROEND_NOOP_STATEMENT
934#define itkVirtualGetInputMacro(name, type) ITK_DETAIL_GetInputMacroImpl(virtual, , name, type)
935#define itkFinalGetInputMacro(name, type) ITK_DETAIL_GetInputMacroImpl(, final, name, type)
936#define itkNonVirtualGetInputMacro(name, type) ITK_DETAIL_GetInputMacroImpl(, , name, type)
937#define itkGetInputMacro(name, type) ITK_DETAIL_GetInputMacroImpl(virtual, , name, type)
942#define ITK_DETAIL_SetDecoratedInputMacroImpl(virtualKeyword, finalKeyword, name, type) \
943 virtualKeyword void Set##name##Input(const SimpleDataObjectDecorator<type> * _arg) finalKeyword \
945 itkDebugMacro("setting input " #name " to " << _arg); \
946 if (_arg != itkDynamicCastInDebugMode<SimpleDataObjectDecorator<type> *>(this->ProcessObject::GetInput(#name))) \
948 this->ProcessObject::SetInput(#name, const_cast<SimpleDataObjectDecorator<type> *>(_arg)); \
952 virtualKeyword void Set##name(const SimpleDataObjectDecorator<type> * _arg) finalKeyword \
954 this->Set##name##Input(_arg); \
956 virtualKeyword void Set##name(const type & _arg) finalKeyword \
958 using DecoratorType = SimpleDataObjectDecorator<type>; \
959 itkDebugMacro("setting input " #name " to " << _arg); \
960 const DecoratorType * oldInput = \
961 itkDynamicCastInDebugMode<const DecoratorType *>(this->ProcessObject::GetInput(#name)); \
962 ITK_GCC_PRAGMA_PUSH \
963 ITK_GCC_SUPPRESS_Wfloat_equal \
964 if (oldInput && oldInput->Get() == _arg) \
969 auto newInput = DecoratorType::New(); \
970 newInput->Set(_arg); \
971 this->Set##name##Input(newInput); \
973 ITK_MACROEND_NOOP_STATEMENT
978#define itkVirtualSetDecoratedInputMacro(name, type) ITK_DETAIL_SetDecoratedInputMacroImpl(virtual, , name, type)
979#define itkFinalSetDecoratedInputMacro(name, type) ITK_DETAIL_SetDecoratedInputMacroImpl(, final, name, type)
980#define itkNonVirtualSetDecoratedInputMacro(name, type) ITK_DETAIL_SetDecoratedInputMacroImpl(, , name, type)
981#define itkSetDecoratedInputMacro(name, type) ITK_DETAIL_SetDecoratedInputMacroImpl(virtual, , name, type)
986#define ITK_DETAIL_GetDecoratedInputMacroImpl(virtualKeyword, finalKeyword, name, type) \
987 virtualKeyword const SimpleDataObjectDecorator<type> * Get##name##Input() const finalKeyword \
989 itkDebugMacro("returning input " << #name " of " << this->ProcessObject::GetInput(#name)); \
990 return itkDynamicCastInDebugMode<const SimpleDataObjectDecorator<type> *>(this->ProcessObject::GetInput(#name)); \
992 virtualKeyword const type & Get##name() const finalKeyword \
994 itkDebugMacro("Getting input " #name); \
995 using DecoratorType = SimpleDataObjectDecorator<type>; \
996 const DecoratorType * input = \
997 itkDynamicCastInDebugMode<const DecoratorType *>(this->ProcessObject::GetInput(#name)); \
998 if (input == nullptr) \
1000 itkExceptionStringMacro("input" #name " is not set"); \
1002 return input->Get(); \
1004 ITK_MACROEND_NOOP_STATEMENT
1008#define itkVirtualGetDecoratedInputMacro(name, type) ITK_DETAIL_GetDecoratedInputMacroImpl(virtual, , name, type)
1009#define itkFinalGetDecoratedInputMacro(name, type) ITK_DETAIL_GetDecoratedInputMacroImpl(, final, name, type)
1010#define itkNonVirtualGetDecoratedInputMacro(name, type) ITK_DETAIL_GetDecoratedInputMacroImpl(, , name, type)
1011#define itkGetDecoratedInputMacro(name, type) ITK_DETAIL_GetDecoratedInputMacroImpl(virtual, , name, type)
1016#define itkVirtualSetGetDecoratedInputMacro(name, type) \
1017 itkVirtualSetDecoratedInputMacro(name, type); \
1018 itkVirtualGetDecoratedInputMacro(name, type)
1019#define itkFinalSetGetDecoratedInputMacro(name, type) \
1020 itkFinalSetDecoratedInputMacro(name, type); \
1021 itkFinalGetDecoratedInputMacro(name, type)
1022#define itkNonVirtualSetGetDecoratedInputMacro(name, type) \
1023 itkNonVirtualSetDecoratedInputMacro(name, type); \
1024 itkNonVirtualGetDecoratedInputMacro(name, type)
1025#define itkSetGetDecoratedInputMacro(name, type) \
1026 itkSetDecoratedInputMacro(name, type); \
1027 itkGetDecoratedInputMacro(name, type)
1032#define ITK_DETAIL_SetDecoratedObjectInputMacroImpl(virtualKeyword, finalKeyword, name, type) \
1033 virtualKeyword void Set##name##Input(const DataObjectDecorator<type> * _arg) finalKeyword \
1035 itkDebugMacro("setting input " #name " to " << _arg); \
1036 if (_arg != itkDynamicCastInDebugMode<DataObjectDecorator<type> *>(this->ProcessObject::GetInput(#name))) \
1038 this->ProcessObject::SetInput(#name, const_cast<DataObjectDecorator<type> *>(_arg)); \
1042 virtualKeyword void Set##name(const type * _arg) finalKeyword \
1044 using DecoratorType = DataObjectDecorator<type>; \
1045 itkDebugMacro("setting input " #name " to " << _arg); \
1046 const DecoratorType * oldInput = \
1047 itkDynamicCastInDebugMode<const DecoratorType *>(this->ProcessObject::GetInput(#name)); \
1048 if (oldInput && oldInput->Get() == _arg) \
1052 auto newInput = DecoratorType::New(); \
1053 newInput->Set(_arg); \
1054 this->Set##name##Input(newInput); \
1056 ITK_MACROEND_NOOP_STATEMENT
1061#define itkVirtualSetDecoratedObjectInputMacro(name, type) \
1062 ITK_DETAIL_SetDecoratedObjectInputMacroImpl(virtual, , name, type)
1063#define itkFinalSetDecoratedObjectInputMacro(name, type) \
1064 ITK_DETAIL_SetDecoratedObjectInputMacroImpl(, final, name, type)
1065#define itkNonVirtualSetDecoratedObjectInputMacro(name, type) \
1066 ITK_DETAIL_SetDecoratedObjectInputMacroImpl(, , name, type)
1067#define itkSetDecoratedObjectInputMacro(name, type) ITK_DETAIL_SetDecoratedObjectInputMacroImpl(virtual, , name, type)
1072#define ITK_DETAIL_GetDecoratedObjectInputMacroImpl(virtualKeyword, finalKeyword, name, type) \
1073 virtualKeyword const DataObjectDecorator<type> * Get##name##Input() const finalKeyword \
1075 itkDebugMacro("returning input " << #name " of " << this->ProcessObject::GetInput(#name)); \
1076 return itkDynamicCastInDebugMode<const DataObjectDecorator<type> *>(this->ProcessObject::GetInput(#name)); \
1078 virtualKeyword const type * Get##name() const finalKeyword \
1080 itkDebugMacro("Getting input " #name); \
1081 using DecoratorType = DataObjectDecorator<type>; \
1082 const DecoratorType * input = \
1083 itkDynamicCastInDebugMode<const DecoratorType *>(this->ProcessObject::GetInput(#name)); \
1084 if (input == nullptr) \
1088 return input->Get(); \
1090 ITK_MACROEND_NOOP_STATEMENT
1095#define itkVirtualGetDecoratedObjectInputMacro(name, type) \
1096 ITK_DETAIL_GetDecoratedObjectInputMacroImpl(virtual, , name, type)
1097#define itkFinalGetDecoratedObjectInputMacro(name, type) \
1098 ITK_DETAIL_GetDecoratedObjectInputMacroImpl(, final, name, type)
1099#define itkNonVirtualGetDecoratedObjectInputMacro(name, type) \
1100 ITK_DETAIL_GetDecoratedObjectInputMacroImpl(, , name, type)
1101#define itkGetDecoratedObjectInputMacro(name, type) ITK_DETAIL_GetDecoratedObjectInputMacroImpl(virtual, , name, type)
1106#define itkVirtualSetGetDecoratedObjectInputMacro(name, type) \
1107 itkVirtualSetDecoratedObjectInputMacro(name, type); \
1108 itkVirtualGetDecoratedObjectInputMacro(name, type)
1109#define itkFinalSetGetDecoratedObjectInputMacro(name, type) \
1110 itkFinalSetDecoratedObjectInputMacro(name, type); \
1111 itkFinalGetDecoratedObjectInputMacro(name, type)
1112#define itkNonVirtualSetGetDecoratedObjectInputMacro(name, type) \
1113 itkNonVirtualSetDecoratedObjectInputMacro(name, type); \
1114 itkNonVirtualGetDecoratedObjectInputMacro(name, type)
1115#define itkSetGetDecoratedObjectInputMacro(name, type) \
1116 itkSetDecoratedObjectInputMacro(name, type); \
1117 itkGetDecoratedObjectInputMacro(name, type)
1130#define ITK_DETAIL_SetMacroImpl(virtualKeyword, finalKeyword, name, type) \
1131 virtualKeyword void Set##name(type _arg) finalKeyword \
1133 itkDebugMacro("setting " #name " to " << _arg); \
1134 ITK_GCC_PRAGMA_PUSH \
1135 ITK_GCC_SUPPRESS_Wfloat_equal \
1136 if (this->m_##name != _arg) \
1138 this->m_##name = std::move(_arg); \
1141 ITK_GCC_PRAGMA_POP \
1143 ITK_MACROEND_NOOP_STATEMENT
1147#define ITK_DETAIL_GetMacroImpl(virtualKeyword, finalKeyword, name, type) \
1148 virtualKeyword type Get##name() finalKeyword { return this->m_##name; } \
1149 ITK_MACROEND_NOOP_STATEMENT
1152#define ITK_DETAIL_GetConstMacroImpl(virtualKeyword, finalKeyword, name, type) \
1153 virtualKeyword type Get##name() const finalKeyword { return this->m_##name; } \
1154 ITK_MACROEND_NOOP_STATEMENT
1157#define ITK_DETAIL_GetConstReferenceMacroImpl(virtualKeyword, finalKeyword, name, type) \
1158 virtualKeyword const type & Get##name() const finalKeyword { return this->m_##name; } \
1159 ITK_MACROEND_NOOP_STATEMENT
1163#define itkVirtualSetMacro(name, type) ITK_DETAIL_SetMacroImpl(virtual, , name, type)
1164#define itkFinalSetMacro(name, type) ITK_DETAIL_SetMacroImpl(, final, name, type)
1165#define itkNonVirtualSetMacro(name, type) ITK_DETAIL_SetMacroImpl(, , name, type)
1166#define itkSetMacro(name, type) ITK_DETAIL_SetMacroImpl(virtual, , name, type)
1171#define itkVirtualGetMacro(name, type) ITK_DETAIL_GetMacroImpl(virtual, , name, type)
1172#define itkFinalGetMacro(name, type) ITK_DETAIL_GetMacroImpl(, final, name, type)
1173#define itkNonVirtualGetMacro(name, type) ITK_DETAIL_GetMacroImpl(, , name, type)
1174#define itkGetMacro(name, type) ITK_DETAIL_GetMacroImpl(virtual, , name, type)
1181#define itkVirtualGetConstMacro(name, type) ITK_DETAIL_GetConstMacroImpl(virtual, , name, type)
1182#define itkFinalGetConstMacro(name, type) ITK_DETAIL_GetConstMacroImpl(, final, name, type)
1183#define itkNonVirtualGetConstMacro(name, type) ITK_DETAIL_GetConstMacroImpl(, , name, type)
1184#define itkGetConstMacro(name, type) ITK_DETAIL_GetConstMacroImpl(virtual, , name, type)
1192#define itkVirtualGetConstReferenceMacro(name, type) ITK_DETAIL_GetConstReferenceMacroImpl(virtual, , name, type)
1193#define itkFinalGetConstReferenceMacro(name, type) ITK_DETAIL_GetConstReferenceMacroImpl(, final, name, type)
1194#define itkNonVirtualGetConstReferenceMacro(name, type) ITK_DETAIL_GetConstReferenceMacroImpl(, , name, type)
1195#define itkGetConstReferenceMacro(name, type) ITK_DETAIL_GetConstReferenceMacroImpl(virtual, , name, type)
1199#define ITK_DETAIL_SetEnumMacroImpl(virtualKeyword, finalKeyword, name, type) \
1200 virtualKeyword void Set##name(const type _arg) finalKeyword \
1202 itkDebugMacro("setting " #name " to " << static_cast<long>(_arg)); \
1203 if (this->m_##name != _arg) \
1205 this->m_##name = _arg; \
1209 ITK_MACROEND_NOOP_STATEMENT
1215#define itkVirtualSetEnumMacro(name, type) ITK_DETAIL_SetEnumMacroImpl(virtual, , name, type)
1216#define itkFinalSetEnumMacro(name, type) ITK_DETAIL_SetEnumMacroImpl(, final, name, type)
1217#define itkNonVirtualSetEnumMacro(name, type) ITK_DETAIL_SetEnumMacroImpl(, , name, type)
1218#define itkSetEnumMacro(name, type) ITK_DETAIL_SetEnumMacroImpl(virtual, , name, type)
1222#define ITK_DETAIL_GetEnumMacroImpl(virtualKeyword, finalKeyword, name, type) \
1223 virtualKeyword type Get##name() const finalKeyword { return this->m_##name; } \
1224 ITK_MACROEND_NOOP_STATEMENT
1229#define itkVirtualGetEnumMacro(name, type) ITK_DETAIL_GetEnumMacroImpl(virtual, , name, type)
1230#define itkFinalGetEnumMacro(name, type) ITK_DETAIL_GetEnumMacroImpl(, final, name, type)
1231#define itkNonVirtualGetEnumMacro(name, type) ITK_DETAIL_GetEnumMacroImpl(, , name, type)
1232#define itkGetEnumMacro(name, type) ITK_DETAIL_GetEnumMacroImpl(virtual, , name, type)
1237#define ITK_DETAIL_SetStringMacroImpl(virtualKeyword, finalKeyword, name) \
1238 virtualKeyword void Set##name(const char * _arg) finalKeyword \
1240 if (_arg && (_arg == this->m_##name)) \
1246 this->m_##name = _arg; \
1250 this->m_##name = ""; \
1254 virtualKeyword void Set##name(const std::string & _arg) finalKeyword { this->Set##name(_arg.c_str()); } \
1255 ITK_MACROEND_NOOP_STATEMENT
1260#define itkVirtualSetStringMacro(name) ITK_DETAIL_SetStringMacroImpl(virtual, , name)
1261#define itkFinalSetStringMacro(name) ITK_DETAIL_SetStringMacroImpl(, final, name)
1262#define itkNonVirtualSetStringMacro(name) ITK_DETAIL_SetStringMacroImpl(, , name)
1263#define itkSetStringMacro(name) ITK_DETAIL_SetStringMacroImpl(virtual, , name)
1267#define ITK_DETAIL_GetStringMacroImpl(virtualKeyword, finalKeyword, name) \
1268 virtualKeyword const char * Get##name() const finalKeyword { return this->m_##name.c_str(); } \
1269 ITK_MACROEND_NOOP_STATEMENT
1274#define itkVirtualGetStringMacro(name) ITK_DETAIL_GetStringMacroImpl(virtual, , name)
1275#define itkFinalGetStringMacro(name) ITK_DETAIL_GetStringMacroImpl(, final, name)
1276#define itkNonVirtualGetStringMacro(name) ITK_DETAIL_GetStringMacroImpl(, , name)
1277#define itkGetStringMacro(name) ITK_DETAIL_GetStringMacroImpl(virtual, , name)
1282#define ITK_DETAIL_SetClampMacroImpl(virtualKeyword, finalKeyword, name, type, min, max) \
1283 virtualKeyword void Set##name(type _arg) finalKeyword \
1285 const type temp_extrema = (_arg <= min ? min : (_arg >= max ? max : _arg)); \
1286 itkDebugMacro("setting " << #name " to " << _arg); \
1287 ITK_GCC_PRAGMA_PUSH \
1288 ITK_GCC_SUPPRESS_Wfloat_equal \
1289 if (this->m_##name != temp_extrema) \
1291 this->m_##name = temp_extrema; \
1294 ITK_GCC_PRAGMA_POP \
1296 ITK_MACROEND_NOOP_STATEMENT
1302#define itkVirtualSetClampMacro(name, type, min, max) ITK_DETAIL_SetClampMacroImpl(virtual, , name, type, min, max)
1303#define itkFinalSetClampMacro(name, type, min, max) ITK_DETAIL_SetClampMacroImpl(, final, name, type, min, max)
1304#define itkNonVirtualSetClampMacro(name, type, min, max) ITK_DETAIL_SetClampMacroImpl(, , name, type, min, max)
1305#define itkSetClampMacro(name, type, min, max) ITK_DETAIL_SetClampMacroImpl(virtual, , name, type, min, max)
1310#define ITK_DETAIL_SetObjectMacroImpl(virtualKeyword, finalKeyword, name, type) \
1311 virtualKeyword void Set##name(type * _arg) finalKeyword \
1313 itkDebugMacro("setting " << #name " to " << _arg); \
1314 if (this->m_##name != _arg) \
1316 this->m_##name = _arg; \
1320 ITK_MACROEND_NOOP_STATEMENT
1325#define itkVirtualSetObjectMacro(name, type) ITK_DETAIL_SetObjectMacroImpl(virtual, , name, type)
1326#define itkFinalSetObjectMacro(name, type) ITK_DETAIL_SetObjectMacroImpl(, final, name, type)
1327#define itkNonVirtualSetObjectMacro(name, type) ITK_DETAIL_SetObjectMacroImpl(, , name, type)
1328#define itkSetObjectMacro(name, type) ITK_DETAIL_SetObjectMacroImpl(virtual, , name, type)
1346#define ITK_DETAIL_GetConstObjectMacroImpl(virtualKeyword, finalKeyword, name, type) \
1347 virtualKeyword const type * Get##name() const finalKeyword { return this->m_##name.GetPointer(); } \
1348 ITK_MACROEND_NOOP_STATEMENT
1353#define itkVirtualGetConstObjectMacro(name, type) ITK_DETAIL_GetConstObjectMacroImpl(virtual, , name, type)
1354#define itkFinalGetConstObjectMacro(name, type) ITK_DETAIL_GetConstObjectMacroImpl(, final, name, type)
1355#define itkNonVirtualGetConstObjectMacro(name, type) ITK_DETAIL_GetConstObjectMacroImpl(, , name, type)
1356#define itkGetConstObjectMacro(name, type) ITK_DETAIL_GetConstObjectMacroImpl(virtual, , name, type)
1361#if defined(ITK_FUTURE_LEGACY_REMOVE)
1368# define ITK_DETAIL_GetObjectMacroImpl(virtualKeyword, finalKeyword, name, type) \
1369 virtualKeyword type * Get##name() finalKeyword \
1371 purposeful_error("itkGetObjectMacro should be replaced with itkGetModifiableObjectMacro."); \
1373 ITK_MACROEND_NOOP_STATEMENT
1376# define ITK_DETAIL_GetModifiableObjectMacroImpl(virtualKeyword, finalKeyword, name, type) \
1377 virtualKeyword type * GetModifiable##name() finalKeyword { return this->m_##name.GetPointer(); } \
1378 ITK_DETAIL_GetConstObjectMacroImpl(virtualKeyword, finalKeyword, name, type)
1382# define ITK_DETAIL_GetObjectMacroImpl(virtualKeyword, finalKeyword, name, type) \
1383 virtualKeyword type * Get##name() finalKeyword { return this->m_##name.GetPointer(); } \
1384 ITK_MACROEND_NOOP_STATEMENT
1387# define ITK_DETAIL_GetModifiableObjectMacroImpl(virtualKeyword, finalKeyword, name, type) \
1388 virtualKeyword type * GetModifiable##name() finalKeyword { return this->m_##name.GetPointer(); } \
1389 ITK_DETAIL_GetConstObjectMacroImpl(virtualKeyword, finalKeyword, name, type); \
1390 ITK_DETAIL_GetObjectMacroImpl(virtualKeyword, finalKeyword, name, type)
1398#define itkVirtualGetObjectMacro(name, type) ITK_DETAIL_GetObjectMacroImpl(virtual, , name, type)
1399#define itkFinalGetObjectMacro(name, type) ITK_DETAIL_GetObjectMacroImpl(, final, name, type)
1400#define itkNonVirtualGetObjectMacro(name, type) ITK_DETAIL_GetObjectMacroImpl(, , name, type)
1401#define itkGetObjectMacro(name, type) ITK_DETAIL_GetObjectMacroImpl(virtual, , name, type)
1403#define itkVirtualGetModifiableObjectMacro(name, type) ITK_DETAIL_GetModifiableObjectMacroImpl(virtual, , name, type)
1404#define itkFinalGetModifiableObjectMacro(name, type) ITK_DETAIL_GetModifiableObjectMacroImpl(, final, name, type)
1405#define itkNonVirtualGetModifiableObjectMacro(name, type) ITK_DETAIL_GetModifiableObjectMacroImpl(, , name, type)
1406#define itkGetModifiableObjectMacro(name, type) ITK_DETAIL_GetModifiableObjectMacroImpl(virtual, , name, type)
1415#define ITK_DETAIL_GetConstReferenceObjectMacroImpl(virtualKeyword, finalKeyword, name, type) \
1416 virtualKeyword const typename type::Pointer & Get##name() const finalKeyword { return this->m_##name; } \
1417 ITK_MACROEND_NOOP_STATEMENT
1422#define itkVirtualGetConstReferenceObjectMacro(name, type) \
1423 ITK_DETAIL_GetConstReferenceObjectMacroImpl(virtual, , name, type)
1424#define itkFinalGetConstReferenceObjectMacro(name, type) \
1425 ITK_DETAIL_GetConstReferenceObjectMacroImpl(, final, name, type)
1426#define itkNonVirtualGetConstReferenceObjectMacro(name, type) \
1427 ITK_DETAIL_GetConstReferenceObjectMacroImpl(, , name, type)
1428#define itkGetConstReferenceObjectMacro(name, type) ITK_DETAIL_GetConstReferenceObjectMacroImpl(virtual, , name, type)
1433#define ITK_DETAIL_SetConstObjectMacroImpl(virtualKeyword, finalKeyword, name, type) \
1434 virtualKeyword void Set##name(const type * _arg) finalKeyword \
1436 itkDebugMacro("setting " << #name " to " << _arg); \
1437 if (this->m_##name != _arg) \
1439 this->m_##name = _arg; \
1443 ITK_MACROEND_NOOP_STATEMENT
1448#define itkVirtualSetConstObjectMacro(name, type) ITK_DETAIL_SetConstObjectMacroImpl(virtual, , name, type)
1449#define itkFinalSetConstObjectMacro(name, type) ITK_DETAIL_SetConstObjectMacroImpl(, final, name, type)
1450#define itkNonVirtualSetConstObjectMacro(name, type) ITK_DETAIL_SetConstObjectMacroImpl(, , name, type)
1451#define itkSetConstObjectMacro(name, type) ITK_DETAIL_SetConstObjectMacroImpl(virtual, , name, type)
1454#define ITK_DETAIL_BooleanMacroImpl(virtualKeyword, finalKeyword, name) \
1455 virtualKeyword void name##On() finalKeyword { this->Set##name(true); } \
1456 virtualKeyword void name##Off() finalKeyword { this->Set##name(false); } \
1457 ITK_MACROEND_NOOP_STATEMENT
1462#define itkVirtualBooleanMacro(name) ITK_DETAIL_BooleanMacroImpl(virtual, , name)
1463#define itkFinalBooleanMacro(name) ITK_DETAIL_BooleanMacroImpl(, final, name)
1464#define itkNonVirtualBooleanMacro(name) ITK_DETAIL_BooleanMacroImpl(, , name)
1465#define itkBooleanMacro(name) ITK_DETAIL_BooleanMacroImpl(virtual, , name)
1476template <
typename MemberContainerType,
typename CopyFromValueType,
typename LoopEndType>
1478ContainerFillWithCheck(MemberContainerType & m,
const CopyFromValueType & c,
const LoopEndType N)
1480 bool value_updated =
false;
1481 for (
unsigned int i = 0; i < N; ++i)
1484 ITK_GCC_SUPPRESS_Wfloat_equal
1488 value_updated =
true;
1492 return value_updated;
1503template <
typename MemberContainerType,
typename CopyFromContainerType,
typename LoopEndType>
1505ContainerCopyWithCheck(MemberContainerType & m,
const CopyFromContainerType & c,
const LoopEndType N)
1507 bool value_updated =
false;
1508 for (LoopEndType i = 0; i < N; ++i)
1511 ITK_GCC_SUPPRESS_Wfloat_equal
1515 value_updated =
true;
1519 return value_updated;
1524#define ITK_DETAIL_SetVectorMacroImpl(virtualKeyword, finalKeyword, name, type, count) \
1525 virtualKeyword void Set##name(type data[]) finalKeyword \
1527 if (ContainerCopyWithCheck(this->m_##name, data, count)) \
1532 ITK_MACROEND_NOOP_STATEMENT
1539#define itkVirtualSetVectorMacro(name, type, count) ITK_DETAIL_SetVectorMacroImpl(virtual, , name, type, count)
1540#define itkFinalSetVectorMacro(name, type, count) ITK_DETAIL_SetVectorMacroImpl(, final, name, type, count)
1541#define itkNonVirtualSetVectorMacro(name, type, count) ITK_DETAIL_SetVectorMacroImpl(, , name, type, count)
1542#define itkSetVectorMacro(name, type, count) ITK_DETAIL_SetVectorMacroImpl(virtual, , name, type, count)
1547#define ITK_DETAIL_GetVectorMacroImpl(virtualKeyword, finalKeyword, name, type, count) \
1548 virtualKeyword type * Get##name() const finalKeyword { return this->m_##name; } \
1549 ITK_MACROEND_NOOP_STATEMENT
1553#define itkVirtualGetVectorMacro(name, type, count) ITK_DETAIL_GetVectorMacroImpl(virtual, , name, type, count)
1554#define itkFinalGetVectorMacro(name, type, count) ITK_DETAIL_GetVectorMacroImpl(, final, name, type, count)
1555#define itkNonVirtualGetVectorMacro(name, type, count) ITK_DETAIL_GetVectorMacroImpl(, , name, type, count)
1556#define itkGetVectorMacro(name, type, count) ITK_DETAIL_GetVectorMacroImpl(virtual, , name, type, count)
1563#define itkGPUKernelClassMacro(kernel) class itkGPUKernelMacro(kernel)
1571#define itkGPUKernelMacro(kernel) \
1575 ITK_DISALLOW_COPY_AND_MOVE(kernel); \
1576 kernel() = delete; \
1577 ~kernel() = delete; \
1578 static const char * GetOpenCLSource(); \
1581#define itkGetOpenCLSourceFromKernelMacro(kernel) \
1582 static const char * GetOpenCLSource() { return kernel::GetOpenCLSource(); } \
1583 ITK_MACROEND_NOOP_STATEMENT
1587#define itkPrintSelfObjectMacro(name) \
1588 if (static_cast<const LightObject *>(this->m_##name) == nullptr) \
1590 os << indent << #name << ": (null)" << std::endl; \
1594 os << indent << #name << ": " << std::endl; \
1595 this->m_##name->Print(os, indent.GetNextIndent()); \
1597 ITK_MACROEND_NOOP_STATEMENT
1602#define itkPrintSelfBooleanMacro(name) \
1603 os << indent << #name << ": " << (this->m_##name ? "On" : "Off") << std::endl; \
1604 ITK_MACROEND_NOOP_STATEMENT
1609#define ITK_DETAIL_SetDecoratedOutputMacroImpl(virtualKeyword, finalKeyword, name, type) \
1610 virtualKeyword void Set##name##Output(const SimpleDataObjectDecorator<type> * _arg) finalKeyword \
1612 itkDebugMacro("setting output " #name " to " << _arg); \
1613 if (_arg != itkDynamicCastInDebugMode<SimpleDataObjectDecorator<type> *>(this->ProcessObject::GetOutput(#name))) \
1615 this->ProcessObject::SetOutput(#name, const_cast<SimpleDataObjectDecorator<type> *>(_arg)); \
1619 virtualKeyword void Set##name(const type & _arg) finalKeyword \
1621 using DecoratorType = SimpleDataObjectDecorator<type>; \
1622 itkDebugMacro("setting output " #name " to " << _arg); \
1623 DecoratorType * output = itkDynamicCastInDebugMode<DecoratorType *>(this->ProcessObject::GetOutput(#name)); \
1626 if (output->Get() == _arg) \
1632 output->Set(_arg); \
1637 auto newOutput = DecoratorType::New(); \
1638 newOutput->Set(_arg); \
1639 this->Set##name##Output(newOutput); \
1642 ITK_MACROEND_NOOP_STATEMENT
1646#define itkVirtualSetDecoratedOutputMacro(name, type) ITK_DETAIL_SetDecoratedOutputMacroImpl(virtual, , name, type)
1647#define itkFinalSetDecoratedOutputMacro(name, type) ITK_DETAIL_SetDecoratedOutputMacroImpl(, final, name, type)
1648#define itkNonVirtualSetDecoratedOutputMacro(name, type) ITK_DETAIL_SetDecoratedOutputMacroImpl(, , name, type)
1649#define itkSetDecoratedOutputMacro(name, type) ITK_DETAIL_SetDecoratedOutputMacroImpl(virtual, , name, type)
1654#define ITK_DETAIL_GetDecoratedOutputMacroImpl(virtualKeyword, finalKeyword, name, type) \
1655 virtualKeyword const SimpleDataObjectDecorator<type> * Get##name##Output() const finalKeyword \
1657 itkDebugMacro("returning output " << #name " of " << this->ProcessObject::GetOutput(#name)); \
1658 return itkDynamicCastInDebugMode<const SimpleDataObjectDecorator<type> *>(this->ProcessObject::GetOutput(#name)); \
1660 virtualKeyword const type & Get##name() const finalKeyword \
1662 itkDebugMacro("Getting output " #name); \
1663 using DecoratorType = SimpleDataObjectDecorator<type>; \
1664 const DecoratorType * output = \
1665 itkDynamicCastInDebugMode<const DecoratorType *>(this->ProcessObject::GetOutput(#name)); \
1666 if (output == nullptr) \
1668 itkExceptionStringMacro("output" #name " is not set"); \
1670 return output->Get(); \
1672 ITK_MACROEND_NOOP_STATEMENT
1676#define itkVirtualGetDecoratedOutputMacro(name, type) ITK_DETAIL_GetDecoratedOutputMacroImpl(virtual, , name, type)
1677#define itkFinalGetDecoratedOutputMacro(name, type) ITK_DETAIL_GetDecoratedOutputMacroImpl(, final, name, type)
1678#define itkNonVirtualGetDecoratedOutputMacro(name, type) ITK_DETAIL_GetDecoratedOutputMacroImpl(, , name, type)
1679#define itkGetDecoratedOutputMacro(name, type) ITK_DETAIL_GetDecoratedOutputMacroImpl(virtual, , name, type)
1683#if defined(ITK_LEGACY_REMOVE) && !defined(ITK_LEGACY_SILENT)
1684# define ITK_FUTURE_DEPRECATED(message) [[deprecated(message)]]
1686# define ITK_FUTURE_DEPRECATED(message)
1689#if __cplusplus >= 202002L
1690# define ITK_NODISCARD(message) [[nodiscard(message)]]
1692# define ITK_NODISCARD(message) [[nodiscard]]
1697#if defined(ITK_LEGACY_REMOVE)
1698# define itkExposeEnumValue(name) \
1699 static_assert(false, "ERROR: Replace static_cast<int>(name) with with proper enumeration instead of integer")
1701# define ITK_NOEXCEPT_OR_THROW static_assert(false, "Replace ITK_NOEXCEPT_OR_THROW with ITK_NOEXCEPT")
1703# define ITK_DELETE_FUNCTION static_assert(false, "ERROR: ITK_DELETE_FUNCTION must be replaced with `= delete`"
1704# define ITK_CONSTEXPR_FUNC static_assert(false, "ERROR: ITK_CONSTEXPR_FUNC must be replaced with 'constexpr'")
1705# define ITK_CONSTEXPR_VAR static_assert(false, "ERROR: ITK_CONSTEXPR_VAR must be replaced with 'constexpr'")
1707# define ITK_FALLTHROUGH static_assert(false, "ERROR: ITK_FALLTHROUGH must be replaced with '[[fallthrough]]'")
1710# define ITK_ALIGNAS static_assert(false, "ERROR: ITK_ALIGNAS must be replaced with 'alignas'")
1711# define ITK_ALIGNOF static_assert(false, "ERROR: ITK_ALIGNOF must be replaced with 'alignof'")
1712# define ITK_DEPRECATED static_assert(false, "ERROR: ITK_DEPRECATED must be replaced with '[[deprecated]]'")
1713# define ITK_DEPRECATED_MSG \
1714 static_assert(false, "ERROR: ITK_DEPRECATED_MSG must be replaced with '[[deprecated(MSG)]]'")
1715# define ITK_CONSTEXPR static_assert(false, "ERROR: ITK_CONSTEXPR must be replaced with 'constexpr'")
1716# define ITK_DELETED_FUNCTION static_assert(false, "ERROR: ITK_DELETED_FUNCTION must be replaced with '= delete'")
1717# define ITK_EXTERN_TEMPLATE static_assert(false, "ERROR: ITK_EXTERN_TEMPLATE must be replaced with 'extern'")
1718# define ITK_FINAL static_assert(false, "ERROR: ITK_FINAL must be replaced with 'final'")
1719# define ITK_NOEXCEPT static_assert(false, "ERROR: ITK_NOEXCEPT must be replaced with 'noexcept'")
1720# define ITK_NOEXCEPT_EXPR static_assert(false, "ERROR: ITK_NOEXCEPT_EXPR must be replaced with 'noexcept'")
1721# define ITK_NULLPTR static_assert(false, "ERROR: ITK_NULLPTR must be replaced with 'nullptr'")
1722# define ITK_OVERRIDE static_assert(false, "ERROR: ITK_OVERRIDE must be replaced with 'override'")
1723# define ITK_STATIC_ASSERT static_assert(false, "ERROR: ITK_STATIC_ASSERT must be replaced with 'static_assert'")
1724# define ITK_STATIC_ASSERT_MSG \
1725 static_assert(false, "ERROR: ITK_STATIC_ASSERT_MSG must be replaced with 'static_assert'")
1726# define ITK_THREAD_LOCAL static_assert(false, "ERROR: ITK_THREAD_LOCAL must be replaced with 'thread_local'")
1729# define ITKv5_CONST static_assert(false, "ERROR: ITKv5_CONST must be replaced with 'const'")
1731# define ITK_ITERATOR_VIRTUAL static_assert(false, "ERROR: ITK_ITERATOR_VIRTUAL must be removed'")
1732# define ITK_ITERATOR_OVERRIDE static_assert(false, "ERROR: ITK_ITERATOR_OVERRIDE must be removed")
1733# define ITK_ITERATOR_FINAL static_assert(false, "ERROR: ITK_ITERATOR_FINAL must be removed")
1742# define itkExposeEnumValue(name) static_cast<int>(name)
1745# define ITK_NOEXCEPT_OR_THROW ITK_NOEXCEPT
1747# define ITK_FALLTHROUGH [[fallthrough]]
1749# define ITK_DELETE_FUNCTION = delete
1751# define ITK_CONSTEXPR_FUNC constexpr
1752# define ITK_CONSTEXPR_VAR constexpr
1755# define ITK_ALIGNAS(X) alignas(X)
1756# define ITK_ALIGNOF(X) alignof(X)
1757# define ITK_DEPRECATED [[deprecated]]
1758# define ITK_DEPRECATED_MSG(MSG) [[deprecated(MSG)]]
1759# define ITK_CONSTEXPR constexpr
1760# define ITK_DELETED_FUNCTION = delete
1761# define ITK_EXTERN_TEMPLATE extern
1762# define ITK_FINAL final
1763# define ITK_NOEXCEPT noexcept
1764# define ITK_NOEXCEPT_EXPR(X) noexcept(X)
1765# define ITK_NULLPTR nullptr
1766# define ITK_OVERRIDE override
1767# define ITK_STATIC_ASSERT(X) static_assert(X, #X)
1768# define ITK_STATIC_ASSERT_MSG(X, MSG) static_assert(X, MSG)
1769# define ITK_THREAD_LOCAL thread_local
1772# define ITKv5_CONST const
1774# define ITK_ITERATOR_VIRTUAL
1775# define ITK_ITERATOR_OVERRIDE
1776# define ITK_ITERATOR_FINAL
1779#define allow_inclusion_of_itkExceptionObject_h
1785#undef allow_inclusion_of_itkExceptionObject_h
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....