Skip to content

imaging_report.py

activate(schema_name, imaging_schema_name, *, create_schema=True, create_tables=True)

Activate this schema.

Parameters:

Name Type Description Default
schema_name str

Schema name on the database server to activate the imaging_report schema

required
imaging_schema_name str

Schema name of the activated imaging element for which this imaging_report schema will be downstream from

required
create_schema bool

When True (default), create schema in the database if it does not yet exist.

True
create_tables bool

When True (default), create tables in the database if they do not yet exist.

True
Source code in element_calcium_imaging/imaging_report.py
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
def activate(
    schema_name: str,
    imaging_schema_name: str,
    *,
    create_schema: bool = True,
    create_tables: bool = True,
):
    """Activate this schema.

    Args:
        schema_name (str): Schema name on the database server to activate the
            `imaging_report` schema
        imaging_schema_name (str): Schema name of the activated imaging element for
            which this imaging_report schema will be downstream from
        create_schema (bool): When True (default), create schema in the database if it
            does not yet exist.
        create_tables (bool): When True (default), create tables in the database if they
            do not yet exist.
    """
    global imaging
    imaging = dj.create_virtual_module("imaging", imaging_schema_name)

    schema.activate(
        schema_name,
        create_schema=create_schema,
        create_tables=create_tables,
        add_objects=imaging.__dict__,
    )

ScanLevelReport

Bases: Computed

Scan level report with figures.

Attributes:

Name Type Description
imaging.Segmentation foreign key

Primary key from imaging.Segmentation.

cell_overlayed_image longblob

Plotly figure object showing the segmented cells on the average image.

Source code in element_calcium_imaging/imaging_report.py
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
@schema
class ScanLevelReport(dj.Computed):
    """Scan level report with figures.

    Attributes:
        imaging.Segmentation (foreign key): Primary key from imaging.Segmentation.
        cell_overlayed_image (longblob): Plotly figure object showing the segmented
            cells on the average image.
    """

    definition = """
    -> imaging.Segmentation
    ---
    cell_overlayed_image: longblob
    """

    def make(self, key):
        """Compute and ingest the plotly figure objects."""

        image_fig = cell_plot.plot_cell_overlayed_image(imaging, key)
        self.insert1({**key, "cell_overlayed_image": image_fig.to_json()})

make(key)

Compute and ingest the plotly figure objects.

Source code in element_calcium_imaging/imaging_report.py
56
57
58
59
60
def make(self, key):
    """Compute and ingest the plotly figure objects."""

    image_fig = cell_plot.plot_cell_overlayed_image(imaging, key)
    self.insert1({**key, "cell_overlayed_image": image_fig.to_json()})

TraceReport

Bases: Computed

Figures of traces.

Attributes:

Name Type Description
imaging.Segmentation.Mask foreign key

Primary key from imaging.Segmentation.Mask.

cell_traces longblob

Plotly figure object showing the cell traces.

Source code in element_calcium_imaging/imaging_report.py
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
@schema
class TraceReport(dj.Computed):
    """Figures of traces.

    Attributes:
        imaging.Segmentation.Mask (foreign key): Primary key from
            imaging.Segmentation.Mask.
        cell_traces (longblob): Plotly figure object showing the cell traces.
    """

    definition = """
    -> imaging.Segmentation.Mask
    ---
    cell_traces: longblob
    """

    @property
    def key_source(self):
        """Limit the TraceReport to Masks that have Activity table populated.
        database."""

        return imaging.Segmentation.Mask & imaging.Activity

    def make(self, key):
        """Compute and ingest the plotly figure objects."""

        trace_fig = cell_plot.plot_cell_traces(imaging, key)
        self.insert1({**key, "cell_traces": trace_fig.to_json()})

key_source property

Limit the TraceReport to Masks that have Activity table populated. database.

make(key)

Compute and ingest the plotly figure objects.

Source code in element_calcium_imaging/imaging_report.py
86
87
88
89
90
def make(self, key):
    """Compute and ingest the plotly figure objects."""

    trace_fig = cell_plot.plot_cell_traces(imaging, key)
    self.insert1({**key, "cell_traces": trace_fig.to_json()})