Camera scripting Andreas Mittelberger Outline 1. Nion Swift camera - - PowerPoint PPT Presentation

camera scripting
SMART_READER_LITE
LIVE PREVIEW

Camera scripting Andreas Mittelberger Outline 1. Nion Swift camera - - PowerPoint PPT Presentation

Camera scripting Andreas Mittelberger Outline 1. Nion Swift camera API 2. Scientific cameras 3. Webcams 4. Simple scientific cameras Nion Swift camera API User interface ... (nionui) Core (nionswift) hardware control extensions


slide-1
SLIDE 1

Camera scripting

Andreas Mittelberger

slide-2
SLIDE 2
slide-3
SLIDE 3

Outline

  • 1. Nion Swift camera API
  • 2. Scientific cameras
  • 3. Webcams
  • 4. “Simple” scientific cameras
slide-4
SLIDE 4

Nion Swift camera API

Core (nionswift) User interface (nionui) extensions ... hardware control (nionswift-instrumentation)

slide-5
SLIDE 5

Nion Swift camera API

nionswift-instrumentation scan device camera device video device

slide-6
SLIDE 6

Nion Swift camera API

camera device video device

  • Meant for scientific cameras
  • Full control over the device (via the

frame_parameters object)

  • Usually comes with a graphical user

interface (control panel)

  • Meant for “simple” cameras
  • Only supports “Play” and “Pause”
  • No extra control panel, just the buttons in

the data item panel

  • Can be controlled via API
  • Data acquisition via API
  • Usually high data rates (compared to scanning)
slide-7
SLIDE 7

Camera panel types

camera device

camera_panel_type = "ronchigram" camera_panel_type = "eels" camera_panel_type = "andor_eels"

slide-8
SLIDE 8

Webcams - built-in support

conda install -n nionswift -c nion nionswift-video-capture opencv pip install nionswift-video-capture opencv-python

First we have to install the nionswift-video-capture plugin: video device

slide-9
SLIDE 9

Webcams - built-in support

Edit Preferences video device

slide-10
SLIDE 10

Webcams - third party

video device Edit Preferences

slide-11
SLIDE 11

“Simple” scientific camera

video device

slide-12
SLIDE 12

“Simple” scientific camera

video device

slide-13
SLIDE 13

“Simple” scientific camera

video device

slide-14
SLIDE 14

Camera scripting

from nion.utils import Registry stem_controller = Registry.get_component("stem_controller") ronchigram = stem_controller.ronchigram_camera frame_parameters = ronchigram.get_current_frame_parameters() # adjust frame_parameters here if desired frame_parameters["exposure_ms"] = 200 # start the camera ronchigram.start_playing(frame_parameters) # grab two consecutive frames, with a guaranteed start time after the first call frame1 = ronchigram.grab_next_to_start()[0] frame2 = ronchigram.grab_next_to_finish()[0] # stop the camera ronchigram.stop_playing()

slide-15
SLIDE 15

Get the code

  • Webcam plugin:

https://github.com/Brow71189/SwiftCam

  • “Simple” scientific camera: (careful this experimental code!)

https://github.com/Brow71189/matrix_vision

18

slide-16
SLIDE 16

Thank you for your attention