42 #include "itkConfigure.h"
43 #include "ITKCommonExport.h"
73 # define ITK_NOOP_STATEMENT do {} while(0)
81 #define ITK_PRAGMA(x) _Pragma(#x)
87 #if defined(__clang__) && defined(__has_warning)
88 # define CLANG_PRAGMA_PUSH ITK_PRAGMA(clang diagnostic push)
89 # define CLANG_PRAGMA_POP ITK_PRAGMA(clang diagnostic pop)
90 # if __has_warning("-Wfloat-equal")
91 # define CLANG_SUPPRESS_Wfloat_equal ITK_PRAGMA(clang diagnostic ignored "-Wfloat-equal")
93 # define CLANG_SUPPRESS_Wfloat_equal
95 # if __has_warning("-Wc++14-extensions")
96 # define CLANG_SUPPRESS_Wc__14_extensions ITK_PRAGMA(clang diagnostic ignored "-Wc++14-extensions")
98 # define CLANG_SUPPRESS_Wc__14_extensions
101 # define CLANG_PRAGMA_PUSH
102 # define CLANG_PRAGMA_POP
103 # define CLANG_SUPPRESS_Wfloat_equal
104 # define CLANG_SUPPRESS_Wc__14_extensions
108 #if defined(__INTEL_COMPILER)
109 # define INTEL_PRAGMA_WARN_PUSH ITK_PRAGMA(warning push)
110 # define INTEL_PRAGMA_WARN_POP ITK_PRAGMA(warning pop)
111 # define INTEL_SUPPRESS_warning_1292 ITK_PRAGMA(warning disable 1292)
113 # define INTEL_PRAGMA_WARN_PUSH
114 # define INTEL_PRAGMA_WARN_POP
115 # define INTEL_SUPPRESS_warning_1292
126 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
127 # define ITK_GCC_PRAGMA_DIAG(x) ITK_PRAGMA(GCC diagnostic x)
128 # define ITK_GCC_PRAGMA_DIAG_PUSH() ITK_GCC_PRAGMA_DIAG(push)
129 # define ITK_GCC_PRAGMA_DIAG_POP() ITK_GCC_PRAGMA_DIAG(pop)
131 # define ITK_GCC_PRAGMA_DIAG(x)
132 # define ITK_GCC_PRAGMA_DIAG_PUSH()
133 # define ITK_GCC_PRAGMA_DIAG_POP()
148 #if defined(_MSC_VER) && (_MSC_VER < 1900)
149 # error "Visual Studio < 2015 is not supported under ITKv5"
151 #if defined(__SUNPRO_CC) && (__SUNPRO_CC < 0x5140)
152 # error "SUNPro C++ < 5.14.0 is not supported under ITKv5 and above"
154 #if defined(__CYGWIN__)
155 # error "The Cygwin compiler is not supported in ITKv4 and above"
157 #if defined(__BORLANDC__)
158 # error "The Borland C compiler is not supported in ITKv4 and above"
160 #if defined(__MWERKS__)
161 # error "The MetroWerks compiler is not supported in ITKv4 and above"
163 #if defined(__GNUC__) && !defined(__clang__) && !defined(__INTEL_COMPILER) && \
164 ((__GNUC__ < 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ < 8)))
165 # error "GCC < 4.8 is not supported under ITKv5"
171 # error "The SGI compiler is not supported under ITKv4 and above"
173 #if defined(__APPLE__)
174 # if defined(__clang__) && (__cplusplus < 201103L)
175 # error "Apple LLVM < 5.0 (clang < 3.3) is not supported under ITKv5"
177 #elif defined(__clang__) && ((__clang_major__ < 3) || ((__clang_major__ == 3) && (__clang_minor__ < 3)))
178 # error "Clang < 3.3 is not supported under ITKv5"
180 #if defined(__INTEL_COMPILER) && (__INTEL_COMPILER < 1504)
181 # error "Intel C++ < 15.0.4 is not supported under ITKv5"
185 #if defined(_WIN32) || defined(WIN32)
186 # define ITK_ABI_IMPORT __declspec(dllimport)
187 # define ITK_ABI_EXPORT __declspec(dllexport)
188 # define ITK_ABI_HIDDEN
191 # define ITK_ABI_IMPORT __attribute__((visibility("default")))
192 # define ITK_ABI_EXPORT __attribute__((visibility("default")))
193 # define ITK_ABI_HIDDEN __attribute__((visibility("hidden")))
195 # define ITK_ABI_IMPORT
196 # define ITK_ABI_EXPORT
197 # define ITK_ABI_HIDDEN
202 #ifndef ITK_TEMPLATE_EXPORT
203 # ifdef ITK_TEMPLATE_VISIBILITY_DEFAULT
204 # define ITK_TEMPLATE_EXPORT __attribute__((visibility("default")))
206 # define ITK_TEMPLATE_EXPORT
211 #ifdef ITK_TEMPLATE_VISIBILITY_DEFAULT
212 # define ITK_FORCE_EXPORT_MACRO(moduleName) __attribute__((visibility("default")))
214 # define ITK_FORCE_EXPORT_MACRO(moduleName) moduleName##_EXPORT
217 #ifndef ITK_FORWARD_EXPORT
219 # if defined(__APPLE__) && defined(ITK_TEMPLATE_VISIBILITY_DEFAULT) && defined(ITK_BUILD_SHARED_LIBS) && \
220 defined(USE_COMPILER_HIDDEN_VISIBILITY)
221 # define ITK_FORWARD_EXPORT __attribute__((visibility("default")))
223 # define ITK_FORWARD_EXPORT
231 #define ITK_NOEXCEPT_OR_THROW error "Replace ITK_NOEXCEPT_OR_THROW with ITK_NOEXCEPT"
233 #if !defined(ITK_LEGACY_REMOVE)
234 # define ITK_DELETE_FUNCTION = delete
236 # define ITK_DELETE_FUNCTION error "Replace ITK_DELETE_FUNCTION with = delete"
243 #if defined(ITK_FUTURE_LEGACY_REMOVE)
244 # define ITK_CONSTEXPR_FUNC "Replace ITK_CONSTEXPR_FUNC with constexpr"
245 # define ITK_CONSTEXPR_VAR "Replace ITK_CONSTEXPR_VAR with constexpr"
247 # define itkExposeEnumValue(name) static_cast<int>(name)
251 # define ITK_CONSTEXPR_FUNC constexpr
252 # define ITK_CONSTEXPR_VAR constexpr
255 # define itkExposeEnumValue(name) static_cast<int>(name)
260 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
262 # define ITK_FALLTHROUGH __attribute__((fallthrough))
264 #elif defined(__has_warning)
265 # if __has_feature(cxx_attributes) && __has_warning("-Wimplicit-fallthrough")
266 # define ITK_FALLTHROUGH [[clang::fallthrough]]
270 #ifndef ITK_FALLTHROUGH
271 # define ITK_FALLTHROUGH ((void)0)
294 #define itkNewMacro(x) itkSimpleNewMacro(x) itkCreateAnotherMacro(x) itkCloneMacro(x)
296 #define itkSimpleNewMacro(x) \
297 static Pointer New() \
299 Pointer smartPtr = ::itk::ObjectFactory<x>::Create(); \
300 if (smartPtr == nullptr) \
304 smartPtr->UnRegister(); \
308 #define itkCreateAnotherMacro(x) \
309 ::itk::LightObject::Pointer CreateAnother() const override \
311 ::itk::LightObject::Pointer smartPtr; \
312 smartPtr = x::New().GetPointer(); \
316 #define itkCloneMacro(x) \
317 Pointer Clone() const \
319 Pointer rval = dynamic_cast<x *>(this->InternalClone().GetPointer()); \
335 #define itkFactorylessNewMacro(x) \
336 static Pointer New() \
339 x * rawPtr = new x; \
341 rawPtr->UnRegister(); \
344 ::itk::LightObject::Pointer CreateAnother() const override \
346 ::itk::LightObject::Pointer smartPtr; \
347 smartPtr = x::New().GetPointer(); \
361 #define ITK_DISALLOW_COPY_AND_ASSIGN(TypeName) \
362 TypeName(const TypeName &) = delete; \
363 TypeName & operator=(const TypeName &) = delete; \
364 TypeName(TypeName &&) = delete; \
365 TypeName & operator=(TypeName &&) = delete
369 #define itkTypeMacro(thisClass, superclass) \
370 const char * GetNameOfClass() const override { return #thisClass; }
372 #define itkTypeMacroNoParent(thisClass) \
373 virtual const char * GetNameOfClass() const { return #thisClass; }
383 extern ITKCommon_EXPORT
void
384 OutputWindowDisplayText(
const char *);
387 extern ITKCommon_EXPORT
void
388 OutputWindowDisplayErrorText(
const char *);
390 extern ITKCommon_EXPORT
void
391 OutputWindowDisplayWarningText(
const char *);
393 extern ITKCommon_EXPORT
void
394 OutputWindowDisplayGenericOutputText(
const char *);
396 extern ITKCommon_EXPORT
void
397 OutputWindowDisplayDebugText(
const char *);
405 # define itkDebugMacro(x) ITK_NOOP_STATEMENT
406 # define itkDebugStatement(x) ITK_NOOP_STATEMENT
408 # define itkDebugMacro(x) \
411 if (this->GetDebug() && ::itk::Object::GetGlobalWarningDisplay()) \
413 std::ostringstream itkmsg; \
414 itkmsg << "Debug: In " __FILE__ ", line " << __LINE__ << "\n" \
415 << this->GetNameOfClass() << " (" << this << "): " x << "\n\n"; \
416 ::itk::OutputWindowDisplayDebugText(itkmsg.str().c_str()); \
423 # define itkDebugStatement(x) x
429 #define itkWarningMacro(x) \
432 if (::itk::Object::GetGlobalWarningDisplay()) \
434 std::ostringstream itkmsg; \
435 itkmsg << "WARNING: In " __FILE__ ", line " << __LINE__ << "\n" \
436 << this->GetNameOfClass() << " (" << this << "): " x << "\n\n"; \
437 ::itk::OutputWindowDisplayWarningText(itkmsg.str().c_str()); \
442 #define itkWarningStatement(x) x
444 #if defined(ITK_CPP_FUNCTION)
445 # if defined(_WIN32) && !defined(__MINGW32__) && !defined(ITK_WRAPPING_PARSER)
446 # define ITK_LOCATION __FUNCSIG__
447 # elif defined(__GNUC__)
448 # define ITK_LOCATION __PRETTY_FUNCTION__
450 # define ITK_LOCATION __FUNCTION__
453 # define ITK_LOCATION "unknown"
456 #define itkDeclareExceptionMacro(newexcp, parentexcp, whatmessage) \
459 class newexcp : public parentexcp \
463 static constexpr const char * const default_exception_message = whatmessage; \
464 explicit newexcp(const char * file, \
465 unsigned int lineNumber = 0, \
466 const char * desc = "None", \
467 const char * loc = "Unknown") \
468 : parentexcp(std::string{ file }, lineNumber, std::string{ desc }, std::string{ loc }) \
470 explicit newexcp(std::string file, \
471 unsigned int lineNumber = 0, \
472 std::string desc = std::string{ "None" }, \
473 std::string loc = std::string{ "Unknown" }) \
474 : parentexcp(std::move(file), lineNumber, std::move(desc), std::move(loc)) \
476 itkTypeMacro(newexcp, parentexcp); \
481 #define itkSpecializedMessageExceptionMacro(ExceptionType, x) \
483 std::ostringstream message; \
484 message << "itk::ERROR: " x; \
485 throw ::itk::ExceptionType( \
486 std::string{ __FILE__ }, __LINE__, std::string{ message.str() }, std::string{ ITK_LOCATION }); \
489 #define itkSpecializedExceptionMacro(ExceptionType) \
491 itkSpecializedMessageExceptionMacro(ExceptionType, \
492 "itk::ERROR: " << ::itk::ExceptionType::default_exception_message) \
498 #define itkExceptionMacro(x) \
500 itkSpecializedMessageExceptionMacro(ExceptionObject, \
501 "itk::ERROR: " << this->GetNameOfClass() << "(" << this << "): " x); \
505 #define itkGenericExceptionMacro(x) \
507 itkSpecializedMessageExceptionMacro(ExceptionObject, x); \
510 #define itkGenericOutputMacro(x) \
512 if (::itk::Object::GetGlobalWarningDisplay()) \
514 std::ostringstream itkmsg; \
515 itkmsg << "WARNING: In " __FILE__ ", line " << __LINE__ << "\n" x << "\n\n"; \
516 ::itk::OutputWindowDisplayGenericOutputText(itkmsg.str().c_str()); \
523 #define itkLogMacro(x, y) \
525 if (this->GetLogger()) \
527 this->GetLogger()->Write(::itk::LoggerBase::x, y); \
531 #define itkLogMacroStatic(obj, x, y) \
533 if (obj->GetLogger()) \
535 obj->GetLogger()->Write(::itk::LoggerBase::x, y); \
568 #if defined(ITK_LEGACY_REMOVE)
569 # define itkLegacyMacro(method)
571 # if defined(ITK_LEGACY_SILENT) || defined(ITK_LEGACY_TEST)
573 # define itkLegacyMacro(method) method
577 # if defined(__GNUC__) && !defined(__INTEL_COMPILER)
578 # define itkLegacyMacro(method) method __attribute__((deprecated))
579 # elif defined(_MSC_VER)
580 # define itkLegacyMacro(method) __declspec(deprecated) method
582 # define itkLegacyMacro(method) method
609 #if defined(ITK_LEGACY_SILENT)
610 # define itkLegacyBodyMacro(method, version) ITK_NOOP_STATEMENT
611 # define itkLegacyReplaceBodyMacro(method, version, replace) ITK_NOOP_STATEMENT
612 # define itkGenericLegacyBodyMacro(method, version) ITK_NOOP_STATEMENT
613 # define itkGenericLegacyReplaceBodyMacro(method, version, replace) ITK_NOOP_STATEMENT
615 # define itkLegacyBodyMacro(method, version) \
616 itkWarningMacro(#method " was deprecated for ITK " #version " and will be removed in a future version.")
617 # define itkLegacyReplaceBodyMacro(method, version, replace) \
618 itkWarningMacro(#method " was deprecated for ITK " #version \
619 " and will be removed in a future version. Use " #replace " instead.")
620 # define itkGenericLegacyBodyMacro(method, version) \
621 itkGenericOutputMacro(#method " was deprecated for ITK " #version " and will be removed in a future version.")
622 # define itkGenericLegacyReplaceBodyMacro(method, version, replace) \
623 itkGenericOutputMacro(#method " was deprecated for ITK " #version \
624 " and will be removed in a future version. Use " #replace " instead.")
631 #define ITK_CACHE_LINE_ALIGNMENT 64
639 #define itkPadStruct(mincachesize, oldtype, newtype) \
640 struct newtype : public oldtype \
642 char _StructPadding[mincachesize - (sizeof(oldtype) % mincachesize)]; \
649 #if defined(ITK_HAS_GNU_ATTRIBUTE_ALIGNED)
650 # define itkAlignedTypedef(alignment, oldtype, newtype) using newtype = oldtype __attribute__((aligned(alignment)))
651 #elif defined(_MSC_VER)
652 # define itkAlignedTypedef(alignment, oldtype, newtype) using newtype = __declspec(align(alignment)) oldtype
654 # define itkAlignedTypedef(alignment, oldtype, newtype) using newtype = oldtype
657 #if defined(ITK_FUTURE_LEGACY_REMOVE)
680 # define ITK_FRIEND_TEMPLATE_FUNCTION_ARGUMENT(T) < >
681 #else // LEGACY_REMOVE
682 # define ITK_FRIEND_TEMPLATE_FUNCTION_ARGUMENT(T) "Macro remove use C++11 compliant declaration of "
698 #define itkForLoopAssignmentMacro( \
699 DestinationType, SourceType, DestinationElementType, DestinationArray, SourceArray, NumberOfIterations) \
700 for (unsigned int i = 0; i < NumberOfIterations; ++i) \
702 DestinationArray[i] = static_cast<DestinationElementType>(SourceArray[i]); \
714 #define itkForLoopRoundingAndAssignmentMacro( \
715 DestinationType, Sourcrnd_halfintup, DestinationElementType, DestinationArray, SourceArray, NumberOfIterations) \
716 for (unsigned int i = 0; i < NumberOfIterations; ++i) \
718 DestinationArray[i] = itk::Math::Round<DestinationElementType>(SourceArray[i]); \
725 # ifdef _POSIX_SOURCE
726 # define itkAssertInDebugOrThrowInReleaseMacro(msg) __assert_fail(msg, __FILE__, __LINE__, __ASSERT_FUNCTION);
728 # define itkAssertInDebugOrThrowInReleaseMacro(msg) itkGenericExceptionMacro(<< msg);
732 # define itkAssertInDebugOrThrowInReleaseMacro(msg) itkGenericExceptionMacro(<< msg);
735 #define itkAssertOrThrowMacro(test, message) \
738 std::ostringstream msgstr; \
740 itkAssertInDebugOrThrowInReleaseMacro(msgstr.str().c_str()); \
744 # define itkAssertInDebugAndIgnoreInReleaseMacro(X) assert(X)
746 # define itkAssertInDebugAndIgnoreInReleaseMacro(X) ITK_NOOP_STATEMENT
769 #define itkStaticConstMacro(name, type, value) static constexpr type name = value
771 #define itkGetStaticConstMacro(name) (Self::name)
774 #define itkSetInputMacro(name, type) \
775 virtual void Set##name(const type * _arg) \
777 itkDebugMacro("setting input " #name " to " << _arg); \
778 if (_arg != itkDynamicCastInDebugMode<type *>(this->ProcessObject::GetInput(#name))) \
780 this->ProcessObject::SetInput(#name, const_cast<type *>(_arg)); \
787 #define itkGetInputMacro(name, type) \
788 virtual const type * Get##name() const \
790 itkDebugMacro("returning input " << #name " of " << this->ProcessObject::GetInput(#name)); \
791 return itkDynamicCastInDebugMode<const type *>(this->ProcessObject::GetInput(#name)); \
797 #define itkSetDecoratedInputMacro(name, type) \
798 virtual void Set##name##Input(const SimpleDataObjectDecorator<type> * _arg) \
800 itkDebugMacro("setting input " #name " to " << _arg); \
801 if (_arg != itkDynamicCastInDebugMode<SimpleDataObjectDecorator<type> *>(this->ProcessObject::GetInput(#name))) \
803 this->ProcessObject::SetInput(#name, const_cast<SimpleDataObjectDecorator<type> *>(_arg)); \
807 virtual void Set##name(const SimpleDataObjectDecorator<type> * _arg) { this->Set##name##Input(_arg); } \
808 virtual void Set##name(const type & _arg) \
810 using DecoratorType = SimpleDataObjectDecorator<type>; \
811 itkDebugMacro("setting input " #name " to " << _arg); \
812 const DecoratorType * oldInput = \
813 itkDynamicCastInDebugMode<const DecoratorType *>(this->ProcessObject::GetInput(#name)); \
815 CLANG_SUPPRESS_Wfloat_equal \
816 if (oldInput && oldInput->Get() == _arg) \
821 typename DecoratorType::Pointer newInput = DecoratorType::New(); \
822 newInput->Set(_arg); \
823 this->Set##name##Input(newInput); \
829 #define itkGetDecoratedInputMacro(name, type) \
830 virtual const SimpleDataObjectDecorator<type> * Get##name##Input() const \
832 itkDebugMacro("returning input " << #name " of " << this->ProcessObject::GetInput(#name)); \
833 return itkDynamicCastInDebugMode<const SimpleDataObjectDecorator<type> *>(this->ProcessObject::GetInput(#name)); \
835 virtual const type & Get##name() const \
837 itkDebugMacro("Getting input " #name); \
838 using DecoratorType = SimpleDataObjectDecorator<type>; \
839 const DecoratorType * input = \
840 itkDynamicCastInDebugMode<const DecoratorType *>(this->ProcessObject::GetInput(#name)); \
841 if (input == nullptr) \
843 itkExceptionMacro(<< "input" #name " is not set"); \
845 return input->Get(); \
851 #define itkSetGetDecoratedInputMacro(name, type) \
852 itkSetDecoratedInputMacro(name, type) itkGetDecoratedInputMacro(name, type)
858 #define itkSetDecoratedObjectInputMacro(name, type) \
859 virtual void Set##name##Input(const DataObjectDecorator<type> * _arg) \
861 itkDebugMacro("setting input " #name " to " << _arg); \
862 if (_arg != itkDynamicCastInDebugMode<DataObjectDecorator<type> *>(this->ProcessObject::GetInput(#name))) \
864 this->ProcessObject::SetInput(#name, const_cast<DataObjectDecorator<type> *>(_arg)); \
868 virtual void Set##name(const type * _arg) \
870 using DecoratorType = DataObjectDecorator<type>; \
871 itkDebugMacro("setting input " #name " to " << _arg); \
872 const DecoratorType * oldInput = \
873 itkDynamicCastInDebugMode<const DecoratorType *>(this->ProcessObject::GetInput(#name)); \
874 if (oldInput && oldInput->Get() == _arg) \
878 typename DecoratorType::Pointer newInput = DecoratorType::New(); \
879 newInput->Set(_arg); \
880 this->Set##name##Input(newInput); \
888 #define itkGetDecoratedObjectInputMacro(name, type) \
889 virtual const DataObjectDecorator<type> * Get##name##Input() const \
891 itkDebugMacro("returning input " << #name " of " << this->ProcessObject::GetInput(#name)); \
892 return itkDynamicCastInDebugMode<const DataObjectDecorator<type> *>(this->ProcessObject::GetInput(#name)); \
894 virtual const type * Get##name() const \
896 itkDebugMacro("Getting input " #name); \
897 using DecoratorType = DataObjectDecorator<type>; \
898 const DecoratorType * input = \
899 itkDynamicCastInDebugMode<const DecoratorType *>(this->ProcessObject::GetInput(#name)); \
900 if (input == nullptr) \
904 return input->Get(); \
910 #define itkSetGetDecoratedObjectInputMacro(name, type) \
911 itkSetDecoratedObjectInputMacro(name, type) itkGetDecoratedObjectInputMacro(name, type)
915 #define itkSetMacro(name, type) \
916 virtual void Set##name(const type _arg) \
918 itkDebugMacro("setting " #name " to " << _arg); \
920 CLANG_SUPPRESS_Wfloat_equal \
921 if (this->m_##name != _arg) \
923 this->m_##name = _arg; \
931 #define itkGetMacro(name, type) \
932 virtual type Get##name() { return this->m_##name; }
938 #define itkGetConstMacro(name, type) \
939 virtual type Get##name() const { return this->m_##name; }
946 #define itkGetConstReferenceMacro(name, type) \
947 virtual const type & Get##name() const { return this->m_##name; }
954 #define itkSetEnumMacro(name, type) \
955 virtual void Set##name(const type _arg) \
957 itkDebugMacro("setting " #name " to " << static_cast<long>(_arg)); \
958 if (this->m_##name != _arg) \
960 this->m_##name = _arg; \
970 #define itkGetEnumMacro(name, type) \
971 virtual type Get##name() const { return this->m_##name; }
977 #define itkSetStringMacro(name) \
978 virtual void Set##name(const char * _arg) \
980 if (_arg && (_arg == this->m_##name)) \
986 this->m_##name = _arg; \
990 this->m_##name = ""; \
994 virtual void Set##name(const std::string & _arg) { this->Set##name(_arg.c_str()); }
1001 #define itkGetStringMacro(name) \
1002 virtual const char * Get##name() const { return this->m_##name.c_str(); }
1008 #define itkSetClampMacro(name, type, min, max) \
1009 virtual void Set##name(type _arg) \
1011 const type temp_extrema = (_arg < min ? min : (_arg > max ? max : _arg)); \
1012 itkDebugMacro("setting " << #name " to " << _arg); \
1014 CLANG_SUPPRESS_Wfloat_equal \
1015 if (this->m_##name != temp_extrema) \
1017 this->m_##name = temp_extrema; \
1031 #define itkSetObjectMacro(name, type) \
1032 virtual void Set##name(type * _arg) \
1034 itkDebugMacro("setting " << #name " to " << _arg); \
1036 CLANG_SUPPRESS_Wfloat_equal \
1037 if (this->m_##name != _arg) \
1039 this->m_##name = _arg; \
1072 #define itkGetConstObjectMacro(name, type) \
1073 virtual const type * Get##name() const { return this->m_##name.GetPointer(); }
1076 #if defined(ITK_FUTURE_LEGACY_REMOVE)
1082 # define itkGetObjectMacro(name, type) \
1083 virtual type * Get##name() \
1085 purposeful_error("itkGetObjectMacro should be replaced with itkGetModifiableObjectMacro."); \
1088 # define itkGetModifiableObjectMacro(name, type) \
1089 virtual type * GetModifiable##name() { return this->m_##name.GetPointer(); } \
1090 itkGetConstObjectMacro(name, type)
1092 #else // defined ( ITK_FUTURE_LEGACY_REMOVE )
1095 # define itkGetObjectMacro(name, type) \
1096 virtual type * Get##name() { return this->m_##name.GetPointer(); }
1097 # define itkGetModifiableObjectMacro(name, type) \
1098 virtual type * GetModifiable##name() { return this->m_##name.GetPointer(); } \
1099 itkGetConstObjectMacro(name, type) itkGetObjectMacro(name, type)
1100 #endif // defined ( ITK_FUTURE_LEGACY_REMOVE )
1109 #define itkGetConstReferenceObjectMacro(name, type) \
1110 virtual const typename type::Pointer & Get##name() const { return this->m_##name; }
1116 #define itkSetConstObjectMacro(name, type) \
1117 virtual void Set##name(const type * _arg) \
1119 itkDebugMacro("setting " << #name " to " << _arg); \
1120 if (this->m_##name != _arg) \
1122 this->m_##name = _arg; \
1130 #define itkBooleanMacro(name) \
1131 virtual void name##On() { this->Set##name(true); } \
1132 virtual void name##Off() { this->Set##name(false); }
1139 #define itkSetVectorMacro(name, type, count) \
1140 virtual void Set##name(type data[]) \
1143 for (i = 0; i < count; i++) \
1146 CLANG_SUPPRESS_Wfloat_equal \
1147 if (data[i] != this->m_##name[i]) \
1156 for (i = 0; i < count; i++) \
1158 this->m_##name[i] = data[i]; \
1167 #define itkGetVectorMacro(name, type, count) \
1168 virtual type * Get##name() const { return this->m_##name; }
1174 #define itkGPUKernelClassMacro(kernel) \
1181 #define itkGPUKernelClassMacro(kernel) \
1182 * Workaround KWstyle bug \ \
1183 * \ingroup ITKCommon \ \
1188 static const char * \
1189 GetOpenCLSource(); \
1193 virtual ~kernel(); \
1194 kernel(const kernel &); \
1196 operator=(const kernel &); \
1200 #define itkGetOpenCLSourceFromKernelMacro(kernel) \
1201 static const char * GetOpenCLSource() { return kernel::GetOpenCLSource(); }
1205 #define itkPrintSelfObjectMacro(name) \
1206 if (static_cast<const LightObject *>(this->m_##name) == nullptr) \
1208 os << indent << #name << ": (null)" << std::endl; \
1212 os << indent << #name << ": " << std::endl; \
1213 this->m_##name->Print(os, indent.GetNextIndent()); \
1218 #define itkSetDecoratedOutputMacro(name, type) \
1219 virtual void Set##name##Output(const SimpleDataObjectDecorator<type> * _arg) \
1221 itkDebugMacro("setting output " #name " to " << _arg); \
1222 if (_arg != itkDynamicCastInDebugMode<SimpleDataObjectDecorator<type> *>(this->ProcessObject::GetOutput(#name))) \
1224 this->ProcessObject::SetOutput(#name, const_cast<SimpleDataObjectDecorator<type> *>(_arg)); \
1228 virtual void Set##name(const type & _arg) \
1230 using DecoratorType = SimpleDataObjectDecorator<type>; \
1231 itkDebugMacro("setting output " #name " to " << _arg); \
1232 DecoratorType * output = itkDynamicCastInDebugMode<DecoratorType *>(this->ProcessObject::GetOutput(#name)); \
1235 if (output->Get() == _arg) \
1241 output->Set(_arg); \
1246 typename DecoratorType::Pointer newOutput = DecoratorType::New(); \
1247 newOutput->Set(_arg); \
1248 this->Set##name##Output(newOutput); \
1254 #define itkGetDecoratedOutputMacro(name, type) \
1255 virtual const SimpleDataObjectDecorator<type> * Get##name##Output() const \
1257 itkDebugMacro("returning output " << #name " of " << this->ProcessObject::GetOutput(#name)); \
1258 return itkDynamicCastInDebugMode<const SimpleDataObjectDecorator<type> *>(this->ProcessObject::GetOutput(#name)); \
1260 virtual const type & Get##name() const \
1262 itkDebugMacro("Getting output " #name); \
1263 using DecoratorType = SimpleDataObjectDecorator<type>; \
1264 const DecoratorType * output = \
1265 itkDynamicCastInDebugMode<const DecoratorType *>(this->ProcessObject::GetOutput(#name)); \
1266 if (output == nullptr) \
1268 itkExceptionMacro(<< "output" #name " is not set"); \
1270 return output->Get(); \
1284 #if defined(ITKV4_COMPATIBILITY)
1285 # define ITK_ITERATOR_VIRTUAL virtual
1286 # define ITK_ITERATOR_OVERRIDE override
1287 # define ITK_ITERATOR_FINAL
1288 #elif !defined(ITK_LEGACY_REMOVE)
1289 # define ITK_ITERATOR_VIRTUAL virtual
1290 # define ITK_ITERATOR_OVERRIDE override
1291 # define ITK_ITERATOR_FINAL final
1293 # define ITK_ITERATOR_VIRTUAL
1294 # define ITK_ITERATOR_OVERRIDE
1295 # define ITK_ITERATOR_FINAL
1298 #if defined(ITKV4_COMPATIBILITY)
1300 # define ITKv5_CONST
1303 # define ITKv5_CONST const
1306 #define itkExceptionObject_h
1308 #undef itkExceptionObject_h