4545import matplotlib .pyplot as plt
4646import numpy as np
4747import copy
48- from abc import ABCMeta
48+ import abc
4949
5050# Local Imports
5151from navigate .controller .sub_controllers .gui import GUIController
5959logger = logging .getLogger (p )
6060
6161
62- class ABaseViewController (metaclass = ABCMeta ):
62+ class ABaseViewController (metaclass = abc . ABCMeta ):
6363 """Abstract Base View Controller Class."""
6464
65+ @abc .abstractmethod
6566 def __init__ (self ):
6667 pass
6768
69+ @abc .abstractmethod
6870 def update_snr (self ):
6971 """Updates the signal-to-noise ratio."""
7072 pass
7173
74+ @abc .abstractmethod
7275 def initialize (self ):
7376 """Initializes the camera view controller."""
7477 pass
7578
79+ @abc .abstractmethod
7680 def set_mode (self , mode = "" ):
7781 """Sets mode of camera_view_controller."""
7882 pass
7983
84+ @abc .abstractmethod
8085 def initialize_non_live_display (self , microscope_state , camera_parameters ):
8186 """Initialize the non-live display."""
8287 pass
8388
89+ @abc .abstractmethod
8490 def try_to_display_image (self , image ):
8591 """Try to display an image."""
8692 pass
@@ -252,6 +258,23 @@ def __init__(self, view, parent_controller=None):
252258 command = lambda : self .update_transpose_state (display = True )
253259 )
254260
261+ def initialize (self , name , data ):
262+ """Sets widgets based on data given from main controller/config.
263+
264+ Parameters
265+ ----------
266+ name : str
267+ 'minmax', 'image'.
268+ data : list
269+ Min and max intensity values.
270+ """
271+
272+ pass
273+
274+ def update_snr (self ):
275+ """Updates the signal-to-noise ratio."""
276+ pass
277+
255278 def set_mode (self , mode = "" ):
256279 """Sets mode of camera_view_controller.
257280
@@ -283,7 +306,7 @@ def flip_image(self, image):
283306 image = image [::- 1 , :]
284307
285308 return image
286-
309+
287310 def transpose_image (self , image ):
288311 """Transpose the image according to the flip flags.
289312
@@ -1312,20 +1335,20 @@ def preallocate_matrices(self):
13121335
13131336 def get_mip_image (self , channel_idx ):
13141337 """Get MIP image according to perspective and channel id
1315-
1338+
13161339 Parameters
13171340 ----------
13181341 channel_idx : int
13191342 channel id
1320-
1343+
13211344 Returns
13221345 -------
13231346 image : numpy.ndarray
13241347 Image data
13251348 """
13261349 if self .xy_mip is None :
13271350 return None
1328-
1351+
13291352 display_mode = self .render_widgets ["perspective" ].get ()
13301353 if display_mode == "XY" :
13311354 image = self .xy_mip [channel_idx ]
@@ -1336,7 +1359,7 @@ def get_mip_image(self, channel_idx):
13361359
13371360 image = self .flip_image (image )
13381361 return image
1339-
1362+
13401363 def initialize_non_live_display (self , microscope_state , camera_parameters ):
13411364 """Initialize the non-live display.
13421365
@@ -1354,7 +1377,9 @@ def initialize_non_live_display(self, microscope_state, camera_parameters):
13541377 # in microns
13551378 z_range = microscope_state ["abs_z_end" ] - microscope_state ["abs_z_start" ]
13561379 # TODO: may stretch by the value of binning.
1357- self .Z_image_value = int (self .XY_image_width * camera_parameters ["fov_x" ] / z_range )
1380+ self .Z_image_value = int (
1381+ self .XY_image_width * camera_parameters ["fov_x" ] / z_range
1382+ )
13581383 self .prepare_mip_view ()
13591384 self .update_perspective ()
13601385
0 commit comments