ITK  5.4.0
Insight Toolkit
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:
54
57 DataObjectError() noexcept;
58
60 ~DataObjectError() noexcept override = default;
61
63 DataObjectError(const char * file, unsigned int lineNumber);
64
66 DataObjectError(const std::string & file, unsigned int lineNumber);
67
69 DataObjectError(const DataObjectError & orig) noexcept;
70
73 operator=(const DataObjectError & orig) noexcept;
74
76 itkOverrideGetNameOfClassMacro(DataObjectError);
77
79 void
80 SetDataObject(DataObject * dobj) noexcept;
81
82
84 const DataObject *
85 GetDataObject() const noexcept;
86#if !defined(ITK_LEGACY_REMOVE)
88 GetDataObject() noexcept;
89#endif
92protected:
97 virtual void
98 PrintSelf(std::ostream & os, Indent indent) const;
99
100private:
101 DataObject * m_DataObject{ nullptr };
102};
103
111class ITKCommon_EXPORT InvalidRequestedRegionError : public DataObjectError
112{
113public:
114
118
120 ~InvalidRequestedRegionError() noexcept override = default;
121
123 InvalidRequestedRegionError(const char * file, unsigned int lineNumber);
124
126 InvalidRequestedRegionError(const std::string & file, unsigned int lineNumber);
127
130
133 operator=(const InvalidRequestedRegionError & orig) noexcept;
134
136 itkOverrideGetNameOfClassMacro(InvalidRequestedRegionError);
137
138protected:
143 void
144 PrintSelf(std::ostream & os, Indent indent) const override;
145};
146
147/*----------------------------Data Object--------------------------------*/
148
293class ITK_FORCE_EXPORT_MACRO(ITKCommon) DataObject : public Object
294{
295public:
296 ITK_DISALLOW_COPY_AND_MOVE(DataObject);
297
303
304 using DataObjectIdentifierType = std::string;
305
307 itkOverrideGetNameOfClassMacro(DataObject);
308
310 itkSimpleNewMacro(DataObject);
311
317 void
319
328 GetSource() const;
329
333
335 using DataObjectPointerArraySizeType = std::vector<Pointer>::size_type;
338
340 void
342
345 virtual void
347
350 void
352 {
353 m_ReleaseDataFlag = flag;
354 }
355
356 itkGetConstReferenceMacro(ReleaseDataFlag, bool);
357 itkBooleanMacro(ReleaseDataFlag);
358
362 static void
364
365 static bool
367
368 static void
370 {
371 Self::SetGlobalReleaseDataFlag(true);
372 }
373 static void
375 {
376 Self::SetGlobalReleaseDataFlag(false);
377 }
378
383 void
385
388 bool
390
392 bool
394 {
395 return m_DataReleased;
396 }
397
408 virtual void
410
420 virtual void
422
425 virtual void
427
428 virtual void
430
434 virtual void
436
439 void
441 {
442 m_PipelineMTime = time;
443 }
444 itkGetConstReferenceMacro(PipelineMTime, ModifiedTimeType);
448 virtual ModifiedTimeType
450
457 itkGetConstReferenceMacro(RealTimeStamp, RealTimeStamp);
468 virtual void
470 {
471 this->Initialize();
472 }
473
478 virtual void
480
484 virtual void
486 {}
487
497 virtual bool
499 {
500 return false;
501 }
502
515 virtual bool
517 {
518 return true;
519 }
520
530 virtual void
532 {}
533
539 virtual void
541 {}
542
548 virtual void
550 {}
551
552protected:
554 ~DataObject() override;
555 void
556 PrintSelf(std::ostream & os, Indent indent) const override;
557
559 virtual void
561
562private:
565 DataObjectIdentifierType m_SourceOutputName{};
566
571 TimeStamp m_UpdateMTime{};
572
574 RealTimeStamp m_RealTimeStamp{};
575
576 bool m_ReleaseDataFlag{}; // Data will release after use by a filter if on
577 bool m_DataReleased{}; // Keep track of data release during pipeline execution
578
581 ModifiedTimeType m_PipelineMTime{};
582
585
590 bool
592
601 bool
603
605 itkGetGlobalDeclarationMacro(bool, GlobalReleaseDataFlag);
606
607
609 friend class ProcessObject;
610 friend class DataObjectError;
611};
612} // end namespace itk
613
614#endif
Exception object for DataObject exceptions.
Definition: itkDataObject.h:52
virtual void PrintSelf(std::ostream &os, Indent indent) const
DataObjectError() 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()
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()
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()
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()
static bool GetGlobalReleaseDataFlag()
virtual bool RequestedRegionIsOutsideOfTheBufferedRegion()
Control indentation during Print() invocation.
Definition: itkIndent.h:50
Base class for most ITK classes.
Definition: itkObject.h:62
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...
Generate a unique, increasing time value.
Definition: itkTimeStamp.h:61
Implements a weak reference to an object.
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
class ITK_FORWARD_EXPORT DataObject
Definition: itkDataObject.h:42
SizeValueType ModifiedTimeType
Definition: itkIntTypes.h:102
STL namespace.