Skip to content
Discussion options

You must be logged in to vote

This example should show you how to do that in the ipython console:
https://hyperspy.org/hyperspy-doc/current/auto_examples/region_of_interest/ROI_navigator.html

To store a ROI parameters and restore the ROI:

import hyperspy.api as hs

s = hs.data.two_gaussians()
roi = hs.roi.RectangularROI()

# Add ROI to signal
s.plot()
s_roi = roi.interactive(s, recompute_out_event=None, color='C1')

# Get roi parameters as dictionary
roi_parameters = roi.parameters

# Create new ROI using the dictionary of ROI parameters
roi2 = hs.roi.RectangularROI(**roi_parameters)
s_roi2 = roi2.interactive(s, recompute_out_event=None, color='C2')

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by ericpre
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #284 on June 06, 2025 17:46.