Skip to content

03. Changing selection of ROI

Jane Ling edited this page Jul 17, 2023 · 8 revisions

To change the selection of cells after initializing the PecanPie object, you may either define the new selection as a list or interactivly select/de-select cells from a figure

Defining selection with a list

A list can be defined in many ways. Here are two examples which gives the same results.

cells_to_process = np.linspace(0, 5, 5, endpoint=False, dtype='int')

or

cells_to_process = [0, 1, 2, 3, 4]

cells_to_plot can be defined in the same way.
IMPORTANT: If any of the two selections is not provided, the unprovided set will be reset to the default value.
After defining the selections, run the following line. It will check the validity of the new selection and update the metadata.

s2p.change_cell_selection(cells_to_process, cells_to_plot)

Defining selection interactively

The following codes will open a figure, in which the selected ROIs are shown with green contour. You may click on ROIs to select or de-select them. When you are happy with the selection, press ENTER on the keyboard to exit the figure. Metadata will be automatically updated.

s2p.cells_to_process_from_fig()
s2p.cells_to_plot_from_fig()

image

Clone this wiki locally