class NoveltyDetectionRequest extends JobRequest

This job is executed on a machine with GPU access.

Traits

Queueable

Properties

protected int $jobId

ID of the MAIA job.

from  JobRequest
protected array $jobParams

Parameters of the MAIA job.

from  JobRequest
protected string $volumeUrl

URL of the volume associated with the job.

from  JobRequest
protected array $images

Filenames of the images associated with the job, indexed by their IDs.

from  JobRequest
protected string $tmpDir

Temporary directory for files of this job.

from  JobRequest
int $timeout

Disable the timeout of the Laravel queue worker because this job may run long.

Methods

__construct(MaiaJob $job)

Create a new instance

void
failed(Exception $exception)

The job failed to process.

array
getGenericImages()

Create GenericImage instances for the images of this job.

cleanup()

Clean up temporary data produced by this job.

dispatchFailure(Exception $e)

Dispatch the job to notify the BIIGLE instance of a failure.

createTmpDir()

Create the temporary directory for this request.

ensureDirectory(string $path)

Creates the specified directory if it does not exist.

string
getTmpDirPath()

Get the path to the temporary directory.

dispatch(Job $job)

Dispatch a response (success or failure) to the BIIGLE instance.

string
python(string $command, string $log = 'log.txt')

Execute a Python command and return the path to a file containing the output.

array
parseAnnotations(array $images)

Parse the output JSON files to get the array of annotations for each image.

array
parseAnnotationsFile(GenericImage $image)

Parse the output JSON file of a single image.

handle()

Execute the job

string
createInputJson(array $images, array $paths)

Create the JSON file that is the input to the novelty detection script.

dispatchResponse(array $annotations)

Dispatch the job to store the novelty detection results.

array
maybeLimitAnnotations(array $annotations, int $limit)

Apply the limit for the maximum number of annotations.

Details

in JobRequest at line 57
__construct(MaiaJob $job)

Create a new instance

Parameters

MaiaJob $job

in JobRequest at line 71
void failed(Exception $exception)

The job failed to process.

Parameters

Exception $exception

Return Value

void

in JobRequest at line 85
protected array getGenericImages()

Create GenericImage instances for the images of this job.

Return Value

array

in JobRequest at line 98
protected cleanup()

Clean up temporary data produced by this job.

at line 92
protected dispatchFailure(Exception $e)

Dispatch the job to notify the BIIGLE instance of a failure.

Parameters

Exception $e

in JobRequest at line 116
protected createTmpDir()

Create the temporary directory for this request.

in JobRequest at line 131
protected ensureDirectory(string $path)

Creates the specified directory if it does not exist.

Parameters

string $path

at line 100
protected string getTmpDirPath()

Get the path to the temporary directory.

Return Value

string

in JobRequest at line 153
protected dispatch(Job $job)

Dispatch a response (success or failure) to the BIIGLE instance.

Parameters

Job $job

The job to be sent to the BIIGLE instance.

in JobRequest at line 168
protected string python(string $command, string $log = 'log.txt')

Execute a Python command and return the path to a file containing the output.

Parameters

string $command
string $log

Name of the log file to write any output to.

Return Value

string

Exceptions

Exception

in JobRequest at line 192
protected array parseAnnotations(array $images)

Parse the output JSON files to get the array of annotations for each image.

Parameters

array $images

GenericImage instances.

Return Value

array

in JobRequest at line 224
protected array parseAnnotationsFile(GenericImage $image)

Parse the output JSON file of a single image.

Parameters

GenericImage $image

Return Value

array

at line 26
handle()

Execute the job

at line 52
protected string createInputJson(array $images, array $paths)

Create the JSON file that is the input to the novelty detection script.

Parameters

array $images

GenericImage instances.

array $paths

Paths to the cached image files.

Return Value

string

Input JSON file path.

at line 84
protected dispatchResponse(array $annotations)

Dispatch the job to store the novelty detection results.

Parameters

array $annotations

at line 114
protected array maybeLimitAnnotations(array $annotations, int $limit)

Apply the limit for the maximum number of annotations.

Parameters

array $annotations
int $limit

Return Value

array