vtk-dicom  0.8.17
vtkDICOMUIDGenerator.h
1 /*=========================================================================
2 
3  Program: DICOM for VTK
4 
5  Copyright (c) 2012-2024 David Gobbi
6  All rights reserved.
7  See Copyright.txt or http://dgobbi.github.io/bsd3.txt for details.
8 
9  This software is distributed WITHOUT ANY WARRANTY; without even
10  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11  PURPOSE. See the above copyright notice for more information.
12 
13 =========================================================================*/
14 #ifndef vtkDICOMUIDGenerator_h
15 #define vtkDICOMUIDGenerator_h
16 
17 #include "vtkObject.h"
18 #include "vtkStdString.h" // For std::string
19 #include "vtkDICOMModule.h" // For export macro
20 #include "vtkDICOMConfig.h" // For configuration details
21 #include "vtkDICOMTag.h" // For method parameter
22 
23 // Declare VTK classes within VTK's optional namespace
24 #if defined(VTK_ABI_NAMESPACE_BEGIN)
25 VTK_ABI_NAMESPACE_BEGIN
26 #endif
27 
28 class vtkStringArray;
29 
30 #if defined(VTK_ABI_NAMESPACE_BEGIN)
31 VTK_ABI_NAMESPACE_END
32 #endif
33 
35 
45 class VTKDICOM_EXPORT vtkDICOMUIDGenerator : public vtkObject
46 {
47 public:
49 
53 
55  void PrintSelf(ostream& os, vtkIndent indent) VTK_DICOM_OVERRIDE;
56 
58 
64  void SetUIDPrefix(const char *prefix);
65 
67 
71  const char *GetUIDPrefix();
73 
75  /*
77  * The generator uses the tag as a hint when generating the UIDs,
78  * for example the SOPInstanceUID might have a different format from
79  * the FrameOfReferenceUID.
80  */
81  virtual std::string GenerateUID(vtkDICOMTag tag);
82 
84 
91  virtual void GenerateUIDs(vtkDICOMTag tag, vtkStringArray *uids);
93 
95 
99  static void SetDefault(vtkDICOMUIDGenerator *uidgen);
100 
103  return vtkDICOMUIDGenerator::Default; }
105 
106 protected:
108  ~vtkDICOMUIDGenerator() VTK_DICOM_OVERRIDE;
109 
110  char *UIDPrefix;
111  char UIDPrefixStore[64];
112  static vtkDICOMUIDGenerator *Default;
113 
114 private:
115  friend class vtkDICOMUIDGeneratorInitializer;
116 
117 #ifdef VTK_DICOM_DELETE
118  vtkDICOMUIDGenerator(const vtkDICOMUIDGenerator&) VTK_DICOM_DELETE;
119  void operator=(const vtkDICOMUIDGenerator&) VTK_DICOM_DELETE;
120 #else
122  void operator=(const vtkDICOMUIDGenerator&) = delete;
123 #endif
124 };
125 
128 
132 class VTKDICOM_EXPORT vtkDICOMUIDGeneratorInitializer
133 {
134 public:
135  vtkDICOMUIDGeneratorInitializer();
136  ~vtkDICOMUIDGeneratorInitializer();
137 private:
138 #ifdef VTK_DICOM_DELETE
139  vtkDICOMUIDGeneratorInitializer(
140  const vtkDICOMUIDGeneratorInitializer&) VTK_DICOM_DELETE;
141  vtkDICOMUIDGeneratorInitializer& operator=(
142  const vtkDICOMUIDGeneratorInitializer&) VTK_DICOM_DELETE;
143 #else
144  vtkDICOMUIDGeneratorInitializer(
145  const vtkDICOMUIDGeneratorInitializer&) = delete;
146  vtkDICOMUIDGeneratorInitializer& operator=(
147  const vtkDICOMUIDGeneratorInitializer&) = delete;
148 #endif
149 };
150 
151 static vtkDICOMUIDGeneratorInitializer vtkDICOMUIDGeneratorInitializerInstance;
153 
154 #endif // vtkDICOMUIDGenerator_h
A (group,element) identifier tag for DICOM attributes.
Definition: vtkDICOMTag.h:23
Generate UIDs for written DICOM files.
Definition: vtkDICOMUIDGenerator.h:46
virtual std::string GenerateUID(vtkDICOMTag tag)
Generate a UID for the provided tag.
static vtkDICOMUIDGenerator * GetDefault()
Get the default UID generator.
Definition: vtkDICOMUIDGenerator.h:102
virtual void GenerateUIDs(vtkDICOMTag tag, vtkStringArray *uids)
Generate a series of UIDs, sorted from low to high.
static vtkDICOMUIDGenerator * New()
Static method for construction.
const char * GetUIDPrefix()
Get the current UID prefix.
void SetUIDPrefix(const char *prefix)
Set a UID prefix to use when generating UIDs.
void PrintSelf(ostream &os, vtkIndent indent) VTK_DICOM_OVERRIDE
Print information about this object.
static void SetDefault(vtkDICOMUIDGenerator *uidgen)
Set the default UID generator.
abstract base class for most VTK objects
Definition: vtkObject.h:54