image findings will now save and reload stack index
This commit is contained in:
+15
-3
@@ -570,6 +570,9 @@ class SeriesImage(SeriesImageBase):
|
||||
except InvalidDicomError:
|
||||
return {}
|
||||
|
||||
def get_series(self):
|
||||
return self.series
|
||||
|
||||
# def get_image_dicom_json(self, image_index):
|
||||
# try:
|
||||
# with pydicom.dcmread(self.image) as ds:
|
||||
@@ -594,6 +597,7 @@ class SeriesFinding(models.Model):
|
||||
conditions = models.ManyToManyField(Condition, blank=True)
|
||||
annotation_json = models.TextField(null=True, blank=True)
|
||||
viewport_json = models.TextField(null=True, blank=True)
|
||||
current_image_id_index = models.IntegerField(null=True, blank=True)
|
||||
|
||||
def __str__(self) -> str:
|
||||
findings = self.findings.all().values_list("name")
|
||||
@@ -1273,9 +1277,12 @@ class UncategorisedDicom(models.Model):
|
||||
|
||||
basic_dicom_tags = models.JSONField(null=True, blank=True)
|
||||
|
||||
def check_for_duplicates(self, image_hash):
|
||||
def check_for_duplicates(self, image_hash=None|str):
|
||||
duplicate = None
|
||||
|
||||
if image_hash is None:
|
||||
image_hash = self.image_blake3_hash
|
||||
|
||||
if obj := UncategorisedDicom.objects.filter(
|
||||
image_blake3_hash=image_hash
|
||||
).first():
|
||||
@@ -1310,7 +1317,8 @@ class UncategorisedDicom(models.Model):
|
||||
|
||||
if duplicate is not None:
|
||||
if duplicate != self:
|
||||
raise DuplicateDicom
|
||||
raise DuplicateDicom(duplicate)
|
||||
|
||||
|
||||
# Hack for tests
|
||||
if image_blake3_hash != "1234":
|
||||
@@ -1349,9 +1357,13 @@ class UncategorisedDicom(models.Model):
|
||||
except pydicom.errors.InvalidDicomError:
|
||||
return None
|
||||
|
||||
def get_series(self):
|
||||
return self.series
|
||||
|
||||
|
||||
class DuplicateDicom(Exception):
|
||||
pass
|
||||
def __init__(self, duplicate):
|
||||
self.duplicate = duplicate
|
||||
|
||||
|
||||
class Resource(models.Model, AuthorMixin):
|
||||
|
||||
Reference in New Issue
Block a user