Skip to content

Commit 900a57f

Browse files
committed
missing Images key
1 parent eb57c5b commit 900a57f

File tree

2 files changed

+3
-14
lines changed

2 files changed

+3
-14
lines changed

sendit/apps/main/tasks/get.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,6 @@ def import_dicomdir(dicom_dir, run_get_identifiers=True):
125125
series_id = dcm.get('SeriesNumber')
126126
if series_id not in all_series:
127127
all_series.append(series_id)
128-
129128
if study_date not in study_dates:
130129
study_dates[study_date] = 0
131130
study_dates[study_date] += 1
@@ -141,7 +140,6 @@ def import_dicomdir(dicom_dir, run_get_identifiers=True):
141140
message = "%s is flagged in %s: %s, skipping" %(dicom_uid,
142141
flag_group,
143142
reason)
144-
145143
batch = add_batch_warning(message,batch,quiet=True)
146144
message = "BurnedInAnnotation found for batch %s" %batch.uid
147145
if message not in messages:
@@ -155,13 +153,12 @@ def import_dicomdir(dicom_dir, run_get_identifiers=True):
155153

156154
# Series Number and count of slices (images)
157155
if series_id is not None and series_id not in series:
158-
series[series_id] = {'SeriesNumber': series_id }
159-
156+
series[series_id] = {'SeriesNumber': series_id,
157+
'Images':1 }
160158
# Series Description
161159
description = dcm.get('SeriesDescription')
162160
if dcm.get('SeriesDescription') is not None:
163161
series[series_id]['SeriesDescription'] = description
164-
165162
else:
166163
series[series_id]['Images'] +=1
167164

sendit/apps/main/tasks/update.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060

6161
from django.conf import settings
6262
import os
63+
import time
6364
from copy import deepcopy
6465

6566
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'sendit.settings')
@@ -108,7 +109,6 @@ def replace_identifiers(bid, run_upload_storage=False):
108109
'''
109110

110111
batch.qa['ProcessStartTime'] = time.time()
111-
112112
batch = Batch.objects.get(id=bid)
113113
batch_ids = BatchIdentifiers.objects.get(batch=batch)
114114

@@ -125,12 +125,10 @@ def replace_identifiers(bid, run_upload_storage=False):
125125
cleaned = clean_identifiers(ids=updated,
126126
default="KEEP",
127127
deid=deid)
128-
129128
# Save progress
130129
batch_ids.cleaned = cleaned
131130
batch_ids.updated = updated
132131
batch_ids.save()
133-
134132
# Get updated files
135133
dicom_files = batch.get_image_paths()
136134
output_folder = batch.get_path()
@@ -142,7 +140,6 @@ def replace_identifiers(bid, run_upload_storage=False):
142140
strip_sequences=True,
143141
remove_private=True) # force = True
144142
# save = True,
145-
146143
# Get shared information
147144
aggregate = ["BodyPartExamined", "Modality", "StudyDescription"]
148145
shared_ids = get_shared_identifiers(dicom_files=updated_files,
@@ -158,24 +155,19 @@ def replace_identifiers(bid, run_upload_storage=False):
158155

159156
# S6M0<MRN-SUID>_<JITTERED-REPORT-DATE>_<ACCESSIONNUMBER-SUID>
160157
# Rename the dicom based on suid
161-
162158
if item_id in updated:
163159
item_suid = updated[item_id]['item_id']
164160
dcm = dcm.rename(item_suid) # added to [prefix][dcm.name]
165161
dcm.save()
166-
167162
# If we don't have the id, don't risk uploading
168163
else:
169164
message = "%s for Image Id %s file read error: skipping." %(item_id, dcm.id)
170165
batch = add_batch_error(message,batch)
171166
dcm.delete()
172-
173-
174167
except:
175168
message = "%s for Image Id %s not found in lookup: skipping." %(item_id, dcm.id)
176169
batch = add_batch_error(message,batch)
177170
dcm.delete()
178-
179171
batch.qa['ProcessFinishTime'] = time.time()
180172

181173
# We don't get here if the call above failed

0 commit comments

Comments
 (0)