pyhealth.tasks.COVID19CXRImageGeneration#
- class pyhealth.tasks.covid19_cxr_generation.COVID19CXRImageGeneration(code_mapping=None)[source]#
Bases:
BaseTaskA task for generating chest X-ray images.
Every X-ray becomes one sample holding only the image, so the output schema is empty. Images are loaded as single-channel grayscale, since the X-rays carry no color, and resized to 128 x 128.
- input_schema#
A single key “image”, processed as a grayscale image of 128 x 128 pixels.
Examples
>>> from pyhealth.datasets import COVID19CXRDataset >>> from pyhealth.tasks import COVID19CXRImageGeneration >>> dataset = COVID19CXRDataset(root="/path/to/covid19_cxr") >>> samples = dataset.set_task(COVID19CXRImageGeneration())
Initialize a task with optional code mapping.
- Parameters:
code_mapping (
Optional[Dict[str,Tuple[str,str]]]) –optional dict mapping feature keys to
(source_vocab, target_vocab)tuples. For example:code_mapping={ "conditions": ("ICD9CM", "CCSCM"), "procedures": ("ICD9PROC", "CCSPROC"), "drugs": ("NDC", "ATC"), }
When provided, the corresponding
input_schemaentries are upgraded from"sequence"to("sequence", {"code_mapping": (src, tgt)})so that theSequenceProcessormaps raw codes at fit/process time.
- __init__(code_mapping=None)#
Initialize a task with optional code mapping.
- Parameters:
code_mapping (
Optional[Dict[str,Tuple[str,str]]]) –optional dict mapping feature keys to
(source_vocab, target_vocab)tuples. For example:code_mapping={ "conditions": ("ICD9CM", "CCSCM"), "procedures": ("ICD9PROC", "CCSPROC"), "drugs": ("NDC", "ATC"), }
When provided, the corresponding
input_schemaentries are upgraded from"sequence"to("sequence", {"code_mapping": (src, tgt)})so that theSequenceProcessormaps raw codes at fit/process time.
- pre_filter(df)#
- Return type:
LazyFrame