50
50
51
51
52
52
def build_photometrics_connection (camera_connection ):
53
- """Build Sutter Stage Serial Port connection
53
+ """Build Photometrics connection
54
54
55
55
Import Photometrics API and Initialize Camera Controller.
56
56
@@ -66,7 +66,6 @@ def build_photometrics_connection(camera_connection):
66
66
"""
67
67
try :
68
68
pvc .init_pvcam ()
69
- # camera_names = Camera.get_available_camera_names()
70
69
camera_to_open = Camera .select_camera (camera_connection )
71
70
camera_to_open .open ()
72
71
return camera_to_open
@@ -97,8 +96,8 @@ def __init__(
97
96
microscope_name : str ,
98
97
device_connection : Any ,
99
98
configuration : Dict [str , Any ],
100
- * args : Optional [Any ],
101
- ** args : Optional [Any ],
99
+ * _ : Optional [Any ],
100
+ ** __ : Optional [Any ],
102
101
) -> None :
103
102
"""Initialize the Photometrics class.
104
103
@@ -113,6 +112,15 @@ def __init__(
113
112
"""
114
113
super ().__init__ (microscope_name , device_connection , configuration )
115
114
115
+ #: int: Binning in x direction
116
+ self .x_binning = None
117
+
118
+ #: int: Binning in y direction
119
+ self .y_binning = None
120
+
121
+ #: obj: Data Buffer
122
+ self ._data_buffer = None
123
+
116
124
self .camera_parameters ["supported_readout_directions" ] = [
117
125
"Top-to-Bottom" ,
118
126
"Bottom-to-Top" ,
@@ -128,19 +136,19 @@ def __init__(
128
136
self .configuration = configuration
129
137
130
138
#: int: Exposure Time in milliseconds
131
- self ._exposuretime = 20
139
+ self ._exposure_time = 20
132
140
133
141
#: int: Scan Mode (0 = Normal, 1 = ASLM)
134
- self ._scanmode = 0
142
+ self ._scan_mode = 0
135
143
136
144
#: int: Scan Delay
137
- self ._scandelay = 1
145
+ self ._scan_delay = 1
138
146
139
147
#: int: Number of frames
140
- self ._numberofframes = 100
148
+ self ._number_of_frames = 100
141
149
142
150
#: obj: Data Buffer
143
- self ._databuffer = None
151
+ self ._data_buffer = None
144
152
145
153
#: int: Number of frames received
146
154
self ._frames_received = 0
@@ -182,7 +190,7 @@ def __del__(self):
182
190
183
191
@classmethod
184
192
def connect (cls , camera_connection ):
185
- """Build Sutter Stage Serial Port connection
193
+ """Build Photometrics Stage Serial Port connection
186
194
187
195
Import Photometrics API and Initialize Camera Controller.
188
196
@@ -232,7 +240,7 @@ def report_settings(self):
232
240
print ("internal_line_interval" )
233
241
print ("sensor size" + str (self .camera_controller .sensor_size ))
234
242
print ("image_height and width" + str (self .x_pixels ) + ", " + str (self .y_pixels ))
235
- print ("exposure_time" + str (self ._exposuretime ))
243
+ print ("exposure_time" + str (self ._exposure_time ))
236
244
237
245
def close_camera (self ):
238
246
"""Close Photometrics Camera"""
@@ -251,7 +259,7 @@ def set_sensor_mode(self, mode):
251
259
modes_dict = {"Normal" : 0 , "Light-Sheet" : 1 }
252
260
if mode in modes_dict :
253
261
self .camera_controller .prog_scan_mode = modes_dict [mode ]
254
- self ._scanmode = modes_dict [mode ]
262
+ self ._scan_mode = modes_dict [mode ]
255
263
else :
256
264
print ("Camera mode not supported" + str (modes_dict [mode ]))
257
265
logger .debug ("Camera mode not supported" + str (modes_dict [mode ]))
@@ -278,7 +286,7 @@ def set_readout_direction(self, mode):
278
286
logger .debug ("Camera readout direction not supported" )
279
287
280
288
def calculate_readout_time (self ):
281
- """Calculate duration of time needed to readout an image.
289
+ """Calculate duration of time needed to read out an image.
282
290
283
291
Calculates the readout time and maximum frame rate according to the camera
284
292
configuration settings.
@@ -290,7 +298,7 @@ def calculate_readout_time(self):
290
298
Returns
291
299
-------
292
300
readout_time : float
293
- Duration of time needed to readout an image in seconds.
301
+ Duration of time needed to read out an image in seconds.
294
302
"""
295
303
296
304
# get the readout time from the Photometrics camera in us
@@ -313,9 +321,9 @@ def set_exposure_time(self, exposure_time):
313
321
exposure_time : float
314
322
Exposure time in milliseconds.
315
323
"""
316
- self ._exposuretime = int (exposure_time * 1000 )
317
- self .camera_controller .exp_time = self ._exposuretime
318
- self .camera_controller .start_live (self ._exposuretime )
324
+ self ._exposure_time = int (exposure_time * 1000 )
325
+ self .camera_controller .exp_time = self ._exposure_time
326
+ self .camera_controller .start_live (self ._exposure_time )
319
327
return exposure_time
320
328
321
329
def set_line_interval (self , line_interval_time ):
@@ -326,8 +334,8 @@ def set_line_interval(self, line_interval_time):
326
334
line_interval_time : float
327
335
Line interval duration.
328
336
"""
329
- # todo calculate line delay from scandelay
330
- self ._scandelay = line_interval_time
337
+ # todo calculate line delay from scan delay
338
+ self ._scan_delay = line_interval_time
331
339
self .camera_controller .prog_scan_line_delay = line_interval_time
332
340
333
341
def calculate_light_sheet_exposure_time (
@@ -354,36 +362,36 @@ def calculate_light_sheet_exposure_time(
354
362
"""
355
363
356
364
# size of ROI
357
- nbrows = self .y_pixels
365
+ number_rows = self .y_pixels
358
366
359
367
# transform exposure time to milliseconds for Photometrics API.
360
368
full_chip_exposure_time = full_chip_exposure_time * 1000
361
369
362
370
# equations to calculate ASLM parameters
363
- linedelay = self .camera_parameters .get ("unitforlinedelay" , 1 ) / 1000
364
- ASLM_lineExposure = int (
365
- np .ceil (full_chip_exposure_time / (1 + (1 + nbrows ) / shutter_width ))
371
+ line_delay = self .camera_parameters .get ("unitforlinedelay" , 1 ) / 1000
372
+ aslm_line_exposure = int (
373
+ np .ceil (full_chip_exposure_time / (1 + (1 + number_rows ) / shutter_width ))
366
374
)
367
- ASLM_line_delay = (
375
+ aslm_line_delay = (
368
376
int (
369
377
np .ceil (
370
- (full_chip_exposure_time - ASLM_lineExposure )
371
- / ((nbrows + 1 ) * linedelay )
378
+ (full_chip_exposure_time - aslm_line_exposure )
379
+ / ((number_rows + 1 ) * line_delay )
372
380
)
373
381
)
374
382
- 1
375
383
)
376
384
377
- ASLM_acquisition_time = (
378
- (ASLM_line_delay + 1 ) * nbrows * linedelay
379
- + ASLM_lineExposure
380
- + (ASLM_line_delay + 1 ) * linedelay
385
+ aslm_acquisition_time = (
386
+ (aslm_line_delay + 1 ) * number_rows * line_delay
387
+ + aslm_line_exposure
388
+ + (aslm_line_delay + 1 ) * line_delay
381
389
)
382
390
383
- self .camera_parameters ["line_interval" ] = ASLM_lineExposure
384
- self ._exposuretime = ASLM_lineExposure
385
- self ._scandelay = ASLM_line_delay
386
- return ASLM_lineExposure / 1000 , ASLM_line_delay , ASLM_acquisition_time / 1000
391
+ self .camera_parameters ["line_interval" ] = aslm_line_exposure
392
+ self ._exposure_time = aslm_line_exposure
393
+ self ._scan_delay = aslm_line_delay
394
+ return aslm_line_exposure / 1000 , aslm_line_delay , aslm_acquisition_time / 1000
387
395
388
396
def set_binning (self , binning_string ):
389
397
"""Set Photometrics binning mode.
@@ -488,11 +496,11 @@ def initialize_image_series(self, data_buffer=None, number_of_frames=100):
488
496
"""
489
497
490
498
# set camera parameters depending on acquisition mode
491
- self ._scanmode = self .camera_controller .prog_scan_mode
492
- if self ._scanmode == 1 :
499
+ self ._scan_mode = self .camera_controller .prog_scan_mode
500
+ if self ._scan_mode == 1 :
493
501
# Programmable scan mode (ASLM)
494
502
self .camera_controller .exp_mode = "Edge Trigger"
495
- self .camera_controller .prog_scan_line_delay = self ._scandelay
503
+ self .camera_controller .prog_scan_line_delay = self ._scan_delay
496
504
self .camera_controller .exp_out_mode = 4
497
505
498
506
else :
@@ -502,7 +510,7 @@ def initialize_image_series(self, data_buffer=None, number_of_frames=100):
502
510
503
511
# Prepare for buffered acquisition
504
512
#: int: Number of frames
505
- self ._numberofframes = number_of_frames
513
+ self ._number_of_frames = number_of_frames
506
514
507
515
#: obj: Data Buffer
508
516
self ._data_buffer = data_buffer
@@ -542,13 +550,12 @@ def _receive_images(self):
542
550
frame ["pixel_data" ][:]
543
551
)
544
552
# Delete copied frame for memory management
545
- frame = None
546
553
del frame
547
554
548
555
frame_to_return = [self ._frames_received ]
549
556
self ._frames_received += 1
550
557
# check to make sure the next frame exist in buffer
551
- if self ._frames_received >= self ._numberofframes :
558
+ if self ._frames_received >= self ._number_of_frames :
552
559
self ._frames_received = 0
553
560
return frame_to_return
554
561
0 commit comments