extract a little more shared case /longs
This commit is contained in:
+3
-13
@@ -42,6 +42,7 @@ from generic.models import (
|
||||
Contrast,
|
||||
QuestionNote,
|
||||
SeriesBase,
|
||||
SeriesImageBase,
|
||||
)
|
||||
|
||||
# from generic.models import Examination, Site, Condition, Sign
|
||||
@@ -319,23 +320,12 @@ class Case(models.Model):
|
||||
return f"{self.pk}:{self.title} {'/'.join([str(c) for c in self.condition.all()])} [{', '.join(examinations)}]"
|
||||
|
||||
|
||||
class SeriesImage(models.Model):
|
||||
class SeriesImage(SeriesImageBase):
|
||||
image = models.FileField(upload_to=image_directory_path)
|
||||
position = models.IntegerField(default=0)
|
||||
upload_filename = models.CharField(max_length=255, blank=True)
|
||||
series = models.ForeignKey(
|
||||
"Series", related_name="images", on_delete=models.SET_NULL, null=True
|
||||
)
|
||||
|
||||
class Meta:
|
||||
ordering = ["position"]
|
||||
|
||||
def get_dicom_info(self):
|
||||
try:
|
||||
info = pretty_print_dicom(pydicom.read_file(self.image))
|
||||
except pydicom.errors.InvalidDicomError:
|
||||
info = "File is not a dicom."
|
||||
return info
|
||||
|
||||
|
||||
class SeriesFinding(models.Model):
|
||||
@@ -400,7 +390,7 @@ class Series(SeriesBase):
|
||||
|
||||
def get_full_str(self):
|
||||
if self.case:
|
||||
case_id = ", ".format([case.pk for case in self.case.all()])
|
||||
case_id = ", ".join([case.pk for case in self.case.all()])
|
||||
# case_id = self.case.pk
|
||||
else:
|
||||
case_id = "None"
|
||||
|
||||
Reference in New Issue
Block a user