class SimulatedCamera(BaseCamera): (source)
Constructor: SimulatedCamera(thing_server_interface, shape, canvas_shape, frame_interval)
A Thing that simulates a camera for testing.
| Method | __enter__ |
Start the capture thread when the Thing context manager is opened. |
| Method | __exit__ |
Close the capture thread when the Thing context manager is closed. |
| Method | __init__ |
Initialise the simulated with settings for how images are generated. |
| Method | blob |
Undocumented |
| Method | capture |
Acquire one image from the camera and return as an array. |
| Method | colour |
Undocumented |
| Method | discard |
Discard frames so that the next frame captured is fresh. |
| Method | draw |
Place one sprite on canvas at given centre coordinates. |
| Method | full |
Perform a full auto-calibration. |
| Method | generate |
Generate coordinates of blobs and their sizes, centered around (0,0). |
| Method | generate |
Generate a canvas with generated blobs centered at the middle. |
| Method | generate |
Generate a frame with blobs based on the stage coordinates. |
| Method | generate |
Generate an image with blobs based on supplied coordinates. |
| Method | generate |
Generate sprites to populate the image. |
| Method | load |
Show the simulated sample. |
| Method | objective |
Undocumented |
| Method | remove |
Show the simulated background with no sample. |
| Method | set |
Set the simulated LED to on or off. |
| Class Variable | noise |
Undocumented |
| Class Variable | repeating |
Undocumented |
| Instance Variable | blank |
Undocumented |
| Instance Variable | blank |
Undocumented |
| Instance Variable | blobs |
Undocumented |
| Instance Variable | canvas |
Undocumented |
| Instance Variable | canvas |
Undocumented |
| Instance Variable | canvas |
Undocumented |
| Instance Variable | frame |
Undocumented |
| Instance Variable | glyph |
Undocumented |
| Instance Variable | led |
Undocumented |
| Instance Variable | low |
Undocumented |
| Instance Variable | shape |
Undocumented |
| Instance Variable | sprites |
Undocumented |
| Instance Variable | streaming |
Undocumented |
| Property | blob |
The number of blobs per million pixels. |
| Property | calibration |
Whether the camera needs calibrating. |
| Property | colour |
The colour of the blobs as a HTML hex string. |
| Property | manual |
The camera settings to expose as property controls in the settings panel. |
| Property | objective |
Objective magnification (e.g. 4, 10, 20, 40, 60, 100). |
| Property | primary |
The calibration actions for both calibration wizard and settings panel. |
| Property | secondary |
The calibration actions that appear only in settings panel. |
| Property | stream |
Whether the MJPEG stream is active. |
| Method | _capture |
Undocumented |
| Method | _capture |
Capture to a PIL image. This is not exposed as a ThingAction. |
| Method | _start |
Start the live stream. |
| Class Variable | _stage |
Undocumented |
| Instance Variable | _blob |
Undocumented |
| Instance Variable | _capture |
Undocumented |
| Instance Variable | _capture |
Undocumented |
| Instance Variable | _colour |
Undocumented |
| Instance Variable | _objective |
Undocumented |
| Instance Variable | _show |
Undocumented |
Inherited from BaseCamera:
| Method | background |
The name of the active background selector. |
| Method | background |
Validate and set background_detector_name. |
| Method | capture |
Acquire one image from the camera. |
| Method | capture |
Capture an image and save it to disk. |
| Method | capture |
Acquire one image from the camera, downsample, and return as an array. |
| Method | capture |
Capture an image to memory. This can be saved later with save_from_memory. |
| Method | change |
Change the mode the camera is streaming in. |
| Method | clear |
Clear all images in memory. |
| Method | grab |
Acquire one image from the preview stream and return as an array. |
| Method | grab |
Acquire one image from the preview stream and return as blob of JPEG data. |
| Method | grab |
Acquire one image from the preview stream and return its size. |
| Method | image |
Label the current image as either background or sample. |
| Method | kill |
Kill the streams now as the server is shutting down. |
| Method | record |
Record MJPEG stream framerate statistics. |
| Method | save |
Save an image that has been captured to memory. |
| Method | set |
Grab an image, and use its statistics to set the background. |
| Method | settle |
Sleep for the settling time, ready to provide a fresh frame. |
| Async Method | snapshot |
Return a snapshot from the microscope. |
| Class Variable | downsampled |
The downsampling factor when calling capture_downsampled_array. |
| Class Variable | lores |
Undocumented |
| Class Variable | mjpeg |
Undocumented |
| Class Variable | settling |
The settling time when calling the settle() method. |
| Class Variable | supported |
Undocumented |
| Class Variable | supports |
Undocumented |
| Property | background |
The active background detector instance. |
| Property | capture |
Modes the camera can use for capturing. |
| Property | focus |
Return the focus figure of merit. |
| Property | streaming |
Modes the camera can stream in. |
| Property | thing |
Return camera-specific metadata. |
| Method | _add |
Add the EXIF metadata for a JPEG image. |
| Method | _collect |
Return the metadata for a capture. |
| Async Method | _monitor |
Asynchronously monitor the timing on incoming frames. |
| Method | _validate |
Check input capture mode exists, always returns a valid mode. |
| Class Variable | _all |
Undocumented |
| Class Variable | _class |
Undocumented |
| Class Variable | _memory |
Undocumented |
| Instance Variable | _background |
Undocumented |
| Instance Variable | _default |
Undocumented |
| Instance Variable | _framerate |
Undocumented |
Inherited from OFMThing (via BaseCamera):
| Method | create |
Create a RelativeDataPath object with this Thing set as the saving Thing. |
| Property | data |
The data directory for this thing. |
| Property | show |
Whether to show in the Gallery. |
| Class Variable | _show |
Undocumented |
| Instance Variable | _data |
Undocumented |
type[ BaseException], exc_value: BaseException | None, traceback: TracebackType | None):
(source)
¶
Close the capture thread when the Thing context manager is closed.
lt.ThingServerInterface, shape: tuple[ int, int, int] = (tuple[ int, int, int] = (float = 0.1):
(source)
¶
Initialise the simulated with settings for how images are generated.
| Parameters | |
thinglt.ThingServerInterface | Undocumented |
shape:tuple[ | The shape (size) of the generated image. |
canvastuple[ | The shape (size) of the canvas generated on initialisation that images are cropped from. If this is too large the it uses resources, but its size limits the range of motion of the simulation. |
framefloat | Nominally the time between frames on the MJPEG stream, however the rate may be slower due to calculation time for focus. |
str = 'standard', raw: bool = False) -> NDArray:
(source)
¶
Acquire one image from the camera and return as an array.
This function will produce a nested list containing an uncompressed RGB image. It's likely to be highly inefficient - raw and/or uncompressed captures using binary image formats will be added in due course.
| Parameters | |
capturestr | (Optional) The name of the capture mode as defined by the camera. |
raw:bool | Raw Capture is not implemented for the simulation microscope. Setting this to True will result in an error. |
| Returns | |
NDArray | Undocumented |
Discard frames so that the next frame captured is fresh.
There is nothing to do as this is a simulation!
np.ndarray, sprite: np.ndarray, centre_y: int, centre_x: int):
(source)
¶
Place one sprite on canvas at given centre coordinates.
Note that self.canvas is modified in place.
| Parameters | |
canvas:np.ndarray | Undocumented |
sprite:np.ndarray | The sprite array to place on the canvas. |
centreint | The y coordinate to place the centre of the sprite. |
centreint | The x coordinate to place the centre of the sprite. |
Perform a full auto-calibration.
For the simulation microscope the process is:
- remove_sample
- set_background
- load_sample
Generate coordinates of blobs and their sizes, centered around (0,0).
Note that blob density is determined by sample size and n_blobs, and for larger samples n_blobs will need increasing to keep a high level of sample coverage per field of view.
| Parameters | |
nint | The number of blobs to generate. |
Generate a canvas with generated blobs centered at the middle.
Canvas is int16 so that random noise can be added to simulation image before changing to unit8 to stop wrapping.
Generate an image with blobs based on supplied coordinates.
| Parameters | |
pos:tuple[ | a 3-item tuple containing the x,y,z coordinates of the 'stage' |
| Returns | |
Image.Image | Undocumented |
The colour of the blobs as a HTML hex string.
The string can either be a single colour (e.g. "#c5247f") or a list of colours separated by semicolons (e.g. "#c5247f; #b937b9"). Additional spaces are allowed between colours.
Start the live stream.
The _start_streaming method is used a camera Thing to begin streaming images or to adjust the stream resolution if streaming is already active.
The simulation camera does not currently support the resolution argument. It will always issue a warning that the resolution is not respected. If called while already streaming, the warning will be emitted and no other action will be taken.
| Parameters | |
mode:str | The name of the streaming mode to use. |