Skip to content

Commit e919e91

Browse files
committed
ENH: Add protected helper function, ProcessObject::SetRequiredOutputs
1 parent 8e5abbd commit e919e91

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

Modules/Core/Common/include/itkProcessObject.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -926,6 +926,20 @@ class ITKCommon_EXPORT ProcessObject : public Object
926926
return static_cast<uint32_t>(temp);
927927
};
928928

929+
930+
/** Sets the required number of outputs, and creates each of them by MakeOutput. */
931+
template <typename TSourceObject>
932+
static void
933+
SetRequiredOutputs(TSourceObject & sourceObject, const DataObjectPointerArraySizeType numberOfRequiredOutputs)
934+
{
935+
sourceObject.ProcessObject::SetNumberOfRequiredOutputs(numberOfRequiredOutputs);
936+
937+
for (unsigned int i{}; i < numberOfRequiredOutputs; ++i)
938+
{
939+
sourceObject.ProcessObject::SetNthOutput(i, sourceObject.TSourceObject::MakeOutput(i));
940+
}
941+
}
942+
929943
/** These ivars are made protected so filters like itkStreamingImageFilter
930944
* can access them directly. */
931945

0 commit comments

Comments
 (0)