class VideoIfdoReportGenerator extends IfdoReportGenerator

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.

from  IfdoReportGenerator
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

Labels that have been used in this volume.

from  IfdoReportGenerator
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
protected Collection $users

Users that have been used in this volume.

from  IfdoReportGenerator
protected array $imageAnnotationLabels

All labels that should be contained in the iFDO.

from  IfdoReportGenerator
protected array $imageAnnotationCreators

All users that should be contained in the iFDO.

from  IfdoReportGenerator
protected array $imageSetItems

iFDO image-annotation arrays for each image of the volume.

from  IfdoReportGenerator
protected LabelSource $wormsLabelSource

Label source model for the WoRMS database.

from  IfdoReportGenerator

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 report 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
query()

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

Collection
getUsers()

Get all users who annotated in the volume.

Collection
getLabels()

Get all labels that were used in the volume.

processFile(Video $video)

Create the image-set-item entry for a video.

writeYaml(array $content, string $path)

Write the report YAML file.

bool
shouldConvertWormsId(Label $label)

Determine if the label ID should be converted to a WoRMS URN.

string
getWormsUrn(Label $label)

Get the WoRMS URN for a label (if it has one).

bool
isArrayItem(array $item)

Determine if an iFDO item is a single object or an array of objects.

mergeImageSetItem(string $key, array $ifdoItems)

Merge an image-set-items item of the original iFDO with the item generated by this report.

string
getGeometryName(Annotation $annotation)

Get an iFDO geometry name string for an annotation.

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.

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.

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

in ReportGenerator at line 173
string getName()

Get the report name.

Return Value

string

in ReportGenerator at line 183
string getFilename()

Get the report 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

at line 35
protected Builder query()

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

Return Value

Builder

at line 70
protected Collection getUsers()

Get all users who annotated in the volume.

Return Value

Collection

at line 93
protected Collection getLabels()

Get all labels that were used in the volume.

Return Value

Collection

at line 117
processFile(Video $video)

Create the image-set-item entry for a video.

Parameters

Video $video

in IfdoReportGenerator at line 189
protected writeYaml(array $content, string $path)

Write the report YAML file.

Parameters

array $content
string $path

in IfdoReportGenerator at line 201
protected bool shouldConvertWormsId(Label $label)

Determine if the label ID should be converted to a WoRMS URN.

Parameters

Label $label

Return Value

bool

in IfdoReportGenerator at line 213
protected string getWormsUrn(Label $label)

Get the WoRMS URN for a label (if it has one).

Parameters

Label $label

Return Value

string

in IfdoReportGenerator at line 226
protected bool isArrayItem(array $item)

Determine if an iFDO item is a single object or an array of objects.

Both are allowed for images. Only the latter should be the case for videos.

Parameters

array $item

Return Value

bool

in IfdoReportGenerator at line 241
protected mergeImageSetItem(string $key, array $ifdoItems)

Merge an image-set-items item of the original iFDO with the item generated by this report.

Parameters

string $key

Filename key of the item (guaranteed to be in $this->imageSetItems).

array $ifdoItems

image-set-items of the original iFDO

in IfdoReportGenerator at line 274
protected string getGeometryName(Annotation $annotation)

Get an iFDO geometry name string for an annotation.

Parameters

Annotation $annotation

Return Value

string

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