28 #ifndef itkProcessObject_h
29 #define itkProcessObject_h
44 class MultiThreaderBase;
164 using NameArray = std::vector<DataObjectIdentifierType>;
175 GetInputNames()
const;
179 GetRequiredInputNames()
const;
206 GetNumberOfInputs()
const;
210 GetNumberOfOutputs()
const;
218 GetOutputNames()
const;
250 GetNumberOfIndexedInputs()
const;
262 GetNumberOfValidRequiredInputs()
const;
270 GetNumberOfIndexedOutputs()
const;
295 itkSetMacro(AbortGenerateData,
bool);
298 itkGetConstReferenceMacro(AbortGenerateData,
bool);
301 itkBooleanMacro(AbortGenerateData);
311 #if !defined(ITK_LEGACY_REMOVE)
313 SetProgress(
float progress)
315 m_Progress = progressFloatToFixed(progress);
327 return progressFixedToFloat(m_Progress);
340 UpdateProgress(
float progress);
350 IncrementProgress(
float increment);
386 UpdateLargestPossibleRegion();
404 UpdateOutputInformation();
409 PropagateRequestedRegion(
DataObject * output);
453 virtual DataObjectPointer
454 MakeOutput(
const DataObjectIdentifierType &);
462 SetReleaseDataFlag(
bool val);
464 GetReleaseDataFlag()
const;
468 this->SetReleaseDataFlag(
true);
473 this->SetReleaseDataFlag(
false);
489 itkSetMacro(ReleaseDataBeforeUpdateFlag,
bool);
490 itkGetConstReferenceMacro(ReleaseDataBeforeUpdateFlag,
bool);
491 itkBooleanMacro(ReleaseDataBeforeUpdateFlag);
496 itkGetConstReferenceMacro(NumberOfWorkUnits,
ThreadIdType);
499 #if !defined(ITK_LEGACY_REMOVE) || defined(ITKV4_COMPATIBILITY)
500 itkLegacyMacro(
void SetNumberOfThreads(
ThreadIdType count)) { this->SetNumberOfWorkUnits(count); }
502 itkLegacyMacro(
ThreadIdType GetNumberOfThreads()
const) {
return this->GetNumberOfWorkUnits(); }
503 #endif // !ITK_LEGACY_REMOVE
509 return m_MultiThreader;
514 SetMultiThreader(MultiThreaderType * threader);
530 PrintSelf(std::ostream & os,
Indent indent)
const override;
541 GetInput(
const DataObjectIdentifierType & key);
543 GetInput(
const DataObjectIdentifierType & key)
const;
550 return idx < m_IndexedInputs.size() ? m_IndexedInputs[idx]->second.GetPointer() :
nullptr;
555 return idx < m_IndexedInputs.size() ? m_IndexedInputs[idx]->second.GetPointer() :
nullptr;
566 SetInput(
const DataObjectIdentifierType & key,
DataObject * input);
568 SetNthInput(DataObjectPointerArraySizeType idx,
DataObject * input);
598 RemoveInput(
const DataObjectIdentifierType & key);
599 virtual void RemoveInput(DataObjectPointerArraySizeType);
605 return m_IndexedInputs[0]->second;
610 return m_IndexedInputs[0]->second;
616 SetPrimaryInputName(
const DataObjectIdentifierType & key);
620 return this->m_IndexedInputs[0]->first.c_str();
635 SetNumberOfIndexedInputs(DataObjectPointerArraySizeType num);
646 virtual void SetNumberOfRequiredInputs(DataObjectPointerArraySizeType);
647 itkGetConstReferenceMacro(NumberOfRequiredInputs, DataObjectPointerArraySizeType);
655 RemoveRequiredInputName(
const DataObjectIdentifierType &);
659 IsRequiredInputName(
const DataObjectIdentifierType &)
const;
666 SetRequiredInputNames(
const NameArray &);
679 AddRequiredInputName(
const DataObjectIdentifierType &);
681 AddRequiredInputName(
const DataObjectIdentifierType &, DataObjectPointerArraySizeType idx);
694 AddOptionalInputName(
const DataObjectIdentifierType &);
696 AddOptionalInputName(
const DataObjectIdentifierType &, DataObjectPointerArraySizeType idx);
705 GetOutput(
const DataObjectIdentifierType & key);
707 GetOutput(
const DataObjectIdentifierType & key)
const;
712 SetPrimaryOutputName(
const DataObjectIdentifierType & key);
716 return this->m_IndexedOutputs[0]->first.c_str();
722 GetOutput(DataObjectPointerArraySizeType i);
724 GetOutput(DataObjectPointerArraySizeType i)
const;
729 SetOutput(
const DataObjectIdentifierType & name,
DataObject * output);
733 RemoveOutput(
const DataObjectIdentifierType & key);
739 return m_IndexedOutputs[0]->second;
744 return m_IndexedOutputs[0]->second;
755 SetNthOutput(DataObjectPointerArraySizeType idx,
DataObject * output);
761 RemoveOutput(DataObjectPointerArraySizeType idx);
763 itkSetMacro(NumberOfRequiredOutputs, DataObjectPointerArraySizeType);
764 itkGetConstReferenceMacro(NumberOfRequiredOutputs, DataObjectPointerArraySizeType);
768 SetNumberOfIndexedOutputs(DataObjectPointerArraySizeType num);
771 DataObjectIdentifierType
772 MakeNameFromInputIndex(DataObjectPointerArraySizeType idx)
const;
773 DataObjectIdentifierType
774 MakeNameFromOutputIndex(DataObjectPointerArraySizeType idx)
const;
775 DataObjectPointerArraySizeType
776 MakeIndexFromInputName(
const DataObjectIdentifierType & name)
const;
777 DataObjectPointerArraySizeType
778 MakeIndexFromOutputName(
const DataObjectIdentifierType & name)
const;
780 IsIndexedInputName(
const DataObjectIdentifierType &)
const;
782 IsIndexedOutputName(
const DataObjectIdentifierType &)
const;
800 VerifyPreconditions() ITKv5_CONST;
813 VerifyInputInformation() ITKv5_CONST;
829 GenerateInputRequestedRegion();
843 GenerateOutputRequestedRegion(
DataObject * output);
856 GenerateOutputInformation();
868 PropagateResetPipeline();
893 CacheInputReleaseDataFlags();
899 RestoreInputReleaseDataFlags();
905 itkGetConstMacro(ThreaderUpdateProgress,
bool);
906 itkBooleanMacro(ThreaderUpdateProgress);
908 SetThreaderUpdateProgress(
bool arg);
915 static inline constexpr
float
918 return double(fixed) / double(std::numeric_limits<uint32_t>::max());
935 return std::numeric_limits<uint32_t>::max();
937 double temp = static_cast<double>(f) * std::numeric_limits<uint32_t>::max();
938 return static_cast<uint32_t>(temp);
975 using NameSet = std::set<DataObjectIdentifierType>;
992 bool m_ThreaderUpdateProgress{
true };
1008 friend class TestProcessObject;