ga_trial_pdf_jade
Generate a PDF report from a template using ReportLab.
Module
Functions
generate_pdf
def generate_pdf( file_name: Union[str, os.PathLike[str]], report_info: AltrisRecordInfo, scans: Union[AltrisScan, list[AltrisScan]], metrics: Union[GAMetrics, list[GAMetrics]], task_id: str, total_ga_area_lower_bound: float = 2.5, total_ga_area_upper_bound: float = 17.5,) ‑> None:Generates a PDF report.
Arguments
file_name: The name of the file to save the report to.report_info: The report info.scans: The scans.metrics: The GA metrics.total_ga_area_lower_bound: The lower bound for the GA area. This is used to generate the slider. Defaults to 2.5.total_ga_area_upper_bound: The upper bound for the GA area. This is used to generate the slider. Defaults to 17.5.task_id: The task ID.
Classes
AltrisRecordInfo
class AltrisRecordInfo( text_fields: list[tuple[str, str]], heading: Optional[str] = 'GA OCT REPORT',):Patient/scan information for the report.
Arguments
text_fields: A list of tuples of heading and value for the pdf top table.heading: The heading for the pdf. Defaults to None.
AltrisScan
class AltrisScan( bscan_image: Union[str, os.PathLike[str], Image], bscan_idx: int, bscan_total: int, bscan_w_mask: Union[str, os.PathLike[str], Image], legend2color: dict[str, tuple[int, int, int]], laterality: Optional[str] = None, bscan_en_face: Optional[Union[str, os.PathLike[str], Image]] = None,):Scan information for the report.
Arguments
name: Name of the scan.en_face_image_path: Path to the en-face image.bscan_image_path: Path to the B-scan image. This should be the bscan that corresponds to the location of the fovea.
Variables
- static
bscan_en_face : Union[str, os.PathLike[str], PIL.Image.Image, ForwardRef(None)]
- static
bscan_idx : int
- static
bscan_image : Union[str, os.PathLike[str], PIL.Image.Image]
- static
bscan_total : int
- static
bscan_w_mask : Union[str, os.PathLike[str], PIL.Image.Image]
- static
laterality : Optional[str]
- static
legend2color : dict[str, tuple[int, int, int]]
ReportJade
class ReportJade( record_info: AltrisRecordInfo, scan: Union[AltrisScan, list[AltrisScan]], metrics: Union[GAMetrics, list[GAMetrics]], task_id: str, total_ga_area_lower_bound: float = 2.5, total_ga_area_upper_bound: float = 17.5, **kwargs: Any,):Generate a PDF report from a template using ReportLab.
Arguments
report_info: Patient/scan information for the report.scan: List of scans to include in the report.metrics: List of GA metrics to include in the report.total_ga_area_lower_bound: The lower bound for the GA area. This is used to generate the slider. Defaults to 2.5.total_ga_area_upper_bound: The upper bound for the GA area. This is used to generate the slider. Defaults to 17.5.task_id: The task ID.
Methods
generate
def generate(self) ‑> None:Generates the report.
This should be called by the user.
output
def output(self, filename: Union[str, os.PathLike[str]]) ‑> None:Save the PDF to a file.
Arguments
filename: The path to save the PDF.