Hi forum users,
My name is Marco. The following script is able to read a previously saved ROI containing mapping coordinates (X, Y) into Iolite v4 (Detail tab > Region of interest tab > listed here). This first version was contributed by @Joe (24 Aug, 2024).
`
import os
from iolite.QtGui import QFileDialog
file_searched = QFileDialog.getOpenFileName()
if not file_searched:
raise RuntimeError('No file.')
format = ".csv"
parentDir, temp = os.path.split(file_searched)
import pandas as pd
import numpy as np
import glob
path_list = glob.glob(f"{parentDir}/*{format}", recursive = True)
for file in path_list:
temp, filename = os.path.split(file)
filename1 = filename.replace(format, "")
df = pd.read_csv(file)
imaging.spaceToChannels()
x = data.timeSeries('SpaceX').data()
y = data.timeSeries('SpaceY').data()
search_dist = 10 #spot size=0.1
mask = []
for index, row in df.iterrows():
d = ((x - row['x'])**2 + (y - row['y'])**2)**0.5
mask = np.union1d(mask, np.where(d < search_dist))
imaging.createROI(filename1, mask)
print(f"Ready. {filename1}")
`
In the script, The ROIs need to live the in same folder and they will be serially imported to your project after the file names.
There is one issue though, I am not sure you can run (refresh) the data reduction process separately for each ROI. Also, what happens if you change your selection intervals and re-quantify? Do the ROI data (that you can re-export) updates?
I hope this is helpful.
Thanks.
Cordially,