Skip to content

Commit

Permalink
Be sure sequence name is in the dicom tag
Browse files Browse the repository at this point in the history
  • Loading branch information
tbaudier committed Nov 22, 2024
1 parent 03c1ba7 commit 76af69c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions gatetools/image_convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,12 +144,16 @@ def separate_sequenceName_series(series):
#Load dicom files
for serie in series.keys():
for file in series[serie]:
sequenceName = ""
try:
sequenceName = pydicom.dcmread(file)[0x0018, 0x0024].value
ds = pydicom.dcmread(file)
if Tag(0x18, 0x24) in ds:
sequenceName = ds[0x0018, 0x0024].value
except pydicom.errors.InvalidDicomError:
ds = pydicom.dcmread(file, force=True)
ds.file_meta.TransferSyntaxUID = pydicom.uid.ImplicitVRLittleEndian
sequenceName = ds[0x0018, 0x0024].value
if Tag(0x18, 0x24) in ds:
sequenceName = ds[0x0018, 0x0024].value
new_key = str(serie) + "_" + str(sequenceName)
if new_key not in files:
files[new_key] = []
Expand Down

0 comments on commit 76af69c

Please sign in to comment.