ga_trial_pdf_jade
Generate a PDF report from a template.
Module
Functions
generate_pdf
def generate_pdf( file_name: Union[str, os.PathLike], report_info: AltrisRecordInfo, scans: Union[AltrisScan, list[AltrisScan]], metrics: Union[GAMetrics, list[GAMetrics]], 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.
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, Image], bscan_idx: int, bscan_total: int, bscan_w_mask: Union[str, os.PathLike, Image], legend2color: dict[str, tuple[int, int, int]], laterality: Optional[str] = None, bscan_en_face: Optional[Union[str, os.PathLike, 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, PIL.Image.Image, ForwardRef(None)]
- static
bscan_idx : int
- static
bscan_image : Union[str, os.PathLike, PIL.Image.Image]
- static
bscan_total : int
- static
bscan_w_mask : Union[str, os.PathLike, PIL.Image.Image]
- static
laterality : Optional[str]
- static
legend2color : dict
ReportJade
class ReportJade( record_info: AltrisRecordInfo, scan: Union[AltrisScan, list[AltrisScan]], metrics: Union[GAMetrics, list[GAMetrics]], 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.
Ancestors
- fpdf.fpdf.FPDF
- fpdf.graphics_state.GraphicsStateMixin
- fpdf.text_region.TextRegionMixin
Methods
footer
def footer(self) ‑> None:
Adds the footer to the report.
Adds 'Bitfount' and the page number to every report. This is called automatically by the FPDF class.
generate
def generate(self) ‑> None:
Generates the report.
This should be called by the user.
header
def header(self) ‑> None:
Adds the header to the report.
Adds the Bitfount logo to the top right of every page. This is called automatically by the FPDF class.