Пример #1
0
 def reset_view(self):
     """ Reset the view of the active image. If synchronization is enabled, 
         other images will also reset.
     """
     
     for image in self.ui.image_grid :
         image.reset_view()
         image.render()
Пример #2
0
    def _set_crosshair(self, value):
        if value not in ["full", "partial", "none"]:
            raise medipy.base.Exception(
                "Unknown crosshair mode: {0!r}".format(value))

        self._crosshair = value

        for image in self._images:
            image.crosshair = value
            image.render()
Пример #3
0
    def _on_center(self, event):

        if not self._synchronization["center"]:
            return

        for image in self._images:
            if image != event.object:
                image.remove_observer("center", self._on_center)
                if self.display_coordinates == "index":
                    image.center_index_position = event.object.center_index_position
                else:
                    image.center_physical_position = event.object.center_physical_position
                image.render()
                image.add_observer("center", self._on_center)
Пример #4
0
    def _on_colormap_display_range(self, event):

        if not self._synchronization["display_range"]:
            return

        for image in self._images:
            if image != event.object:
                image.remove_observer("colormap_display_range",
                                      self._on_colormap_display_range)
                source_colormap = event.object.get_layer_colormap(
                    event.layer_index)
                destination_colormap = image.get_layer_colormap(
                    event.layer_index)
                destination_colormap.display_range = source_colormap.display_range
                image.render()
                image.add_observer("colormap_display_range",
                                   self._on_colormap_display_range)
Пример #5
0
 def _set_slices(self, value):
     self._slices = value
     self.ui.image_grid.slice_mode = value
     
     # Update the tensor display mode
     for image in self.ui.image_grid :
         for index in range(len(image.layers)) :
             render = False
             if image.get_layer_class(index) == medipy.diffusion.gui.Tensor2Layer :
                 image.set_layer_property(index, "display_mode", self.tensor2_display_mode)
                 render = True
             if render :
                 image.render()
     
     # Update GUI
     item_id = wx.xrc.XRCID("view_" + value)
     item = self.GetMenuBar().FindItemById(item_id)
     item.Check()
     # Update preferences
     self._preferences.set("Display/slices", value)
Пример #6
0
 def _set_tensor2_display_mode(self, value):
     if value not in ["principal_direction_voxel", 
                      "principal_direction_line", "ellipsoid"] :
         raise medipy.base.Exception(
             "Unknown display mode: {0}".format(repr(value)))
     self._tensor2_display_mode = value
     
     for image in self.ui.image_grid :
         for index in range(len(image.layers)) :
             render = False
             if image.get_layer_class(index) == medipy.diffusion.gui.Tensor2Layer :
                 image.set_layer_property(index, "display_mode", self.tensor2_display_mode)
                 render = True
             if render :
                 image.render()
     
     # Update GUI
     item_id = wx.xrc.XRCID("tensor2_display_" + value)
     item = self.GetMenuBar().FindItemById(item_id)
     item.Check()
     
     # Update preferences
     self._preferences.set("Display/tensor2", value)
Пример #7
0
 def _set_corner_annotations_visibility(self, value):
     self._corner_annotations_visibility = value
     for image in self._images:
         image.corner_annotations_visibility = value
         image.render()
Пример #8
0
 def _set_convention(self, value):
     self._convention = value
     for image in self._images:
         image.convention = value
         image.render()
Пример #9
0
 def _set_orientation_visibility(self, value):
     self._orientation_visibility = value
     for image in self._images:
         image.orientation_visibility = value
         image.render()
Пример #10
0
 def _set_scalar_bar_visibility(self, value):
     self._scalar_bar_visibility = value
     for image in self._images:
         image.scalar_bar_visibility = value
         image.render()
Пример #11
0
 def _set_display_coordinates(self, value):
     self._display_coordinates = value
     for image in self._images:
         image.display_coordinates = value
         image.render()
Пример #12
0
 def _set_interpolation(self, value):
     self._interpolation = value
     for image in self._images:
         image.interpolation = value
         image.render()
Пример #13
0
 def _set_slice_mode(self, value):
     self._slice_mode = value
     for image in self._images:
         image.slice_mode = value
         image.render()