ITK 6.0.0
Insight Toolkit
 
Loading...
Searching...
No Matches
itkDataObject.h
Go to the documentation of this file.
1/*=========================================================================
2 *
3 * Copyright NumFOCUS
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * https://www.apache.org/licenses/LICENSE-2.0.txt
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 *=========================================================================*/
18/*=========================================================================
19 *
20 * Portions of this file are subject to the VTK Toolkit Version 3 copyright.
21 *
22 * Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
23 *
24 * For complete copyright, license and disclaimer of warranty information
25 * please refer to the NOTICE file at the top of the ITK source tree.
26 *
27 *=========================================================================*/
28#ifndef itkDataObject_h
29#define itkDataObject_h
30
31#include "itkObject.h"
32#include "itkMacro.h"
33#include "itkSingletonMacro.h"
34#include "itkWeakPointer.h"
35#include "itkRealTimeStamp.h"
36#include "itkObjectFactory.h"
37
38namespace itk
39{
40// Forward reference because of circular dependencies
41class ITK_FORWARD_EXPORT ProcessObject;
42class ITK_FORWARD_EXPORT DataObject;
43
44/*--------------------Data Object Exceptions---------------------------*/
45
51class ITKCommon_EXPORT DataObjectError : public ExceptionObject
52{
53public:
56 DataObjectError() noexcept;
57
59 ~DataObjectError() noexcept override = default;
60
62 DataObjectError(std::string file, unsigned int lineNumber);
63
65 DataObjectError(const DataObjectError & orig) noexcept;
66
69 operator=(const DataObjectError & orig) noexcept;
70
72 itkOverrideGetNameOfClassMacro(DataObjectError);
73
75 void
76 SetDataObject(DataObject * dobj) noexcept;
77
78
81 const DataObject *
82 GetDataObject() const noexcept;
83#if !defined(ITK_LEGACY_REMOVE)
85 GetDataObject() noexcept;
86#endif
88protected:
93 virtual void
94 PrintSelf(std::ostream & os, Indent indent) const;
95
96private:
98};
99
107class ITKCommon_EXPORT InvalidRequestedRegionError : public DataObjectError
108{
109public:
113
115 ~InvalidRequestedRegionError() noexcept override = default;
116
118 InvalidRequestedRegionError(std::string file, unsigned int lineNumber);
119
122
125 operator=(const InvalidRequestedRegionError & orig) noexcept;
126
128 itkOverrideGetNameOfClassMacro(InvalidRequestedRegionError);
129
130protected:
135 void
136 PrintSelf(std::ostream & os, Indent indent) const override;
137};
138
139/*----------------------------Data Object--------------------------------*/
140
285class ITK_FORCE_EXPORT_MACRO(ITKCommon) DataObject : public Object
286{
287public:
288 ITK_DISALLOW_COPY_AND_MOVE(DataObject);
289
295
296 using DataObjectIdentifierType = std::string;
297
299 itkOverrideGetNameOfClassMacro(DataObject);
300
302 itkSimpleNewMacro(DataObject);
303
309 void
311
320 GetSource() const;
321
325
327 using DataObjectPointerArraySizeType = std::vector<Pointer>::size_type;
330
332 void
334
337 virtual void
339
342 void
344 {
345 m_ReleaseDataFlag = flag;
346 }
347
348 itkGetConstReferenceMacro(ReleaseDataFlag, bool);
349 itkBooleanMacro(ReleaseDataFlag);
350
354 static void
356
357 static bool
359
360 static void
365 static void
370
375 void
377
380 bool
382
384 bool
386 {
387 return m_DataReleased;
388 }
389
400 virtual void
402
412 virtual void
414
417 virtual void
419
420 virtual void
422
426 virtual void
428
432 void
434 {
435 m_PipelineMTime = time;
436 }
437 itkGetConstReferenceMacro(PipelineMTime, ModifiedTimeType);
440 virtual ModifiedTimeType
442
450 itkGetConstReferenceMacro(RealTimeStamp, RealTimeStamp);
460 virtual void
462 {
463 this->Initialize();
464 }
465
470 virtual void
472
476 virtual void
479
489 virtual bool
491 {
492 return false;
493 }
494
507 virtual bool
509 {
510 return true;
511 }
512
522 virtual void
525
531 virtual void
534
540 virtual void
542 {}
543
544protected:
546 ~DataObject() override;
547 void
548 PrintSelf(std::ostream & os, Indent indent) const override;
549
551 virtual void
553
554private:
558
564
567
568 bool m_ReleaseDataFlag{}; // Data will release after use by a filter if on
569 bool m_DataReleased{}; // Keep track of data release during pipeline execution
570
574
577
582 bool
584
593 bool
595
597 itkGetGlobalDeclarationMacro(bool, GlobalReleaseDataFlag);
598
599
601 friend class ProcessObject;
602 friend class DataObjectError;
603};
604} // end namespace itk
605
606#endif
void SetDataObject(DataObject *dobj) noexcept
DataObject * m_DataObject
virtual void PrintSelf(std::ostream &os, Indent indent) const
DataObjectError() noexcept
const DataObject * GetDataObject() const noexcept
Base class for all data objects in ITK.
std::vector< Pointer >::size_type DataObjectPointerArraySizeType
virtual void Graft(const DataObject *)
virtual void SetRequestedRegion(const DataObject *)
virtual void PropagateRequestedRegion()
~DataObject() override
void UpdateSource() const
bool DisconnectSource(ProcessObject *arg, const DataObjectIdentifierType &name)
virtual ModifiedTimeType GetUpdateMTime() const
virtual void PropagateResetPipeline()
WeakPointer< ProcessObject > m_Source
virtual void ResetPipeline()
DataObjectPointerArraySizeType GetSourceOutputIndex() const
virtual void UpdateOutputInformation()
virtual void PrepareForNewData()
void SetPipelineMTime(ModifiedTimeType time)
bool ConnectSource(ProcessObject *arg, const DataObjectIdentifierType &name)
static void GlobalReleaseDataFlagOn()
SmartPointer< Self > Pointer
virtual void DataHasBeenGenerated()
bool GetDataReleased() const
SmartPointer< ProcessObject > GetSource() const
static void SetGlobalReleaseDataFlag(bool val)
virtual void SetRequestedRegionToLargestPossibleRegion()
virtual void CopyInformation(const DataObject *)
virtual bool VerifyRequestedRegion()
ModifiedTimeType m_PipelineMTime
void DisconnectPipeline()
const DataObjectIdentifierType & GetSourceOutputName() const
virtual void UpdateOutputData()
virtual void Update()
bool ShouldIReleaseData() const
void SetReleaseDataFlag(bool flag)
void PrintSelf(std::ostream &os, Indent indent) const override
static bool * m_GlobalReleaseDataFlag
itkGetGlobalDeclarationMacro(bool, GlobalReleaseDataFlag)
static void GlobalReleaseDataFlagOff()
std::string DataObjectIdentifierType
virtual void Initialize()
DataObjectIdentifierType m_SourceOutputName
SmartPointer< const Self > ConstPointer
friend class DataObjectError
static bool GetGlobalReleaseDataFlag()
TimeStamp m_UpdateMTime
friend class ProcessObject
RealTimeStamp m_RealTimeStamp
virtual bool RequestedRegionIsOutsideOfTheBufferedRegion()
ExceptionObject() noexcept=default
Control indentation during Print() invocation.
Definition itkIndent.h:50
void PrintSelf(std::ostream &os, Indent indent) const override
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
The RealTimeStamp is a data structure for representing time with high precision and a large dynamic r...
Implements transparent reference counting.
Generate a unique, increasing time value.
Implements a weak reference to an object.
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
SizeValueType ModifiedTimeType
STL namespace.