예제 #1
0
 def scan_link(self, instance: NIfTI) -> str:
     try:
         scan = Scan.objects.get(_nifti=instance)
     except Scan.DoesNotExist:
         pass
     else:
         return Html.admin_link("Scan", scan.id)
예제 #2
0
 def nifti(self, instance: Scan) -> str:
     if instance._nifti:
         model_name = instance.nifti.__class__.__name__
         pk = instance.nifti.id
         link = Html.admin_link(model_name, pk)
         url = reverse("mri:nifti_to_zip", args=(instance.nifti.id, ))
         button = DOWNLOAD_BUTTON.format(url=url,
                                         file_format="nifti",
                                         text="Download")
         return mark_safe(f"{link}{button}")
예제 #3
0
 def dicom_link(self, instance: Scan) -> str:
     if instance.dicom:
         model_name = instance.dicom.__class__.__name__
         pk = instance.dicom.id
         link = Html.admin_link(model_name, pk)
         url = reverse("dicom:to_zip", args=(instance.dicom.id, ))
         button = DOWNLOAD_BUTTON.format(url=url,
                                         file_format="dicom",
                                         text="Download")
         return mark_safe(f"{link}{button}")
예제 #4
0
 def measurement_link(self, instance: Session) -> str:
     if instance.measurement:
         model_name = instance.measurement.__class__.__name__
         pk = instance.measurement.id
         text = instance.measurement.title
         return Html.admin_link(model_name, pk, text)
예제 #5
0
 def subject_link(self, instance: Session) -> str:
     if instance.subject:
         model_name = instance.subject.__class__.__name__
         pk = instance.subject.id
         text = instance.subject.id_number
         return Html.admin_link(model_name, pk, text)
예제 #6
0
 def subject_link(self, instance: Scan) -> str:
     model_name = instance.session.subject.__class__.__name__
     pk = instance.session.subject.id
     return Html.admin_link(model_name, pk)
예제 #7
0
 def analysis_version_link(self, instance: Run) -> str:
     model_name = instance.analysis_version.__class__.__name__
     pk = instance.analysis_version.id
     text = str(instance.analysis_version)
     return Html.admin_link(model_name, pk, text)
예제 #8
0
 def run_link(self, instance: Run) -> str:
     model_name = instance.__class__.__name__
     pk = instance.id
     return Html.admin_link(model_name, pk)