@@ -59,9 +59,13 @@ def __init__(self, **kwargs):
5959 self .line_sagittal .sigDragged .connect (self ._refresh_sagittal )
6060 self .plotItem_topview .addItem (self .line_coronal )
6161 self .plotItem_topview .addItem (self .line_sagittal )
62- # connect signals and slots
62+ # connect signals and slots: mouse moved
6363 s = self .plotItem_topview .getViewBox ().scene ()
6464 self .proxy = pg .SignalProxy (s .sigMouseMoved , rateLimit = 60 , slot = self .mouseMoveEvent )
65+ # combobox for the atlas remapping choices
66+ self .comboBox_mappings .addItems (self .ctrl .atlas .regions .mappings .keys ())
67+ self .comboBox_mappings .currentIndexChanged .connect (self ._refresh )
68+ # slider for transparency between image and labels
6569 self .slider_alpha .sliderMoved .connect (self .slider_alpha_move )
6670 self .ctrl .set_top ()
6771
@@ -119,10 +123,12 @@ def _refresh(self):
119123 self ._refresh_coronal ()
120124
121125 def _refresh_coronal (self ):
122- self .ctrl .set_slice (self .ctrl .fig_coronal , self .line_coronal .value ())
126+ self .ctrl .set_slice (self .ctrl .fig_coronal , self .line_coronal .value (),
127+ mapping = self .comboBox_mappings .currentText ())
123128
124129 def _refresh_sagittal (self ):
125- self .ctrl .set_slice (self .ctrl .fig_sagittal , self .line_sagittal .value ())
130+ self .ctrl .set_slice (self .ctrl .fig_sagittal , self .line_sagittal .value (),
131+ mapping = self .comboBox_mappings .currentText ())
126132
127133
128134class SliceView (QtWidgets .QWidget ):
@@ -255,10 +261,10 @@ class ControllerTopView(PgImageController):
255261 """
256262 TopView ControllerTopView
257263 """
258- def __init__ (self , qmain : TopView , res : int = 25 , volume = 'image' ):
264+ def __init__ (self , qmain : TopView , res : int = 25 , volume = 'image' , brainmap = 'Allen' ):
259265 super (ControllerTopView , self ).__init__ (qmain )
260266 self .volume = volume
261- self .atlas = AllenAtlas (res )
267+ self .atlas = AllenAtlas (res , brainmap = brainmap )
262268 self .fig_top = self .qwidget = qmain
263269 # Setup Coronal slice: width: ml, height: dv, depth: ap
264270 self .fig_coronal = SliceView (qmain , waxis = 0 , haxis = 2 , daxis = 1 )
@@ -271,7 +277,7 @@ def __init__(self, qmain: TopView, res: int = 25, volume='image'):
271277 self .set_slice (self .fig_sagittal )
272278 self .fig_sagittal .show ()
273279
274- def set_slice (self , fig , coord = 0 ):
280+ def set_slice (self , fig , coord = 0 , mapping = "Allen" ):
275281 waxis , haxis , daxis = (fig .ctrl .waxis , fig .ctrl .haxis , fig .ctrl .daxis )
276282 # construct the transform matrix image 2 ibl coordinates
277283 dw = self .atlas .bc .dxyz [waxis ]
@@ -281,7 +287,7 @@ def set_slice(self, fig, coord=0):
281287 # the ImageLayer object carries slice kwargs and pyqtgraph ImageSet kwargs
282288 # reversed order so the self.im is set with the base layer
283289 for layer in reversed (fig .ctrl .image_layers ):
284- _slice = self .atlas .slice (coord , axis = daxis , ** layer .slice_kwargs )
290+ _slice = self .atlas .slice (coord , axis = daxis , mapping = mapping , ** layer .slice_kwargs )
285291 fig .ctrl .set_image (layer .image_item , _slice , dw , dh , wl [0 ], hl [0 ], ** layer .pg_kwargs )
286292 fig .ctrl .slice_coord = coord
287293
@@ -354,10 +360,10 @@ class ImageLayer:
354360 slice_kwargs : dict = field (default_factory = lambda : {'volume' : 'image' , 'mode' : 'clip' })
355361
356362
357- def view (res = 25 , title = None , volume = 'image' , levels = None ):
363+ def view (res = 25 , title = None , brainmap = 'Allen' ):
358364 """
359365 """
360366 qt .create_app ()
361- av = TopView ._get_or_create (title = title , res = res )
367+ av = TopView ._get_or_create (title = title , res = res , brainmap = brainmap )
362368 av .show ()
363369 return av
0 commit comments