Use dict for roi selections
This commit is contained in:
parent
18b0066726
commit
a8fbcf8345
@ -53,6 +53,7 @@ doc = curdoc()
|
|||||||
doc.title = "pyzebra"
|
doc.title = "pyzebra"
|
||||||
|
|
||||||
global curent_h5_data, current_index, det_data
|
global curent_h5_data, current_index, det_data
|
||||||
|
roi_selection = {}
|
||||||
|
|
||||||
|
|
||||||
def update_image():
|
def update_image():
|
||||||
@ -477,6 +478,7 @@ selection_list = TextAreaInput(rows=7)
|
|||||||
|
|
||||||
|
|
||||||
def selection_button_callback():
|
def selection_button_callback():
|
||||||
|
global roi_selection
|
||||||
selection = [
|
selection = [
|
||||||
int(np.floor(det_x_range.start)),
|
int(np.floor(det_x_range.start)),
|
||||||
int(np.ceil(det_x_range.end)),
|
int(np.ceil(det_x_range.end)),
|
||||||
@ -486,10 +488,13 @@ def selection_button_callback():
|
|||||||
int(np.ceil(frame_range.end)),
|
int(np.ceil(frame_range.end)),
|
||||||
]
|
]
|
||||||
|
|
||||||
if selection_list.value == "":
|
filename_id = filelist.value[-8:-4]
|
||||||
selection_list.value = f"{selection}"
|
if filename_id in roi_selection:
|
||||||
|
roi_selection[f"{filename_id}"].append(selection)
|
||||||
else:
|
else:
|
||||||
selection_list.value = f"{selection_list.value},\n{selection}"
|
roi_selection[f"{filename_id}"] = [selection]
|
||||||
|
|
||||||
|
selection_list.value = str(roi_selection)
|
||||||
|
|
||||||
|
|
||||||
selection_button = Button(label="Add selection")
|
selection_button = Button(label="Add selection")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user