improve dicom uploading
This commit is contained in:
+9
-3
@@ -811,9 +811,11 @@ class UncategorisedDicom(models.Model):
|
||||
)
|
||||
|
||||
series = models.ForeignKey(
|
||||
"Series", related_name="imported_dicoms", on_delete=models.SET_NULL, null=True
|
||||
"Series", related_name="imported_dicoms", on_delete=models.SET_NULL, null=True, blank=True
|
||||
)
|
||||
|
||||
series_instance_uid = models.CharField(max_length=255, blank=True, null=True)
|
||||
|
||||
image_md5_hash = models.CharField(max_length=32, null=True, blank=True)
|
||||
|
||||
def check_for_duplicates(self, image_hash):
|
||||
@@ -833,10 +835,14 @@ class UncategorisedDicom(models.Model):
|
||||
def save(self, *args, **kwargs):
|
||||
"""Override save method to add image hash"""
|
||||
if self.image:
|
||||
|
||||
ds = self.get_dicom_info()
|
||||
|
||||
self.series_instance_uid = ds["SeriesInstanceUID"].value
|
||||
|
||||
# if self.check_for_duplicates():
|
||||
# return DuplicateDicom
|
||||
image_hash = get_image_dicom_hash(self.image)
|
||||
|
||||
image_hash = get_image_dicom_hash(None, dataset=ds)
|
||||
|
||||
self.image_md5_hash = image_hash
|
||||
|
||||
|
||||
Reference in New Issue
Block a user