42#include "itkConfigure.h"
43#include "ITKCommonExport.h"
57#define ITK_STRINGIFY_HELPER(x) #x
58#define ITK_STRINGIFY(x) ITK_STRINGIFY_HELPER(x)
85#define ITK_NOOP_STATEMENT static_assert(true, "")
96#define ITK_MACROEND_NOOP_STATEMENT ITK_NOOP_STATEMENT
103#define ITK_PRAGMA(x) _Pragma(#x)
111# define ITK_GCC_PRAGMA_PUSH ITK_PRAGMA(GCC diagnostic push)
112# define ITK_GCC_PRAGMA_POP ITK_PRAGMA(GCC diagnostic pop)
113# define ITK_GCC_SUPPRESS_Wfloat_equal ITK_PRAGMA(GCC diagnostic ignored "-Wfloat-equal")
114# define ITK_GCC_SUPPRESS_Wformat_nonliteral ITK_PRAGMA(GCC diagnostic ignored "-Wformat-nonliteral")
115# define ITK_GCC_SUPPRESS_Warray_bounds ITK_PRAGMA(GCC diagnostic ignored "-Warray-bounds")
117# define ITK_GCC_PRAGMA_PUSH
118# define ITK_GCC_PRAGMA_POP
119# define ITK_GCC_SUPPRESS_Wfloat_equal
120# define ITK_GCC_SUPPRESS_Wformat_nonliteral
121# define ITK_GCC_SUPPRESS_Warray_bounds
126#if defined(__GNUC__) && !defined(__clang__)
127# define ITK_GCC_SUPPRESS_Wmaybe_uninitialized ITK_PRAGMA(GCC diagnostic ignored "-Wmaybe-uninitialized")
129# define ITK_GCC_SUPPRESS_Wmaybe_uninitialized
133#if defined(__clang__) && defined(__has_warning)
134# define ITK_CLANG_PRAGMA_PUSH ITK_PRAGMA(clang diagnostic push)
135# define ITK_CLANG_PRAGMA_POP ITK_PRAGMA(clang diagnostic pop)
136# if __has_warning("-Wzero-as-null-pointer-constant")
137# define ITK_CLANG_SUPPRESS_Wzero_as_null_pointer_constant \
138 ITK_PRAGMA(clang diagnostic ignored "-Wzero-as-null-pointer-constant")
140# define ITK_CLANG_SUPPRESS_Wzero_as_null_pointer_constant
142# if __has_warning("-Wduplicate-enum")
143# define ITK_CLANG_SUPPRESS_Wduplicate_enum ITK_PRAGMA(clang diagnostic ignored "-Wduplicate-enum")
145# define ITK_CLANG_SUPPRESS_Wduplicate_enum
148# define ITK_CLANG_PRAGMA_PUSH
149# define ITK_CLANG_PRAGMA_POP
150# define ITK_CLANG_SUPPRESS_Wzero_as_null_pointer_constant
151# define ITK_CLANG_SUPPRESS_Wduplicate_enum
156#define CLANG_PRAGMA_PUSH ITK_CLANG_PRAGMA_PUSH
157#define CLANG_PRAGMA_POP ITK_CLANG_PRAGMA_POP
158#define CLANG_SUPPRESS_Wfloat_equal ITK_GCC_SUPPRESS_Wfloat_equal
162# define ITK_FORMAT_PRINTF(a, b) __attribute__((format(printf, a, b)))
164# define ITK_FORMAT_PRINTF(a, b)
167#if !defined(ITK_LEGACY_REMOVE)
169# define CLANG_SUPPRESS_Wcpp14_extensions \
170 [[deprecated("Remove deprecated CLANG_SUPPRESS_Wcpp14_extensions c++14 warning suppression")]] void * \
171 CLANG_SUPPRESS_Wcpp14_extensions = nullptr;
183# define ITK_GCC_PRAGMA_DIAG(x) ITK_PRAGMA(GCC diagnostic x)
184# define ITK_GCC_PRAGMA_DIAG_PUSH() ITK_GCC_PRAGMA_DIAG(push)
185# define ITK_GCC_PRAGMA_DIAG_POP() ITK_GCC_PRAGMA_DIAG(pop)
187# define ITK_GCC_PRAGMA_DIAG(x)
188# define ITK_GCC_PRAGMA_DIAG_PUSH()
189# define ITK_GCC_PRAGMA_DIAG_POP()
196#if defined(_MSC_VER) && (_MSC_VER < 1922)
197# error "MSVC versions before Visual Studio 2019 16.2 are not supported"
199#if defined(__CYGWIN__)
200# error "The Cygwin compiler is not supported"
202#if defined(__GNUC__) && !defined(__clang__) && (__GNUC__ < 7)
203# error "GCC < 7 is not supported"
205#if defined(__apple_build_version__) && (__apple_build_version__ < 12000032)
206# error "AppleClang < Xcode 12.4 is not supported"
207#elif defined(__clang__) && (__clang_major__ < 5)
208# error "Clang < 5 is not supported"
212#if defined(_WIN32) || defined(WIN32)
213# define ITK_ABI_IMPORT __declspec(dllimport)
214# define ITK_ABI_EXPORT __declspec(dllexport)
215# define ITK_ABI_HIDDEN
218# define ITK_ABI_IMPORT __attribute__((visibility("default")))
219# define ITK_ABI_EXPORT __attribute__((visibility("default")))
220# define ITK_ABI_HIDDEN __attribute__((visibility("hidden")))
222# define ITK_ABI_IMPORT
223# define ITK_ABI_EXPORT
224# define ITK_ABI_HIDDEN
229#ifndef ITK_TEMPLATE_EXPORT
230# ifdef ITK_TEMPLATE_VISIBILITY_DEFAULT
231# define ITK_TEMPLATE_EXPORT __attribute__((visibility("default")))
233# define ITK_TEMPLATE_EXPORT
238#ifdef ITK_TEMPLATE_VISIBILITY_DEFAULT
239# define ITK_FORCE_EXPORT_MACRO(moduleName) __attribute__((visibility("default")))
241# define ITK_FORCE_EXPORT_MACRO(moduleName) moduleName##_EXPORT
244#ifndef ITK_FORWARD_EXPORT
246# if defined(__APPLE__) && defined(ITK_TEMPLATE_VISIBILITY_DEFAULT) && defined(ITK_BUILD_SHARED_LIBS) && \
247 defined(USE_COMPILER_HIDDEN_VISIBILITY)
248# define ITK_FORWARD_EXPORT __attribute__((visibility("default")))
250# define ITK_FORWARD_EXPORT
276#define itkNewMacro(x) \
277 itkSimpleNewMacro(x); \
278 itkCreateAnotherMacro(x); \
280 ITK_MACROEND_NOOP_STATEMENT
282#define itkSimpleNewMacro(x) \
283 static Pointer New() \
285 Pointer smartPtr = ::itk::ObjectFactory<x>::Create(); \
286 if (smartPtr == nullptr) \
288 smartPtr = new x(); \
290 smartPtr->UnRegister(); \
293 ITK_MACROEND_NOOP_STATEMENT
295#define itkCreateAnotherMacro(x) \
296 ::itk::LightObject::Pointer CreateAnother() const override { return x::New().GetPointer(); } \
297 ITK_MACROEND_NOOP_STATEMENT
299#define itkCloneMacro(x) \
300 Pointer Clone() const \
302 Pointer rval = dynamic_cast<x *>(this->InternalClone().GetPointer()); \
305 ITK_MACROEND_NOOP_STATEMENT
311#define itkFactoryOnlyNewMacro(x) \
312 itkSimpleFactoryOnlyNewMacro(x); \
313 itkCreateAnotherMacro(x); \
315 ITK_MACROEND_NOOP_STATEMENT
317#define itkSimpleFactoryOnlyNewMacro(x) \
318 static auto New() -> Pointer \
320 Pointer smartPtr = ::itk::ObjectFactory<x>::Create(); \
321 if (smartPtr == nullptr) \
323 itkSpecializedMessageExceptionMacro(ExceptionObject, \
324 "Object factory failed to instantiate " << typeid(x).name()); \
326 smartPtr->UnRegister(); \
329 ITK_MACROEND_NOOP_STATEMENT
344#define itkFactorylessNewMacro(x) \
345 static Pointer New() \
347 auto * rawPtr = new x(); \
348 Pointer smartPtr = rawPtr; \
349 rawPtr->UnRegister(); \
352 itkCreateAnotherMacro(x); \
353 ITK_MACROEND_NOOP_STATEMENT
364#define ITK_DISALLOW_COPY_AND_MOVE(TypeName) \
365 TypeName(const TypeName &) = delete; \
366 TypeName & operator=(const TypeName &) = delete; \
367 TypeName(TypeName &&) = delete; \
368 TypeName & operator=(TypeName &&) = delete
370#if !defined(ITK_LEGACY_REMOVE)
371# define ITK_DISALLOW_COPY_AND_ASSIGN(TypeName) ITK_DISALLOW_COPY_AND_MOVE(TypeName)
373# define ITK_DISALLOW_COPY_AND_ASSIGN(TypeName) \
374 static_assert(false, "Replace deprecated ITK_DISALLOW_COPY_AND_ASSIGN with modern ITK_DISALLOW_COPY_AND_MOVE")
386#define ITK_DEFAULT_COPY_AND_MOVE(TypeName) \
387 TypeName(const TypeName &) = default; \
388 TypeName & operator=(const TypeName &) = default; \
389 TypeName(TypeName &&) = default; \
390 TypeName & operator=(TypeName &&) = default
399#if defined(ITK_ALPHA_FEATURE_CXX20)
400# define ITK_EXPERIMENTAL_CXX20_REWRITTEN_UNEQUAL_OPERATOR
406#ifdef ITK_EXPERIMENTAL_CXX20_REWRITTEN_UNEQUAL_OPERATOR
409# define ITK_UNEQUAL_OPERATOR_MEMBER_FUNCTION(TypeName) ITK_MACROEND_NOOP_STATEMENT
413# define ITK_UNEQUAL_OPERATOR_MEMBER_FUNCTION(TypeName) \
414 bool operator!=(const TypeName & other) const { return !(this->operator==(other)); } \
415 ITK_MACROEND_NOOP_STATEMENT
420#define itkInternalGetNameOfClassImplementationMacro(thisClass) \
422 static_assert(std::is_same_v<thisClass, std::remove_const_t<std::remove_reference_t<decltype(*this)>>>, \
423 "The macro argument `" #thisClass \
424 "` appears incorrect! It should correspond with the name of this class!"); \
427 ITK_MACROEND_NOOP_STATEMENT
433#define itkVirtualGetNameOfClassMacro(thisClass) \
434 virtual const char * GetNameOfClass() const itkInternalGetNameOfClassImplementationMacro(thisClass)
436#define itkOverrideGetNameOfClassMacro(thisClass) \
437 const char * GetNameOfClass() const override itkInternalGetNameOfClassImplementationMacro(thisClass)
439#ifdef ITK_FUTURE_LEGACY_REMOVE
440# define itkTypeMacro(thisClass, superclass) \
441 static_assert(false, \
442 "In a future revision of ITK, the macro `itkTypeMacro(thisClass, superclass)` will be removed. " \
443 "Please call `itkOverrideGetNameOfClassMacro(thisClass)` instead!")
444# define itkTypeMacroNoParent(thisClass) \
445 static_assert(false, \
446 "In a future revision of ITK, the macro `itkTypeMacroNoParent(thisClass)` will be removed. " \
447 "Please call `itkVirtualGetNameOfClassMacro(thisClass)` instead!")
453# define itkTypeMacro(thisClass, superclass) itkOverrideGetNameOfClassMacro(thisClass)
454# define itkTypeMacroNoParent(thisClass) itkVirtualGetNameOfClassMacro(thisClass)
467#ifndef ITK_FUTURE_LEGACY_REMOVE
468extern ITKCommon_EXPORT
void
469OutputWindowDisplayText(
const char *);
471extern ITKCommon_EXPORT
void
472OutputWindowDisplayErrorText(
const char *);
474extern ITKCommon_EXPORT
void
475OutputWindowDisplayWarningText(
const char *);
477extern ITKCommon_EXPORT
void
478OutputWindowDisplayGenericOutputText(
const char *);
480extern ITKCommon_EXPORT
void
481OutputWindowDisplayDebugText(
const char *);
485extern ITKCommon_EXPORT
void
486OutputWindowDisplayDebugText(
const char * file,
488 const char * className,
489 const void * objectAddress,
490 const char * message);
492extern ITKCommon_EXPORT
void
493OutputWindowDisplayWarningText(
const char * file,
495 const char * className,
496 const void * objectAddress,
497 const char * message);
499extern ITKCommon_EXPORT
void
500OutputWindowDisplayErrorText(
const char * file,
502 const char * className,
503 const void * objectAddress,
504 const char * message);
506extern ITKCommon_EXPORT
void
507OutputWindowDisplayGenericOutputText(
const char * file,
unsigned int line,
const char * message);
519# define itkDebugMacro(x) ITK_NOOP_STATEMENT
520# define itkDebugStatement(x) ITK_NOOP_STATEMENT
522# define itkDebugMacro(x) \
524 using namespace ::itk::print_helper; \
525 if (this->GetDebug() && ::itk::Object::GetGlobalWarningDisplay()) \
527 std::ostringstream itkmsg; \
529 ::itk::OutputWindowDisplayDebugText(__FILE__, __LINE__, this->GetNameOfClass(), this, itkmsg.str().c_str()); \
532 ITK_MACROEND_NOOP_STATEMENT
535# define itkDebugStatement(x) x
541#define itkWarningMacro(x) \
543 if (::itk::Object::GetGlobalWarningDisplay()) \
545 std::ostringstream itkmsg; \
547 ::itk::OutputWindowDisplayWarningText(__FILE__, __LINE__, this->GetNameOfClass(), this, itkmsg.str().c_str()); \
550 ITK_MACROEND_NOOP_STATEMENT
553#define itkWarningStatement(x) x
555#if defined(ITK_CPP_FUNCTION)
556# if defined(_WIN32) && !defined(__MINGW32__) && !defined(ITK_WRAPPING_PARSER)
557# define ITK_LOCATION __FUNCSIG__
558# elif defined(__GNUC__)
559# define ITK_LOCATION __PRETTY_FUNCTION__
561# define ITK_LOCATION __FUNCTION__
564# define ITK_LOCATION "unknown"
567#define itkDeclareExceptionMacro(newexcp, parentexcp, whatmessage) \
570 class newexcp : public parentexcp \
574 static constexpr const char * const default_exception_message = whatmessage; \
576 using parentexcp::parentexcp; \
577 itkOverrideGetNameOfClassMacro(newexcp); \
580 ITK_MACROEND_NOOP_STATEMENT
583#define itkSpecializedMessageExceptionMacro(ExceptionType, x) \
585 std::ostringstream exceptionDescriptionOutputStringStream; \
586 exceptionDescriptionOutputStringStream << "" x; \
587 throw ::itk::ExceptionType( \
588 std::string{ __FILE__ }, __LINE__, exceptionDescriptionOutputStringStream.str(), std::string{ ITK_LOCATION }); \
590 ITK_MACROEND_NOOP_STATEMENT
592#define itkSpecializedExceptionMacro(ExceptionType) \
593 throw ::itk::ExceptionType( \
594 std::string{ __FILE__ }, __LINE__, ::itk::ExceptionType::default_exception_message, std::string{ ITK_LOCATION });
600#define itkExceptionMacro(x) \
602 std::ostringstream exceptionDescriptionOutputStringStream; \
603 exceptionDescriptionOutputStringStream << "" x; \
604 throw ::itk::ExceptionObject(std::string{ __FILE__ }, \
606 exceptionDescriptionOutputStringStream.str(), \
607 std::string{ ITK_LOCATION }, \
610 ITK_MACROEND_NOOP_STATEMENT
612#define itkExceptionStringMacro(x) \
614 throw ::itk::ExceptionObject( \
615 std::string{ __FILE__ }, __LINE__, std::string{ x }, std::string{ ITK_LOCATION }, this); \
617 ITK_MACROEND_NOOP_STATEMENT
619#define itkGenericExceptionMacro(x) itkSpecializedMessageExceptionMacro(ExceptionObject, x)
621#define itkGenericOutputMacro(x) \
623 if (::itk::Object::GetGlobalWarningDisplay()) \
625 std::ostringstream itkmsg; \
627 ::itk::OutputWindowDisplayGenericOutputText(__FILE__, __LINE__, itkmsg.str().c_str()); \
630 ITK_MACROEND_NOOP_STATEMENT
635#define itkLogMacro(x, y) \
637 if (this->GetLogger()) \
639 this->GetLogger()->Write(::itk::LoggerBase::x, y); \
642 ITK_MACROEND_NOOP_STATEMENT
644#define itkLogMacroStatic(obj, x, y) \
646 if (obj->GetLogger()) \
648 obj->GetLogger()->Write(::itk::LoggerBase::x, y); \
651 ITK_MACROEND_NOOP_STATEMENT
682#if defined(ITK_LEGACY_REMOVE)
683# define itkLegacyMacro(method)
685# if defined(ITK_LEGACY_SILENT) || defined(ITK_LEGACY_TEST)
687# define itkLegacyMacro(method) method
690# define itkLegacyMacro(method) [[deprecated]] method
716#if defined(ITK_LEGACY_SILENT)
717# define itkLegacyBodyMacro(method, version) ITK_NOOP_STATEMENT
718# define itkLegacyReplaceBodyMacro(method, version, replace) ITK_NOOP_STATEMENT
719# define itkGenericLegacyBodyMacro(method, version) ITK_NOOP_STATEMENT
720# define itkGenericLegacyReplaceBodyMacro(method, version, replace) ITK_NOOP_STATEMENT
722# define itkLegacyBodyMacro(method, version) \
723 itkWarningMacro(#method " was deprecated for ITK " #version " and will be removed in a future version.")
724# define itkLegacyReplaceBodyMacro(method, version, replace) \
725 itkWarningMacro(#method " was deprecated for ITK " #version \
726 " and will be removed in a future version. Use " #replace " instead.")
727# define itkGenericLegacyBodyMacro(method, version) \
728 itkGenericOutputMacro(#method " was deprecated for ITK " #version " and will be removed in a future version.")
729# define itkGenericLegacyReplaceBodyMacro(method, version, replace) \
730 itkGenericOutputMacro(#method " was deprecated for ITK " #version \
731 " and will be removed in a future version. Use " #replace " instead.")
738constexpr size_t ITK_CACHE_LINE_ALIGNMENT{ 64 };
746#define itkPadStruct(mincachesize, oldtype, newtype) \
747 struct newtype : public oldtype \
749 char _StructPadding[mincachesize - (sizeof(oldtype) % mincachesize)]; \
756#if defined(ITK_HAS_GNU_ATTRIBUTE_ALIGNED)
757# define itkAlignedTypedef(alignment, oldtype, newtype) using newtype = oldtype __attribute__((aligned(alignment)))
758#elif defined(_MSC_VER)
759# define itkAlignedTypedef(alignment, oldtype, newtype) using newtype = __declspec(align(alignment)) oldtype
761# define itkAlignedTypedef(alignment, oldtype, newtype) using newtype = oldtype
764#if defined(ITK_FUTURE_LEGACY_REMOVE)
787# define ITK_FRIEND_TEMPLATE_FUNCTION_ARGUMENT(T) < >
789# define ITK_FRIEND_TEMPLATE_FUNCTION_ARGUMENT(T) "Macro remove use C++11 compliant declaration of "
805#define itkForLoopAssignmentMacro( \
806 DestinationType, SourceType, DestinationElementType, DestinationArray, SourceArray, NumberOfIterations) \
807 for (unsigned int i = 0; i < NumberOfIterations; ++i) \
809 DestinationArray[i] = static_cast<DestinationElementType>(SourceArray[i]); \
811 ITK_MACROEND_NOOP_STATEMENT
822#define itkForLoopRoundingAndAssignmentMacro( \
823 DestinationType, Sourcrnd_halfintup, DestinationElementType, DestinationArray, SourceArray, NumberOfIterations) \
824 for (unsigned int i = 0; i < NumberOfIterations; ++i) \
826 DestinationArray[i] = ::itk::Math::Round<DestinationElementType>(SourceArray[i]); \
828 ITK_MACROEND_NOOP_STATEMENT
832#if !defined(NDEBUG) && !defined(ITK_WRAPPING)
835# define itkAssertInDebugOrThrowInReleaseMacro(msg) __assert_fail(msg, __FILE__, __LINE__, __ASSERT_FUNCTION);
837# define itkAssertInDebugOrThrowInReleaseMacro(msg) itkGenericExceptionMacro(<< msg);
841# define itkAssertInDebugOrThrowInReleaseMacro(msg) itkGenericExceptionMacro(<< msg);
844#define itkAssertOrThrowMacro(test, message) \
847 std::ostringstream msgstr; \
849 itkAssertInDebugOrThrowInReleaseMacro(msgstr.str().c_str()); \
851 ITK_MACROEND_NOOP_STATEMENT
853#if !defined(NDEBUG) && !defined(ITK_WRAPPING)
854# define itkAssertInDebugAndIgnoreInReleaseMacro(X) assert(X)
856# define itkAssertInDebugAndIgnoreInReleaseMacro(X) ITK_NOOP_STATEMENT
866#ifdef ITK_FUTURE_LEGACY_REMOVE
867# define itkStaticConstMacro(name, type, value) \
868 "Replace itkStaticConstMacro(name, type, value) with `static constexpr type name = value`"
869# define itkGetStaticConstMacro(name) "Replace itkGetStaticConstMacro(name) with `Self::name`"
885# define itkStaticConstMacro(name, type, value) static constexpr type name = value
887# define itkGetStaticConstMacro(name) (Self::name)
891#define ITK_DETAIL_SetInputMacroImpl(virtualKeyword, finalKeyword, name, type) \
892 virtualKeyword void Set##name(const type * _arg) finalKeyword \
894 itkDebugMacro("setting input " #name " to " << _arg); \
895 if (_arg != itkDynamicCastInDebugMode<type *>(this->ProcessObject::GetInput(#name))) \
897 this->ProcessObject::SetInput(#name, const_cast<type *>(_arg)); \
901 ITK_MACROEND_NOOP_STATEMENT
905#define itkVirtualSetInputMacro(name, type) ITK_DETAIL_SetInputMacroImpl(virtual, , name, type)
906#define itkFinalSetInputMacro(name, type) ITK_DETAIL_SetInputMacroImpl(, final, name, type)
907#define itkNonVirtualSetInputMacro(name, type) ITK_DETAIL_SetInputMacroImpl(, , name, type)
908#define itkSetInputMacro(name, type) ITK_DETAIL_SetInputMacroImpl(virtual, , name, type)
912#define ITK_DETAIL_GetInputMacroImpl(virtualKeyword, finalKeyword, name, type) \
913 virtualKeyword const type * Get##name() const finalKeyword \
915 itkDebugMacro("returning input " << #name " of " << this->ProcessObject::GetInput(#name)); \
916 return itkDynamicCastInDebugMode<const type *>(this->ProcessObject::GetInput(#name)); \
918 ITK_MACROEND_NOOP_STATEMENT
922#define itkVirtualGetInputMacro(name, type) ITK_DETAIL_GetInputMacroImpl(virtual, , name, type)
923#define itkFinalGetInputMacro(name, type) ITK_DETAIL_GetInputMacroImpl(, final, name, type)
924#define itkNonVirtualGetInputMacro(name, type) ITK_DETAIL_GetInputMacroImpl(, , name, type)
925#define itkGetInputMacro(name, type) ITK_DETAIL_GetInputMacroImpl(virtual, , name, type)
930#define ITK_DETAIL_SetDecoratedInputMacroImpl(virtualKeyword, finalKeyword, name, type) \
931 virtualKeyword void Set##name##Input(const SimpleDataObjectDecorator<type> * _arg) finalKeyword \
933 itkDebugMacro("setting input " #name " to " << _arg); \
934 if (_arg != itkDynamicCastInDebugMode<SimpleDataObjectDecorator<type> *>(this->ProcessObject::GetInput(#name))) \
936 this->ProcessObject::SetInput(#name, const_cast<SimpleDataObjectDecorator<type> *>(_arg)); \
940 virtualKeyword void Set##name(const SimpleDataObjectDecorator<type> * _arg) finalKeyword \
942 this->Set##name##Input(_arg); \
944 virtualKeyword void Set##name(const type & _arg) finalKeyword \
946 using DecoratorType = SimpleDataObjectDecorator<type>; \
947 itkDebugMacro("setting input " #name " to " << _arg); \
948 const DecoratorType * oldInput = \
949 itkDynamicCastInDebugMode<const DecoratorType *>(this->ProcessObject::GetInput(#name)); \
950 ITK_GCC_PRAGMA_PUSH \
951 ITK_GCC_SUPPRESS_Wfloat_equal \
952 if (oldInput && oldInput->Get() == _arg) \
957 auto newInput = DecoratorType::New(); \
958 newInput->Set(_arg); \
959 this->Set##name##Input(newInput); \
961 ITK_MACROEND_NOOP_STATEMENT
966#define itkVirtualSetDecoratedInputMacro(name, type) ITK_DETAIL_SetDecoratedInputMacroImpl(virtual, , name, type)
967#define itkFinalSetDecoratedInputMacro(name, type) ITK_DETAIL_SetDecoratedInputMacroImpl(, final, name, type)
968#define itkNonVirtualSetDecoratedInputMacro(name, type) ITK_DETAIL_SetDecoratedInputMacroImpl(, , name, type)
969#define itkSetDecoratedInputMacro(name, type) ITK_DETAIL_SetDecoratedInputMacroImpl(virtual, , name, type)
974#define ITK_DETAIL_GetDecoratedInputMacroImpl(virtualKeyword, finalKeyword, name, type) \
975 virtualKeyword const SimpleDataObjectDecorator<type> * Get##name##Input() const finalKeyword \
977 itkDebugMacro("returning input " << #name " of " << this->ProcessObject::GetInput(#name)); \
978 return itkDynamicCastInDebugMode<const SimpleDataObjectDecorator<type> *>(this->ProcessObject::GetInput(#name)); \
980 virtualKeyword const type & Get##name() const finalKeyword \
982 itkDebugMacro("Getting input " #name); \
983 using DecoratorType = SimpleDataObjectDecorator<type>; \
984 const DecoratorType * input = \
985 itkDynamicCastInDebugMode<const DecoratorType *>(this->ProcessObject::GetInput(#name)); \
986 if (input == nullptr) \
988 itkExceptionStringMacro("input" #name " is not set"); \
990 return input->Get(); \
992 ITK_MACROEND_NOOP_STATEMENT
996#define itkVirtualGetDecoratedInputMacro(name, type) ITK_DETAIL_GetDecoratedInputMacroImpl(virtual, , name, type)
997#define itkFinalGetDecoratedInputMacro(name, type) ITK_DETAIL_GetDecoratedInputMacroImpl(, final, name, type)
998#define itkNonVirtualGetDecoratedInputMacro(name, type) ITK_DETAIL_GetDecoratedInputMacroImpl(, , name, type)
999#define itkGetDecoratedInputMacro(name, type) ITK_DETAIL_GetDecoratedInputMacroImpl(virtual, , name, type)
1004#define itkVirtualSetGetDecoratedInputMacro(name, type) \
1005 itkVirtualSetDecoratedInputMacro(name, type); \
1006 itkVirtualGetDecoratedInputMacro(name, type)
1007#define itkFinalSetGetDecoratedInputMacro(name, type) \
1008 itkFinalSetDecoratedInputMacro(name, type); \
1009 itkFinalGetDecoratedInputMacro(name, type)
1010#define itkNonVirtualSetGetDecoratedInputMacro(name, type) \
1011 itkNonVirtualSetDecoratedInputMacro(name, type); \
1012 itkNonVirtualGetDecoratedInputMacro(name, type)
1013#define itkSetGetDecoratedInputMacro(name, type) \
1014 itkSetDecoratedInputMacro(name, type); \
1015 itkGetDecoratedInputMacro(name, type)
1020#define ITK_DETAIL_SetDecoratedObjectInputMacroImpl(virtualKeyword, finalKeyword, name, type) \
1021 virtualKeyword void Set##name##Input(const DataObjectDecorator<type> * _arg) finalKeyword \
1023 itkDebugMacro("setting input " #name " to " << _arg); \
1024 if (_arg != itkDynamicCastInDebugMode<DataObjectDecorator<type> *>(this->ProcessObject::GetInput(#name))) \
1026 this->ProcessObject::SetInput(#name, const_cast<DataObjectDecorator<type> *>(_arg)); \
1030 virtualKeyword void Set##name(const type * _arg) finalKeyword \
1032 using DecoratorType = DataObjectDecorator<type>; \
1033 itkDebugMacro("setting input " #name " to " << _arg); \
1034 const DecoratorType * oldInput = \
1035 itkDynamicCastInDebugMode<const DecoratorType *>(this->ProcessObject::GetInput(#name)); \
1036 if (oldInput && oldInput->Get() == _arg) \
1040 auto newInput = DecoratorType::New(); \
1041 newInput->Set(_arg); \
1042 this->Set##name##Input(newInput); \
1044 ITK_MACROEND_NOOP_STATEMENT
1049#define itkVirtualSetDecoratedObjectInputMacro(name, type) \
1050 ITK_DETAIL_SetDecoratedObjectInputMacroImpl(virtual, , name, type)
1051#define itkFinalSetDecoratedObjectInputMacro(name, type) \
1052 ITK_DETAIL_SetDecoratedObjectInputMacroImpl(, final, name, type)
1053#define itkNonVirtualSetDecoratedObjectInputMacro(name, type) \
1054 ITK_DETAIL_SetDecoratedObjectInputMacroImpl(, , name, type)
1055#define itkSetDecoratedObjectInputMacro(name, type) ITK_DETAIL_SetDecoratedObjectInputMacroImpl(virtual, , name, type)
1060#define ITK_DETAIL_GetDecoratedObjectInputMacroImpl(virtualKeyword, finalKeyword, name, type) \
1061 virtualKeyword const DataObjectDecorator<type> * Get##name##Input() const finalKeyword \
1063 itkDebugMacro("returning input " << #name " of " << this->ProcessObject::GetInput(#name)); \
1064 return itkDynamicCastInDebugMode<const DataObjectDecorator<type> *>(this->ProcessObject::GetInput(#name)); \
1066 virtualKeyword const type * Get##name() const finalKeyword \
1068 itkDebugMacro("Getting input " #name); \
1069 using DecoratorType = DataObjectDecorator<type>; \
1070 const DecoratorType * input = \
1071 itkDynamicCastInDebugMode<const DecoratorType *>(this->ProcessObject::GetInput(#name)); \
1072 if (input == nullptr) \
1076 return input->Get(); \
1078 ITK_MACROEND_NOOP_STATEMENT
1083#define itkVirtualGetDecoratedObjectInputMacro(name, type) \
1084 ITK_DETAIL_GetDecoratedObjectInputMacroImpl(virtual, , name, type)
1085#define itkFinalGetDecoratedObjectInputMacro(name, type) \
1086 ITK_DETAIL_GetDecoratedObjectInputMacroImpl(, final, name, type)
1087#define itkNonVirtualGetDecoratedObjectInputMacro(name, type) \
1088 ITK_DETAIL_GetDecoratedObjectInputMacroImpl(, , name, type)
1089#define itkGetDecoratedObjectInputMacro(name, type) ITK_DETAIL_GetDecoratedObjectInputMacroImpl(virtual, , name, type)
1094#define itkVirtualSetGetDecoratedObjectInputMacro(name, type) \
1095 itkVirtualSetDecoratedObjectInputMacro(name, type); \
1096 itkVirtualGetDecoratedObjectInputMacro(name, type)
1097#define itkFinalSetGetDecoratedObjectInputMacro(name, type) \
1098 itkFinalSetDecoratedObjectInputMacro(name, type); \
1099 itkFinalGetDecoratedObjectInputMacro(name, type)
1100#define itkNonVirtualSetGetDecoratedObjectInputMacro(name, type) \
1101 itkNonVirtualSetDecoratedObjectInputMacro(name, type); \
1102 itkNonVirtualGetDecoratedObjectInputMacro(name, type)
1103#define itkSetGetDecoratedObjectInputMacro(name, type) \
1104 itkSetDecoratedObjectInputMacro(name, type); \
1105 itkGetDecoratedObjectInputMacro(name, type)
1118#define ITK_DETAIL_SetMacroImpl(virtualKeyword, finalKeyword, name, type) \
1119 virtualKeyword void Set##name(type _arg) finalKeyword \
1121 itkDebugMacro("setting " #name " to " << _arg); \
1122 ITK_GCC_PRAGMA_PUSH \
1123 ITK_GCC_SUPPRESS_Wfloat_equal \
1124 if (this->m_##name != _arg) \
1126 this->m_##name = std::move(_arg); \
1129 ITK_GCC_PRAGMA_POP \
1131 ITK_MACROEND_NOOP_STATEMENT
1135#define ITK_DETAIL_GetMacroImpl(virtualKeyword, finalKeyword, name, type) \
1136 virtualKeyword type Get##name() finalKeyword { return this->m_##name; } \
1137 ITK_MACROEND_NOOP_STATEMENT
1140#define ITK_DETAIL_GetConstMacroImpl(virtualKeyword, finalKeyword, name, type) \
1141 virtualKeyword type Get##name() const finalKeyword { return this->m_##name; } \
1142 ITK_MACROEND_NOOP_STATEMENT
1145#define ITK_DETAIL_GetConstReferenceMacroImpl(virtualKeyword, finalKeyword, name, type) \
1146 virtualKeyword const type & Get##name() const finalKeyword { return this->m_##name; } \
1147 ITK_MACROEND_NOOP_STATEMENT
1151#define itkVirtualSetMacro(name, type) ITK_DETAIL_SetMacroImpl(virtual, , name, type)
1152#define itkFinalSetMacro(name, type) ITK_DETAIL_SetMacroImpl(, final, name, type)
1153#define itkNonVirtualSetMacro(name, type) ITK_DETAIL_SetMacroImpl(, , name, type)
1154#define itkSetMacro(name, type) ITK_DETAIL_SetMacroImpl(virtual, , name, type)
1159#define itkVirtualGetMacro(name, type) ITK_DETAIL_GetMacroImpl(virtual, , name, type)
1160#define itkFinalGetMacro(name, type) ITK_DETAIL_GetMacroImpl(, final, name, type)
1161#define itkNonVirtualGetMacro(name, type) ITK_DETAIL_GetMacroImpl(, , name, type)
1162#define itkGetMacro(name, type) ITK_DETAIL_GetMacroImpl(virtual, , name, type)
1169#define itkVirtualGetConstMacro(name, type) ITK_DETAIL_GetConstMacroImpl(virtual, , name, type)
1170#define itkFinalGetConstMacro(name, type) ITK_DETAIL_GetConstMacroImpl(, final, name, type)
1171#define itkNonVirtualGetConstMacro(name, type) ITK_DETAIL_GetConstMacroImpl(, , name, type)
1172#define itkGetConstMacro(name, type) ITK_DETAIL_GetConstMacroImpl(virtual, , name, type)
1180#define itkVirtualGetConstReferenceMacro(name, type) ITK_DETAIL_GetConstReferenceMacroImpl(virtual, , name, type)
1181#define itkFinalGetConstReferenceMacro(name, type) ITK_DETAIL_GetConstReferenceMacroImpl(, final, name, type)
1182#define itkNonVirtualGetConstReferenceMacro(name, type) ITK_DETAIL_GetConstReferenceMacroImpl(, , name, type)
1183#define itkGetConstReferenceMacro(name, type) ITK_DETAIL_GetConstReferenceMacroImpl(virtual, , name, type)
1187#define ITK_DETAIL_SetEnumMacroImpl(virtualKeyword, finalKeyword, name, type) \
1188 virtualKeyword void Set##name(const type _arg) finalKeyword \
1190 itkDebugMacro("setting " #name " to " << static_cast<long>(_arg)); \
1191 if (this->m_##name != _arg) \
1193 this->m_##name = _arg; \
1197 ITK_MACROEND_NOOP_STATEMENT
1203#define itkVirtualSetEnumMacro(name, type) ITK_DETAIL_SetEnumMacroImpl(virtual, , name, type)
1204#define itkFinalSetEnumMacro(name, type) ITK_DETAIL_SetEnumMacroImpl(, final, name, type)
1205#define itkNonVirtualSetEnumMacro(name, type) ITK_DETAIL_SetEnumMacroImpl(, , name, type)
1206#define itkSetEnumMacro(name, type) ITK_DETAIL_SetEnumMacroImpl(virtual, , name, type)
1210#define ITK_DETAIL_GetEnumMacroImpl(virtualKeyword, finalKeyword, name, type) \
1211 virtualKeyword type Get##name() const finalKeyword { return this->m_##name; } \
1212 ITK_MACROEND_NOOP_STATEMENT
1217#define itkVirtualGetEnumMacro(name, type) ITK_DETAIL_GetEnumMacroImpl(virtual, , name, type)
1218#define itkFinalGetEnumMacro(name, type) ITK_DETAIL_GetEnumMacroImpl(, final, name, type)
1219#define itkNonVirtualGetEnumMacro(name, type) ITK_DETAIL_GetEnumMacroImpl(, , name, type)
1220#define itkGetEnumMacro(name, type) ITK_DETAIL_GetEnumMacroImpl(virtual, , name, type)
1225#define ITK_DETAIL_SetStringMacroImpl(virtualKeyword, finalKeyword, name) \
1226 virtualKeyword void Set##name(const char * _arg) finalKeyword \
1228 if (_arg && (_arg == this->m_##name)) \
1234 this->m_##name = _arg; \
1238 this->m_##name = ""; \
1242 virtualKeyword void Set##name(const std::string & _arg) finalKeyword { this->Set##name(_arg.c_str()); } \
1243 ITK_MACROEND_NOOP_STATEMENT
1248#define itkVirtualSetStringMacro(name) ITK_DETAIL_SetStringMacroImpl(virtual, , name)
1249#define itkFinalSetStringMacro(name) ITK_DETAIL_SetStringMacroImpl(, final, name)
1250#define itkNonVirtualSetStringMacro(name) ITK_DETAIL_SetStringMacroImpl(, , name)
1251#define itkSetStringMacro(name) ITK_DETAIL_SetStringMacroImpl(virtual, , name)
1255#define ITK_DETAIL_GetStringMacroImpl(virtualKeyword, finalKeyword, name) \
1256 virtualKeyword const char * Get##name() const finalKeyword { return this->m_##name.c_str(); } \
1257 ITK_MACROEND_NOOP_STATEMENT
1262#define itkVirtualGetStringMacro(name) ITK_DETAIL_GetStringMacroImpl(virtual, , name)
1263#define itkFinalGetStringMacro(name) ITK_DETAIL_GetStringMacroImpl(, final, name)
1264#define itkNonVirtualGetStringMacro(name) ITK_DETAIL_GetStringMacroImpl(, , name)
1265#define itkGetStringMacro(name) ITK_DETAIL_GetStringMacroImpl(virtual, , name)
1270#define ITK_DETAIL_SetClampMacroImpl(virtualKeyword, finalKeyword, name, type, min, max) \
1271 virtualKeyword void Set##name(type _arg) finalKeyword \
1273 const type temp_extrema = (_arg <= min ? min : (_arg >= max ? max : _arg)); \
1274 itkDebugMacro("setting " << #name " to " << _arg); \
1275 ITK_GCC_PRAGMA_PUSH \
1276 ITK_GCC_SUPPRESS_Wfloat_equal \
1277 if (this->m_##name != temp_extrema) \
1279 this->m_##name = temp_extrema; \
1282 ITK_GCC_PRAGMA_POP \
1284 ITK_MACROEND_NOOP_STATEMENT
1290#define itkVirtualSetClampMacro(name, type, min, max) ITK_DETAIL_SetClampMacroImpl(virtual, , name, type, min, max)
1291#define itkFinalSetClampMacro(name, type, min, max) ITK_DETAIL_SetClampMacroImpl(, final, name, type, min, max)
1292#define itkNonVirtualSetClampMacro(name, type, min, max) ITK_DETAIL_SetClampMacroImpl(, , name, type, min, max)
1293#define itkSetClampMacro(name, type, min, max) ITK_DETAIL_SetClampMacroImpl(virtual, , name, type, min, max)
1298#define ITK_DETAIL_SetObjectMacroImpl(virtualKeyword, finalKeyword, name, type) \
1299 virtualKeyword void Set##name(type * _arg) finalKeyword \
1301 itkDebugMacro("setting " << #name " to " << _arg); \
1302 if (this->m_##name != _arg) \
1304 this->m_##name = _arg; \
1308 ITK_MACROEND_NOOP_STATEMENT
1313#define itkVirtualSetObjectMacro(name, type) ITK_DETAIL_SetObjectMacroImpl(virtual, , name, type)
1314#define itkFinalSetObjectMacro(name, type) ITK_DETAIL_SetObjectMacroImpl(, final, name, type)
1315#define itkNonVirtualSetObjectMacro(name, type) ITK_DETAIL_SetObjectMacroImpl(, , name, type)
1316#define itkSetObjectMacro(name, type) ITK_DETAIL_SetObjectMacroImpl(virtual, , name, type)
1334#define ITK_DETAIL_GetConstObjectMacroImpl(virtualKeyword, finalKeyword, name, type) \
1335 virtualKeyword const type * Get##name() const finalKeyword { return this->m_##name.GetPointer(); } \
1336 ITK_MACROEND_NOOP_STATEMENT
1341#define itkVirtualGetConstObjectMacro(name, type) ITK_DETAIL_GetConstObjectMacroImpl(virtual, , name, type)
1342#define itkFinalGetConstObjectMacro(name, type) ITK_DETAIL_GetConstObjectMacroImpl(, final, name, type)
1343#define itkNonVirtualGetConstObjectMacro(name, type) ITK_DETAIL_GetConstObjectMacroImpl(, , name, type)
1344#define itkGetConstObjectMacro(name, type) ITK_DETAIL_GetConstObjectMacroImpl(virtual, , name, type)
1349#if defined(ITK_FUTURE_LEGACY_REMOVE)
1356# define ITK_DETAIL_GetObjectMacroImpl(virtualKeyword, finalKeyword, name, type) \
1357 virtualKeyword type * Get##name() finalKeyword \
1359 purposeful_error("itkGetObjectMacro should be replaced with itkGetModifiableObjectMacro."); \
1361 ITK_MACROEND_NOOP_STATEMENT
1364# define ITK_DETAIL_GetModifiableObjectMacroImpl(virtualKeyword, finalKeyword, name, type) \
1365 virtualKeyword type * GetModifiable##name() finalKeyword { return this->m_##name.GetPointer(); } \
1366 ITK_DETAIL_GetConstObjectMacroImpl(virtualKeyword, finalKeyword, name, type)
1370# define ITK_DETAIL_GetObjectMacroImpl(virtualKeyword, finalKeyword, name, type) \
1371 virtualKeyword type * Get##name() finalKeyword { return this->m_##name.GetPointer(); } \
1372 ITK_MACROEND_NOOP_STATEMENT
1375# define ITK_DETAIL_GetModifiableObjectMacroImpl(virtualKeyword, finalKeyword, name, type) \
1376 virtualKeyword type * GetModifiable##name() finalKeyword { return this->m_##name.GetPointer(); } \
1377 ITK_DETAIL_GetConstObjectMacroImpl(virtualKeyword, finalKeyword, name, type); \
1378 ITK_DETAIL_GetObjectMacroImpl(virtualKeyword, finalKeyword, name, type)
1386#define itkVirtualGetObjectMacro(name, type) ITK_DETAIL_GetObjectMacroImpl(virtual, , name, type)
1387#define itkFinalGetObjectMacro(name, type) ITK_DETAIL_GetObjectMacroImpl(, final, name, type)
1388#define itkNonVirtualGetObjectMacro(name, type) ITK_DETAIL_GetObjectMacroImpl(, , name, type)
1389#define itkGetObjectMacro(name, type) ITK_DETAIL_GetObjectMacroImpl(virtual, , name, type)
1391#define itkVirtualGetModifiableObjectMacro(name, type) ITK_DETAIL_GetModifiableObjectMacroImpl(virtual, , name, type)
1392#define itkFinalGetModifiableObjectMacro(name, type) ITK_DETAIL_GetModifiableObjectMacroImpl(, final, name, type)
1393#define itkNonVirtualGetModifiableObjectMacro(name, type) ITK_DETAIL_GetModifiableObjectMacroImpl(, , name, type)
1394#define itkGetModifiableObjectMacro(name, type) ITK_DETAIL_GetModifiableObjectMacroImpl(virtual, , name, type)
1403#define ITK_DETAIL_GetConstReferenceObjectMacroImpl(virtualKeyword, finalKeyword, name, type) \
1404 virtualKeyword const typename type::Pointer & Get##name() const finalKeyword { return this->m_##name; } \
1405 ITK_MACROEND_NOOP_STATEMENT
1410#define itkVirtualGetConstReferenceObjectMacro(name, type) \
1411 ITK_DETAIL_GetConstReferenceObjectMacroImpl(virtual, , name, type)
1412#define itkFinalGetConstReferenceObjectMacro(name, type) \
1413 ITK_DETAIL_GetConstReferenceObjectMacroImpl(, final, name, type)
1414#define itkNonVirtualGetConstReferenceObjectMacro(name, type) \
1415 ITK_DETAIL_GetConstReferenceObjectMacroImpl(, , name, type)
1416#define itkGetConstReferenceObjectMacro(name, type) ITK_DETAIL_GetConstReferenceObjectMacroImpl(virtual, , name, type)
1421#define ITK_DETAIL_SetConstObjectMacroImpl(virtualKeyword, finalKeyword, name, type) \
1422 virtualKeyword void Set##name(const type * _arg) finalKeyword \
1424 itkDebugMacro("setting " << #name " to " << _arg); \
1425 if (this->m_##name != _arg) \
1427 this->m_##name = _arg; \
1431 ITK_MACROEND_NOOP_STATEMENT
1436#define itkVirtualSetConstObjectMacro(name, type) ITK_DETAIL_SetConstObjectMacroImpl(virtual, , name, type)
1437#define itkFinalSetConstObjectMacro(name, type) ITK_DETAIL_SetConstObjectMacroImpl(, final, name, type)
1438#define itkNonVirtualSetConstObjectMacro(name, type) ITK_DETAIL_SetConstObjectMacroImpl(, , name, type)
1439#define itkSetConstObjectMacro(name, type) ITK_DETAIL_SetConstObjectMacroImpl(virtual, , name, type)
1442#define ITK_DETAIL_BooleanMacroImpl(virtualKeyword, finalKeyword, name) \
1443 virtualKeyword void name##On() finalKeyword { this->Set##name(true); } \
1444 virtualKeyword void name##Off() finalKeyword { this->Set##name(false); } \
1445 ITK_MACROEND_NOOP_STATEMENT
1450#define itkVirtualBooleanMacro(name) ITK_DETAIL_BooleanMacroImpl(virtual, , name)
1451#define itkFinalBooleanMacro(name) ITK_DETAIL_BooleanMacroImpl(, final, name)
1452#define itkNonVirtualBooleanMacro(name) ITK_DETAIL_BooleanMacroImpl(, , name)
1453#define itkBooleanMacro(name) ITK_DETAIL_BooleanMacroImpl(virtual, , name)
1464template <
typename MemberContainerType,
typename CopyFromValueType,
typename LoopEndType>
1466ContainerFillWithCheck(MemberContainerType & m,
const CopyFromValueType & c,
const LoopEndType N)
1468 bool value_updated =
false;
1469 for (
unsigned int i = 0; i < N; ++i)
1472 ITK_GCC_SUPPRESS_Wfloat_equal
1476 value_updated =
true;
1480 return value_updated;
1491template <
typename MemberContainerType,
typename CopyFromContainerType,
typename LoopEndType>
1493ContainerCopyWithCheck(MemberContainerType & m,
const CopyFromContainerType & c,
const LoopEndType N)
1495 bool value_updated =
false;
1496 for (LoopEndType i = 0; i < N; ++i)
1499 ITK_GCC_SUPPRESS_Wfloat_equal
1503 value_updated =
true;
1507 return value_updated;
1512#define ITK_DETAIL_SetVectorMacroImpl(virtualKeyword, finalKeyword, name, type, count) \
1513 virtualKeyword void Set##name(type data[]) finalKeyword \
1515 if (ContainerCopyWithCheck(this->m_##name, data, count)) \
1520 ITK_MACROEND_NOOP_STATEMENT
1527#define itkVirtualSetVectorMacro(name, type, count) ITK_DETAIL_SetVectorMacroImpl(virtual, , name, type, count)
1528#define itkFinalSetVectorMacro(name, type, count) ITK_DETAIL_SetVectorMacroImpl(, final, name, type, count)
1529#define itkNonVirtualSetVectorMacro(name, type, count) ITK_DETAIL_SetVectorMacroImpl(, , name, type, count)
1530#define itkSetVectorMacro(name, type, count) ITK_DETAIL_SetVectorMacroImpl(virtual, , name, type, count)
1535#define ITK_DETAIL_GetVectorMacroImpl(virtualKeyword, finalKeyword, name, type, count) \
1536 virtualKeyword type * Get##name() const finalKeyword { return this->m_##name; } \
1537 ITK_MACROEND_NOOP_STATEMENT
1541#define itkVirtualGetVectorMacro(name, type, count) ITK_DETAIL_GetVectorMacroImpl(virtual, , name, type, count)
1542#define itkFinalGetVectorMacro(name, type, count) ITK_DETAIL_GetVectorMacroImpl(, final, name, type, count)
1543#define itkNonVirtualGetVectorMacro(name, type, count) ITK_DETAIL_GetVectorMacroImpl(, , name, type, count)
1544#define itkGetVectorMacro(name, type, count) ITK_DETAIL_GetVectorMacroImpl(virtual, , name, type, count)
1551#define itkGPUKernelClassMacro(kernel) class itkGPUKernelMacro(kernel)
1559#define itkGPUKernelMacro(kernel) \
1563 ITK_DISALLOW_COPY_AND_MOVE(kernel); \
1564 kernel() = delete; \
1565 ~kernel() = delete; \
1566 static const char * GetOpenCLSource(); \
1569#define itkGetOpenCLSourceFromKernelMacro(kernel) \
1570 static const char * GetOpenCLSource() { return kernel::GetOpenCLSource(); } \
1571 ITK_MACROEND_NOOP_STATEMENT
1575#define itkPrintSelfObjectMacro(name) \
1576 if (static_cast<const LightObject *>(this->m_##name) == nullptr) \
1578 os << indent << #name << ": (null)" << std::endl; \
1582 os << indent << #name << ": " << std::endl; \
1583 this->m_##name->Print(os, indent.GetNextIndent()); \
1585 ITK_MACROEND_NOOP_STATEMENT
1590#define itkPrintSelfBooleanMacro(name) \
1591 os << indent << #name << ": " << (this->m_##name ? "On" : "Off") << std::endl; \
1592 ITK_MACROEND_NOOP_STATEMENT
1597#define ITK_DETAIL_SetDecoratedOutputMacroImpl(virtualKeyword, finalKeyword, name, type) \
1598 virtualKeyword void Set##name##Output(const SimpleDataObjectDecorator<type> * _arg) finalKeyword \
1600 itkDebugMacro("setting output " #name " to " << _arg); \
1601 if (_arg != itkDynamicCastInDebugMode<SimpleDataObjectDecorator<type> *>(this->ProcessObject::GetOutput(#name))) \
1603 this->ProcessObject::SetOutput(#name, const_cast<SimpleDataObjectDecorator<type> *>(_arg)); \
1607 virtualKeyword void Set##name(const type & _arg) finalKeyword \
1609 using DecoratorType = SimpleDataObjectDecorator<type>; \
1610 itkDebugMacro("setting output " #name " to " << _arg); \
1611 DecoratorType * output = itkDynamicCastInDebugMode<DecoratorType *>(this->ProcessObject::GetOutput(#name)); \
1614 if (output->Get() == _arg) \
1620 output->Set(_arg); \
1625 auto newOutput = DecoratorType::New(); \
1626 newOutput->Set(_arg); \
1627 this->Set##name##Output(newOutput); \
1630 ITK_MACROEND_NOOP_STATEMENT
1634#define itkVirtualSetDecoratedOutputMacro(name, type) ITK_DETAIL_SetDecoratedOutputMacroImpl(virtual, , name, type)
1635#define itkFinalSetDecoratedOutputMacro(name, type) ITK_DETAIL_SetDecoratedOutputMacroImpl(, final, name, type)
1636#define itkNonVirtualSetDecoratedOutputMacro(name, type) ITK_DETAIL_SetDecoratedOutputMacroImpl(, , name, type)
1637#define itkSetDecoratedOutputMacro(name, type) ITK_DETAIL_SetDecoratedOutputMacroImpl(virtual, , name, type)
1642#define ITK_DETAIL_GetDecoratedOutputMacroImpl(virtualKeyword, finalKeyword, name, type) \
1643 virtualKeyword const SimpleDataObjectDecorator<type> * Get##name##Output() const finalKeyword \
1645 itkDebugMacro("returning output " << #name " of " << this->ProcessObject::GetOutput(#name)); \
1646 return itkDynamicCastInDebugMode<const SimpleDataObjectDecorator<type> *>(this->ProcessObject::GetOutput(#name)); \
1648 virtualKeyword const type & Get##name() const finalKeyword \
1650 itkDebugMacro("Getting output " #name); \
1651 using DecoratorType = SimpleDataObjectDecorator<type>; \
1652 const DecoratorType * output = \
1653 itkDynamicCastInDebugMode<const DecoratorType *>(this->ProcessObject::GetOutput(#name)); \
1654 if (output == nullptr) \
1656 itkExceptionStringMacro("output" #name " is not set"); \
1658 return output->Get(); \
1660 ITK_MACROEND_NOOP_STATEMENT
1664#define itkVirtualGetDecoratedOutputMacro(name, type) ITK_DETAIL_GetDecoratedOutputMacroImpl(virtual, , name, type)
1665#define itkFinalGetDecoratedOutputMacro(name, type) ITK_DETAIL_GetDecoratedOutputMacroImpl(, final, name, type)
1666#define itkNonVirtualGetDecoratedOutputMacro(name, type) ITK_DETAIL_GetDecoratedOutputMacroImpl(, , name, type)
1667#define itkGetDecoratedOutputMacro(name, type) ITK_DETAIL_GetDecoratedOutputMacroImpl(virtual, , name, type)
1671#if defined(ITK_LEGACY_REMOVE) && !defined(ITK_LEGACY_SILENT)
1672# define ITK_FUTURE_DEPRECATED(message) [[deprecated(message)]]
1674# define ITK_FUTURE_DEPRECATED(message)
1677#if __cplusplus >= 202002L
1678# define ITK_NODISCARD(message) [[nodiscard(message)]]
1680# define ITK_NODISCARD(message) [[nodiscard]]
1685#if defined(ITK_LEGACY_REMOVE)
1686# define itkExposeEnumValue(name) \
1687 static_assert(false, "ERROR: Replace static_cast<int>(name) with with proper enumeration instead of integer")
1689# define ITK_NOEXCEPT_OR_THROW static_assert(false, "Replace ITK_NOEXCEPT_OR_THROW with ITK_NOEXCEPT")
1691# define ITK_DELETE_FUNCTION static_assert(false, "ERROR: ITK_DELETE_FUNCTION must be replaced with `= delete`"
1692# define ITK_CONSTEXPR_FUNC static_assert(false, "ERROR: ITK_CONSTEXPR_FUNC must be replaced with 'constexpr'")
1693# define ITK_CONSTEXPR_VAR static_assert(false, "ERROR: ITK_CONSTEXPR_VAR must be replaced with 'constexpr'")
1695# define ITK_FALLTHROUGH static_assert(false, "ERROR: ITK_FALLTHROUGH must be replaced with '[[fallthrough]]'")
1698# define ITK_ALIGNAS static_assert(false, "ERROR: ITK_ALIGNAS must be replaced with 'alignas'")
1699# define ITK_ALIGNOF static_assert(false, "ERROR: ITK_ALIGNOF must be replaced with 'alignof'")
1700# define ITK_DEPRECATED static_assert(false, "ERROR: ITK_DEPRECATED must be replaced with '[[deprecated]]'")
1701# define ITK_DEPRECATED_MSG \
1702 static_assert(false, "ERROR: ITK_DEPRECATED_MSG must be replaced with '[[deprecated(MSG)]]'")
1703# define ITK_CONSTEXPR static_assert(false, "ERROR: ITK_CONSTEXPR must be replaced with 'constexpr'")
1704# define ITK_DELETED_FUNCTION static_assert(false, "ERROR: ITK_DELETED_FUNCTION must be replaced with '= delete'")
1705# define ITK_EXTERN_TEMPLATE static_assert(false, "ERROR: ITK_EXTERN_TEMPLATE must be replaced with 'extern'")
1706# define ITK_FINAL static_assert(false, "ERROR: ITK_FINAL must be replaced with 'final'")
1707# define ITK_NOEXCEPT static_assert(false, "ERROR: ITK_NOEXCEPT must be replaced with 'noexcept'")
1708# define ITK_NOEXCEPT_EXPR static_assert(false, "ERROR: ITK_NOEXCEPT_EXPR must be replaced with 'noexcept'")
1709# define ITK_NULLPTR static_assert(false, "ERROR: ITK_NULLPTR must be replaced with 'nullptr'")
1710# define ITK_OVERRIDE static_assert(false, "ERROR: ITK_OVERRIDE must be replaced with 'override'")
1711# define ITK_STATIC_ASSERT static_assert(false, "ERROR: ITK_STATIC_ASSERT must be replaced with 'static_assert'")
1712# define ITK_STATIC_ASSERT_MSG \
1713 static_assert(false, "ERROR: ITK_STATIC_ASSERT_MSG must be replaced with 'static_assert'")
1714# define ITK_THREAD_LOCAL static_assert(false, "ERROR: ITK_THREAD_LOCAL must be replaced with 'thread_local'")
1717# define ITKv5_CONST static_assert(false, "ERROR: ITKv5_CONST must be replaced with 'const'")
1719# define ITK_ITERATOR_VIRTUAL static_assert(false, "ERROR: ITK_ITERATOR_VIRTUAL must be removed'")
1720# define ITK_ITERATOR_OVERRIDE static_assert(false, "ERROR: ITK_ITERATOR_OVERRIDE must be removed")
1721# define ITK_ITERATOR_FINAL static_assert(false, "ERROR: ITK_ITERATOR_FINAL must be removed")
1730# define itkExposeEnumValue(name) static_cast<int>(name)
1733# define ITK_NOEXCEPT_OR_THROW ITK_NOEXCEPT
1735# define ITK_FALLTHROUGH [[fallthrough]]
1737# define ITK_DELETE_FUNCTION = delete
1739# define ITK_CONSTEXPR_FUNC constexpr
1740# define ITK_CONSTEXPR_VAR constexpr
1743# define ITK_ALIGNAS(X) alignas(X)
1744# define ITK_ALIGNOF(X) alignof(X)
1745# define ITK_DEPRECATED [[deprecated]]
1746# define ITK_DEPRECATED_MSG(MSG) [[deprecated(MSG)]]
1747# define ITK_CONSTEXPR constexpr
1748# define ITK_DELETED_FUNCTION = delete
1749# define ITK_EXTERN_TEMPLATE extern
1750# define ITK_FINAL final
1751# define ITK_NOEXCEPT noexcept
1752# define ITK_NOEXCEPT_EXPR(X) noexcept(X)
1753# define ITK_NULLPTR nullptr
1754# define ITK_OVERRIDE override
1755# define ITK_STATIC_ASSERT(X) static_assert(X, #X)
1756# define ITK_STATIC_ASSERT_MSG(X, MSG) static_assert(X, MSG)
1757# define ITK_THREAD_LOCAL thread_local
1760# define ITKv5_CONST const
1762# define ITK_ITERATOR_VIRTUAL
1763# define ITK_ITERATOR_OVERRIDE
1764# define ITK_ITERATOR_FINAL
1767#define allow_inclusion_of_itkExceptionObject_h
1773#undef allow_inclusion_of_itkExceptionObject_h
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....