NiftiMasker Timeseries Extraction

Hi all, I am running representational similarity analysis, which requires me to have signal data for each time point to calculate the coefficients between voxels and/or trials. I am using NifitMasker to extract the time series data from each voxel in defined ROI, with this command “masker.fit_transform(func image file)”. I think this data is for each voxel in each TR (i.e., 150-sh rows now)? I wondered whether I could use the onset file to just lock the window to extract the time series for that specific process (i.e., 50 trials)? I used randomized inter-trial jitter (range is 500ms to 5000ms), and the TR is 2s in my study. I also wondered this would be an issue for using this method? Thank you so much for your help in advance.