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 [[nodiscard]] const DataObject *
82 GetDataObject() const noexcept;
83#if !defined(ITK_LEGACY_REMOVE)
85 GetDataObject() noexcept;
86#endif
88protected:
93 void
94 Print(std::ostream & os) const override;
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};
130
131/*----------------------------Data Object--------------------------------*/
132
277class ITK_FORCE_EXPORT_MACRO(ITKCommon) DataObject : public Object
278{
279public:
280 ITK_DISALLOW_COPY_AND_MOVE(DataObject);
281
287
288 using DataObjectIdentifierType = std::string;
289
291 itkOverrideGetNameOfClassMacro(DataObject);
292
294 itkSimpleNewMacro(DataObject);
295
301 void
303
312 GetSource() const;
313
317
319 using DataObjectPointerArraySizeType = std::vector<Pointer>::size_type;
322
324 void
326
329 virtual void
331
334 void
336 {
337 m_ReleaseDataFlag = flag;
338 }
339
340 itkGetConstReferenceMacro(ReleaseDataFlag, bool);
341 itkBooleanMacro(ReleaseDataFlag);
342
346 static void
348
349 static bool
351
352 static void
357 static void
362
367 void
369
372 bool
374
376 bool
378 {
379 return m_DataReleased;
380 }
381
392 virtual void
394
404 virtual void
406
409 virtual void
411
412 virtual void
414
418 virtual void
420
424 void
426 {
427 m_PipelineMTime = time;
428 }
429 itkGetConstReferenceMacro(PipelineMTime, ModifiedTimeType);
432 virtual ModifiedTimeType
434
442 itkGetConstReferenceMacro(RealTimeStamp, RealTimeStamp);
452 virtual void
454 {
455 this->Initialize();
456 }
457
462 virtual void
464
468 virtual void
471
481 virtual bool
483 {
484 return false;
485 }
486
499 virtual bool
501 {
502 return true;
503 }
504
514 virtual void
517
523 virtual void
526
532 virtual void
534 {}
535
536protected:
538 ~DataObject() override;
539 void
540 PrintSelf(std::ostream & os, Indent indent) const override;
541
543 virtual void
545
546private:
550
556
559
560 bool m_ReleaseDataFlag{}; // Data will release after use by a filter if on
561 bool m_DataReleased{}; // Keep track of data release during pipeline execution
562
566
569
574 bool
576
585 bool
587
589 itkGetGlobalDeclarationMacro(bool, GlobalReleaseDataFlag);
590
591
593 friend class ProcessObject;
594 friend class DataObjectError;
595};
596} // end namespace itk
597
598#endif
void SetDataObject(DataObject *dobj) noexcept
DataObject * m_DataObject
void Print(std::ostream &os) const override
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
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.