28 #ifndef itkProcessObject_h
29 #define itkProcessObject_h
161 using NameArray = std::vector< DataObjectIdentifierType >;
277 itkSetMacro(AbortGenerateData,
bool);
280 itkGetConstReferenceMacro(AbortGenerateData,
bool);
283 itkBooleanMacro(AbortGenerateData);
297 #if ! defined ( ITK_LEGACY_REMOVE )
298 void SetProgress(
float progress)
301 m_Progress = std::max(progress, 0.0f);
302 m_Progress = std::min(m_Progress, 1.0f);
312 itkGetConstReferenceMacro(Progress,
float);
320 void UpdateProgress(
float progress);
343 virtual void Update();
354 virtual void UpdateLargestPossibleRegion();
371 virtual void UpdateOutputInformation();
375 virtual void PropagateRequestedRegion(
DataObject *output);
378 virtual void UpdateOutputData(
DataObject *output);
397 virtual void ResetPipeline();
415 virtual DataObjectPointer MakeOutput(
const DataObjectIdentifierType & );
422 virtual void SetReleaseDataFlag(
bool flag);
423 virtual bool GetReleaseDataFlag()
const;
440 itkSetMacro(ReleaseDataBeforeUpdateFlag,
bool);
441 itkGetConstReferenceMacro(ReleaseDataBeforeUpdateFlag,
bool);
442 itkBooleanMacro(ReleaseDataBeforeUpdateFlag);
447 itkGetConstReferenceMacro(NumberOfWorkUnits,
ThreadIdType);
450 #if !defined( ITK_LEGACY_REMOVE ) || defined( ITKV4_COMPATIBILITY )
451 itkLegacyMacro(
void SetNumberOfThreads(
ThreadIdType count))
453 this->SetNumberOfWorkUnits(count);
458 return this->GetNumberOfWorkUnits();
460 #endif // !ITK_LEGACY_REMOVE
464 {
return m_MultiThreader; }
467 void SetMultiThreader(MultiThreaderType* threader);
475 virtual void PrepareOutputs();
481 void PrintSelf(std::ostream & os,
Indent indent)
const override;
491 DataObject * GetInput(
const DataObjectIdentifierType & key);
492 const DataObject * GetInput(
const DataObjectIdentifierType & key)
const;
497 {
return idx < m_IndexedInputs.size() ? m_IndexedInputs[idx]->second.GetPointer() :
nullptr; }
499 {
return idx < m_IndexedInputs.size() ? m_IndexedInputs[idx]->second.GetPointer() :
nullptr; }
508 virtual void SetInput(
const DataObjectIdentifierType & key,
DataObject *input);
509 virtual void SetNthInput(DataObjectPointerArraySizeType num,
DataObject *input);
522 virtual void PushBackInput(
const DataObject *input);
523 virtual void PopBackInput();
524 virtual void PushFrontInput(
const DataObject *input);
525 virtual void PopFrontInput();
533 virtual void RemoveInput(
const DataObjectIdentifierType & key);
534 virtual void RemoveInput(DataObjectPointerArraySizeType);
538 {
return m_IndexedInputs[0]->second; }
540 {
return m_IndexedInputs[0]->second; }
544 virtual void SetPrimaryInputName(
const DataObjectIdentifierType & key);
546 {
return this->m_IndexedInputs[0]->first.c_str(); }
550 virtual void SetPrimaryInput(
DataObject *input);
558 void SetNumberOfIndexedInputs(DataObjectPointerArraySizeType num);
569 virtual void SetNumberOfRequiredInputs(DataObjectPointerArraySizeType);
570 itkGetConstReferenceMacro(NumberOfRequiredInputs, DataObjectPointerArraySizeType);
577 bool RemoveRequiredInputName(
const DataObjectIdentifierType & );
580 bool IsRequiredInputName(
const DataObjectIdentifierType & )
const;
586 void SetRequiredInputNames(
const NameArray & );
598 bool AddRequiredInputName(
const DataObjectIdentifierType & );
599 bool AddRequiredInputName(
const DataObjectIdentifierType &, DataObjectPointerArraySizeType idx );
611 void AddOptionalInputName(
const DataObjectIdentifierType & );
612 void AddOptionalInputName(
const DataObjectIdentifierType &, DataObjectPointerArraySizeType idx );
620 DataObject * GetOutput(
const DataObjectIdentifierType & key);
621 const DataObject * GetOutput(
const DataObjectIdentifierType & key)
const;
625 virtual void SetPrimaryOutputName(
const DataObjectIdentifierType & key);
627 {
return this->m_IndexedOutputs[0]->first.c_str(); }
631 DataObject * GetOutput(DataObjectPointerArraySizeType idx);
632 const DataObject * GetOutput(DataObjectPointerArraySizeType idx)
const;
636 virtual void SetOutput(
const DataObjectIdentifierType & key,
DataObject *output);
639 virtual void RemoveOutput(
const DataObjectIdentifierType & key);
643 {
return m_IndexedOutputs[0]->second; }
645 {
return m_IndexedOutputs[0]->second; }
649 virtual void SetPrimaryOutput(
DataObject *output);
653 virtual void SetNthOutput(DataObjectPointerArraySizeType num,
DataObject *output);
657 virtual void RemoveOutput(DataObjectPointerArraySizeType idx);
659 itkSetMacro(NumberOfRequiredOutputs, DataObjectPointerArraySizeType);
660 itkGetConstReferenceMacro(NumberOfRequiredOutputs, DataObjectPointerArraySizeType);
663 void SetNumberOfIndexedOutputs(DataObjectPointerArraySizeType num);
666 DataObjectIdentifierType MakeNameFromInputIndex( DataObjectPointerArraySizeType idx )
const;
667 DataObjectIdentifierType MakeNameFromOutputIndex( DataObjectPointerArraySizeType idx )
const;
668 DataObjectPointerArraySizeType MakeIndexFromInputName(
const DataObjectIdentifierType & name )
const;
669 DataObjectPointerArraySizeType MakeIndexFromOutputName(
const DataObjectIdentifierType & name )
const;
670 bool IsIndexedInputName(
const DataObjectIdentifierType & )
const;
671 bool IsIndexedOutputName(
const DataObjectIdentifierType & )
const;
688 virtual void VerifyPreconditions() ITKv5_CONST;
700 virtual
void VerifyInputInformation() ITKv5_CONST;
715 virtual
void GenerateInputRequestedRegion();
728 virtual
void GenerateOutputRequestedRegion(
DataObject *output);
740 virtual
void GenerateOutputInformation();
743 virtual
void GenerateData() {}
749 virtual void PropagateResetPipeline();
762 virtual void ReleaseInputs();
772 virtual void CacheInputReleaseDataFlags();
777 virtual void RestoreInputReleaseDataFlags();
811 using NameSet = std::set< DataObjectIdentifierType >;
839 friend class TestProcessObject;
DataObjectPointerMap m_Inputs
DataObjectPointerArraySizeType m_NumberOfRequiredInputs
DataObject::DataObjectIdentifierType DataObjectIdentifierType
NameSet m_RequiredInputNames
Light weight base class for most itk classes.
ThreadIdType m_NumberOfWorkUnits
bool m_ReleaseDataBeforeUpdateFlag
DataObjectPointerArray::size_type DataObjectPointerArraySizeType
DataObject * GetPrimaryOutput()
std::vector< DataObjectPointer > DataObjectPointerArray
virtual const char * GetPrimaryInputName() const
const DataObject * GetPrimaryInput() const
A forward iterator over outputs of a ProcessObject.
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
std::map< DataObjectIdentifierType, bool > m_CachedInputReleaseDataFlags
DataObjectPointerMap m_Outputs
DataObject * GetPrimaryInput()
std::vector< DataObjectIdentifierType > NameArray
MultiThreaderType::Pointer m_MultiThreader
class ITK_FORWARD_EXPORT ProcessObject
TimeStamp m_OutputInformationMTime
constexpr std::vcl_size_t ITK_MAX_THREADS
const DataObject * GetInput(DataObjectPointerArraySizeType idx) const
std::map< DataObjectIdentifierType, DataObjectPointer > DataObjectPointerMap
MultiThreaderType * GetMultiThreader() const
void ReleaseDataFlagOff()
A forward iterator over the DataObject of a ProcessObject.
DataObject * GetInput(DataObjectPointerArraySizeType idx)
virtual void EnlargeOutputRequestedRegion(DataObject *)
Generate a unique, increasing time value.
A class for performing multithreaded execution.
unsigned int ThreadIdType
A forward iterator over outputs of a ProcessObject.
DataObjectPointerArraySizeType m_NumberOfRequiredOutputs
Control indentation during Print() invocation.
std::vector< DataObjectPointerMap::iterator > m_IndexedOutputs
A forward iterator over the DataObject of a ProcessObject.
const DataObject * GetPrimaryOutput() const
Base class for most ITK classes.
SmartPointer< Self > Pointer
std::set< DataObjectIdentifierType > NameSet
std::string DataObjectIdentifierType
Base class for all data objects in ITK.
virtual const char * GetPrimaryOutputName() const
std::vector< DataObjectPointerMap::iterator > m_IndexedInputs