class BasicReportGenerator extends AnnotationReportGenerator

Traits

Properties

Collection $options

Options for this report.

from  ReportGenerator
string $name

Name of the report for use in text.

string $filename

Name of the report for use as (part of) a filename.

string $extension

File extension of the report file.

protected mixed $source

Source this report belongs to (e.g. a volume).

from  ReportGenerator
protected array $tmpFiles

Temporary files that are created when generating a report.

from  ReportGenerator
protected Collection $labels

Cache for labels of all label trees that are used for this report.

from  ReportGenerator
protected AnnotationSession $annotationSession

Cache for the annotation session the report may be restricted to.

from  VolumeReportGenerator
protected PythonScriptRunner $pythonScriptRunner

Object that runs the Python script to generate a report.

from  VolumeReportGenerator

Methods

static ReportGenerator
get(string $sourceClass, ReportType $type, array $options = [])

Get the report generator for the given type.

__construct(array $options = [])

Create a report generator instance.

string
generate(mixed $source)

Generate the report.

generateReport(string $path)

Generate the report.

setSource(mixed $source)

Set the source.

string
getName()

Get the report name.

string
getFilename()

Get the filename.

string
getFullFilename()

Get the filename with extension.

string
expandLabelName(int $id)

Constructs a label name from the names of all parent labels and the label itself.

Collection
getSiblingLabels(int $id)

Get all labels that belong to the label tree of the given label.

bool
shouldSeparateLabelTrees()

Should this report separate the output files for different label trees?

bool
shouldSeparateUsers()

Should this report separate the output files for different user?

array
getOnlyLabels()

Returns the array of label ids to which this report should be restricted.

bool
isRestrictedToLabels()

Determines if this report is restricted to a subset of labels.

setPythonScriptRunner(mixed $runner)

Set the Python script runner object.

Collection
getVolumeLabels()

Get all labels that are attached to the volume of this report (through project label trees).

executeScript(string $scriptName, string $path)

Execute the external report parsing Python script.

bool
isRestrictedToAnnotationSession()

Should this report be restricted an annotation session?

getAnnotationSession()

Returns the annotation session this report should be restricted to.

string
getAnnotationSessionName()

Get the name of the annotation session if it exists.

bool
isRestrictedToNewestLabel()

Determines if this report should take only the newest label of each annotation.

Builder
restrictToLabelsQuery(Builder $query, string $table)

Callback to be used in a when query statement that restricts the results to a specific subset of annotation labels.

Builder
restrictToExportAreaQuery(Builder $query)

Callback to be used in a when query statement that restricts the resulting annotations to the export area of the reansect of this report (if there is any).

bool
isRestrictedToExportArea()

Should this report be restricted to the export area?

array
getSkipIds()

Returns the annotation IDs to skip as outside of the volume export area.

Builder
restrictToNewestLabelQuery(Builder $query, string $table)

Callback to be used in a when query statement that restricts the results to the newest annotation labels of each annotation.

Builder
restrictToAnnotationSessionQuery(Builder $query)

Callback to be used in a when query statement that restricts the resulting annotation labels to the annotation session of this report.

Builder
initQuery(mixed $columns = [])

Assembles the part of the DB query that is the same for all annotation reports.

bool
shouldAggregateChildLabels()

Determines if this report should aggregate child labels.

Builder
query()

Assemble a new DB query for the volume of this report.

createCsv(Collection $labels, string $title = '')

Create a CSV file for a single plot of this report.

Details

in ReportGenerator at line 75
static ReportGenerator get(string $sourceClass, ReportType $type, array $options = [])

Get the report generator for the given type.

Parameters

string $sourceClass

Class name of the source model

ReportType $type

Type of the report to generate

array $options

Options for the report generator

Return Value

ReportGenerator

__construct(array $options = [])

Create a report generator instance.

Parameters

array $options

Options for the report

in ReportGenerator at line 116
string generate(mixed $source)

Generate the report.

Parameters

mixed $source

Source to generate the report for (e.g. a volume)

Return Value

string

Path to the generated report file.

at line 38
generateReport(string $path)

Generate the report.

