start removing lots of print

This commit is contained in:
Ross
2025-06-30 10:39:42 +01:00
parent afa3b0c0ef
commit bc26209f07
14 changed files with 328 additions and 406 deletions
+1 -11
View File
@@ -93,38 +93,29 @@ def get_dicom_order(path):
files = []
for fname in glob.glob(path, recursive=False):
print("loading: {}".format(fname))
files.append((fname, pydicom.dcmread(fname)))
print("file count: {}".format(len(files)))
# skip files with no SliceLocation (eg scout views)
slices = []
map = {}
skipcount = 0
for fname, f in files:
print(dir(f))
print(fname)
if hasattr(f, 'SliceLocation'):
slices.append(f)
map[f.SliceLocation] = fname
else:
skipcount = skipcount + 1
print("skipped, no SliceLocation: {}".format(skipcount))
# ensure they are in the correct order
slices = sorted(slices, key=lambda s: s.SliceLocation)
#print(slices)
for i in slices:
print(map[i.SliceLocation])
return slices
#get_dicom_order("/home/ross/Downloads/DICOM HEAD/STD4/SER1/*.dcm")
def pretty_print_dicom(dataset, indent=0):
l = print_dicom(dataset, indent)
print(l)
return "".join(l)
@@ -183,7 +174,6 @@ def get_image_dicom_hash(img, dataset=None, hash_type="md5", direct_pixel_data=T
hasher.update(dataset.PixelData)
except AttributeError as e:
print("Error getting pixel data hash from dataset")
print(dataset)
raise InvalidDicomError("Error getting pixel data hash from dataset")
else: