def __init__(self): self.studyuid = None self.seriesuid = None generator = gdcm.UIDGenerator() if not self.studyuid: self.studyuid = generator.Generate() if not self.seriesuid: self.seriesuid = generator.Generate()
# # Program: GDCM (Grassroots DICOM). A DICOM library # # Copyright (c) 2006-2011 Mathieu Malaterre # All rights reserved. # See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details. # # This software is distributed WITHOUT ANY WARRANTY; without even # the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR # PURPOSE. See the above copyright notice for more information. # ############################################################################ import gdcm import os, sys if __name__ == "__main__": uid = gdcm.UIDGenerator() for i in range(0, 100): print(uid.Generate()) MY_ROOT = "1.2.3.4" # static function: gdcm.UIDGenerator_SetRoot(MY_ROOT) for i in range(0, 100): print(uid.Generate()) # Test succeed ? sys.exit(0)
def GenerateMSOPId(self): generator = gdcm.UIDGenerator() return generator.Generate()
gdcm.Tag(0x0018,0x1310), gdcm.Tag(0x0018,0x1312), gdcm.Tag(0x0018,0x1314), gdcm.Tag(0x0018,0x1315), gdcm.Tag(0x0018,0x1316), gdcm.Tag(0x0020,0x0110), gdcm.Tag(0x0028,0x0120), gdcm.Tag(0x0028,0x1050), gdcm.Tag(0x0028,0x1051) ] for tag in taglist: #print tag ano.Remove( tag ) # special handling gen = gdcm.UIDGenerator() ano.Replace( gdcm.Tag(0x0008,0x9123), gen.Generate() ) #ano.Empty( gdcm.Tag(0x0040,0x0555) ) # # uid = gen.Generate() # de.SetTag( gdcm.Tag(0x0008,0x0018) ) # de.SetByteStringValue( uid ) # ds.Insert( de ) # init FMI now: #fmi = f.GetHeader() #ts = gdcm.TransferSyntax() #print ts #fmi.SetDataSetTransferSyntax( ts ) # default