Parameters

string $path

Path to write the report file to.

in ReportGenerator at line 163
setSource(mixed $source)

Set the source.

Parameters

mixed $source

string getName()

Get the report name.

Return Value

string

string getFilename()

Get the filename.

Return Value

string

in ReportGenerator at line 193
string getFullFilename()

Get the filename with extension.

Return Value

string

string expandLabelName(int $id)

Constructs a label name from the names of all parent labels and the label itself.

Example: Animalia > Annelida > Polychaeta > Buskiella sp

Parameters

int $id

Label ID

Return Value

string

in ReportGenerator at line 237
protected Collection getSiblingLabels(int $id)

Get all labels that belong to the label tree of the given label.

Parameters

int $id

Label ID

Return Value

Collection

in ReportGenerator at line 253
protected bool shouldSeparateLabelTrees()

Should this report separate the output files for different label trees?

Return Value

bool

in ReportGenerator at line 263
protected bool shouldSeparateUsers()

Should this report separate the output files for different user?

Return Value

bool

in ReportGenerator at line 273
protected array getOnlyLabels()

Returns the array of label ids to which this report should be restricted.

Return Value

array

in ReportGenerator at line 283
protected bool isRestrictedToLabels()

Determines if this report is restricted to a subset of labels.

Return Value

bool

setPythonScriptRunner(mixed $runner)

Set the Python script runner object.

Parameters

mixed $runner

protected Collection getVolumeLabels()

Get all labels that are attached to the volume of this report (through project label trees).

Return Value

Collection

protected executeScript(string $scriptName, string $path)

Execute the external report parsing Python script.

Parameters

string $scriptName

Name of the script to execute (in the reports.scripts config namespace)

string $path

Path to the file to store the generated report to

Exceptions

Exception

protected bool isRestrictedToAnnotationSession()

Should this report be restricted an annotation session?

Return Value

bool

protected AnnotationSession|null getAnnotationSession()

Returns the annotation session this report should be restricted to.

Return Value

AnnotationSession|null

protected string getAnnotationSessionName()

Get the name of the annotation session if it exists.

Return Value

string

protected bool isRestrictedToNewestLabel()

Determines if this report should take only the newest label of each annotation.

Return Value

bool

protected Builder restrictToLabelsQuery(Builder $query, string $table)

Callback to be used in a when query statement that restricts the results to a specific subset of annotation labels.

Parameters

Builder $query
string $table

Name of the annotation/image label DB table

Return Value

Builder

Builder restrictToExportAreaQuery(Builder $query)

Callback to be used in a when query statement that restricts the resulting annotations to the export area of the reansect of this report (if there is any).

Parameters

Builder $query

Return Value

Builder

protected bool isRestrictedToExportArea()

Should this report be restricted to the export area?

Return Value

bool

protected array getSkipIds()

Returns the annotation IDs to skip as outside of the volume export area.

We collect the IDs to skip rather than the IDs to include since there are probably fewer annotations outside of the export area.

Return Value

array

Annotation IDs

Builder restrictToNewestLabelQuery(Builder $query, string $table)

Callback to be used in a when query statement that restricts the results to the newest annotation labels of each annotation.

Parameters

Builder $query
string $table

Name of the annotation label DB table

Return Value

Builder

Builder restrictToAnnotationSessionQuery(Builder $query)

Callback to be used in a when query statement that restricts the resulting annotation labels to the annotation session of this report.

Parameters

Builder $query

Return Value

Builder

Builder initQuery(mixed $columns = [])

Assembles the part of the DB query that is the same for all annotation reports.

Parameters

mixed $columns

The columns to select

Return Value

Builder

protected bool shouldAggregateChildLabels()

Determines if this report should aggregate child labels.

Return Value

bool

at line 70
protected Builder query()

Assemble a new DB query for the volume of this report.

Return Value

Builder

at line 93
protected CsvFile createCsv(Collection $labels, string $title = '')

Create a CSV file for a single plot of this report.

Parameters

Collection $labels

The labels/rows for the CSV

string $title

The title to put in the first row of the CSV

Return Value

CsvFile