28 #ifndef itkProcessObject_h
29 #define itkProcessObject_h
45 class MultiThreaderBase;
165 using NameArray = std::vector<DataObjectIdentifierType>;
176 GetInputNames()
const;
180 GetRequiredInputNames()
const;
207 GetNumberOfInputs()
const;
211 GetNumberOfOutputs()
const;
219 GetOutputNames()
const;
251 GetNumberOfIndexedInputs()
const;
263 GetNumberOfValidRequiredInputs()
const;
271 GetNumberOfIndexedOutputs()
const;
296 itkSetMacro(AbortGenerateData,
bool);
299 itkGetConstReferenceMacro(AbortGenerateData,
bool);
302 itkBooleanMacro(AbortGenerateData);
312 #if !defined(ITK_LEGACY_REMOVE)
314 SetProgress(
float progress)
316 m_Progress = progressFloatToFixed(progress);
328 return progressFixedToFloat(m_Progress);
341 UpdateProgress(
float progress);
351 IncrementProgress(
float increment);
387 UpdateLargestPossibleRegion();
405 UpdateOutputInformation();
410 PropagateRequestedRegion(
DataObject * output);
454 virtual DataObjectPointer
455 MakeOutput(
const DataObjectIdentifierType &);
463 SetReleaseDataFlag(
bool val);
465 GetReleaseDataFlag()
const;
469 this->SetReleaseDataFlag(
true);
474 this->SetReleaseDataFlag(
false);
490 itkSetMacro(ReleaseDataBeforeUpdateFlag,
bool);
491 itkGetConstReferenceMacro(ReleaseDataBeforeUpdateFlag,
bool);
492 itkBooleanMacro(ReleaseDataBeforeUpdateFlag);
497 itkGetConstReferenceMacro(NumberOfWorkUnits,
ThreadIdType);
500 #if !defined(ITK_LEGACY_REMOVE) || defined(ITKV4_COMPATIBILITY)
501 itkLegacyMacro(
void SetNumberOfThreads(
ThreadIdType count)) { this->SetNumberOfWorkUnits(count); }
503 itkLegacyMacro(
ThreadIdType GetNumberOfThreads()
const) {
return this->GetNumberOfWorkUnits(); }
504 #endif // !ITK_LEGACY_REMOVE
510 return m_MultiThreader;
515 SetMultiThreader(MultiThreaderType * threader);
531 PrintSelf(std::ostream & os,
Indent indent)
const override;
542 GetInput(
const DataObjectIdentifierType & key);
544 GetInput(
const DataObjectIdentifierType & key)
const;
551 return idx < m_IndexedInputs.size() ? m_IndexedInputs[idx]->second.GetPointer() :
nullptr;
556 return idx < m_IndexedInputs.size() ? m_IndexedInputs[idx]->second.GetPointer() :
nullptr;
567 SetInput(
const DataObjectIdentifierType & key,
DataObject * input);
569 SetNthInput(DataObjectPointerArraySizeType idx,
DataObject * input);
599 RemoveInput(
const DataObjectIdentifierType & key);
600 virtual void RemoveInput(DataObjectPointerArraySizeType);
606 return m_IndexedInputs[0]->second;
611 return m_IndexedInputs[0]->second;
617 SetPrimaryInputName(
const DataObjectIdentifierType & key);
621 return this->m_IndexedInputs[0]->first.c_str();
636 SetNumberOfIndexedInputs(DataObjectPointerArraySizeType num);
647 virtual void SetNumberOfRequiredInputs(DataObjectPointerArraySizeType);
648 itkGetConstReferenceMacro(NumberOfRequiredInputs, DataObjectPointerArraySizeType);
656 RemoveRequiredInputName(
const DataObjectIdentifierType &);
660 IsRequiredInputName(
const DataObjectIdentifierType &)
const;
667 SetRequiredInputNames(
const NameArray &);
680 AddRequiredInputName(
const DataObjectIdentifierType &);
682 AddRequiredInputName(
const DataObjectIdentifierType &, DataObjectPointerArraySizeType idx);
695 AddOptionalInputName(
const DataObjectIdentifierType &);
697 AddOptionalInputName(
const DataObjectIdentifierType &, DataObjectPointerArraySizeType idx);
706 GetOutput(
const DataObjectIdentifierType & key);
708 GetOutput(
const DataObjectIdentifierType & key)
const;
713 SetPrimaryOutputName(
const DataObjectIdentifierType & key);
717 return this->m_IndexedOutputs[0]->first.c_str();
723 GetOutput(DataObjectPointerArraySizeType i);
725 GetOutput(DataObjectPointerArraySizeType i)
const;
730 SetOutput(
const DataObjectIdentifierType & name,
DataObject * output);
734 RemoveOutput(
const DataObjectIdentifierType & key);
740 return m_IndexedOutputs[0]->second;
745 return m_IndexedOutputs[0]->second;
756 SetNthOutput(DataObjectPointerArraySizeType idx,
DataObject * output);
762 RemoveOutput(DataObjectPointerArraySizeType idx);
764 itkSetMacro(NumberOfRequiredOutputs, DataObjectPointerArraySizeType);
765 itkGetConstReferenceMacro(NumberOfRequiredOutputs, DataObjectPointerArraySizeType);
769 SetNumberOfIndexedOutputs(DataObjectPointerArraySizeType num);
772 DataObjectIdentifierType
773 MakeNameFromInputIndex(DataObjectPointerArraySizeType idx)
const;
774 DataObjectIdentifierType
775 MakeNameFromOutputIndex(DataObjectPointerArraySizeType idx)
const;
776 DataObjectPointerArraySizeType
777 MakeIndexFromInputName(
const DataObjectIdentifierType & name)
const;
778 DataObjectPointerArraySizeType
779 MakeIndexFromOutputName(
const DataObjectIdentifierType & name)
const;
781 IsIndexedInputName(
const DataObjectIdentifierType &)
const;
783 IsIndexedOutputName(
const DataObjectIdentifierType &)
const;
801 VerifyPreconditions() ITKv5_CONST;
814 VerifyInputInformation() ITKv5_CONST;
830 GenerateInputRequestedRegion();
844 GenerateOutputRequestedRegion(
DataObject * output);
857 GenerateOutputInformation();
869 PropagateResetPipeline();
894 CacheInputReleaseDataFlags();
900 RestoreInputReleaseDataFlags();
906 itkGetConstMacro(ThreaderUpdateProgress,
bool);
907 itkBooleanMacro(ThreaderUpdateProgress);
909 SetThreaderUpdateProgress(
bool arg);
916 static inline constexpr
float
919 return static_cast<double>(fixed) / static_cast<double>(std::numeric_limits<uint32_t>::max());
927 static inline uint32_t
936 return std::numeric_limits<uint32_t>::max();
938 double temp = static_cast<double>(f) * std::numeric_limits<uint32_t>::max();
939 return static_cast<uint32_t>(temp);
976 using NameSet = std::set<DataObjectIdentifierType>;
993 bool m_ThreaderUpdateProgress{
true };
1012 friend class TestProcessObject;