It’s all about Presentation!
We’re excited to announce the release of BIDScoin 4.5.0, packed with two key user-facing enhancements.
What’s new
-
New Participants table – Define the content of the participants.tsv/json files directly in the template bidsmap / bidseditor.
The selected DICOM mappings
tab shows how DICOM source data types (left) are mapped to BIDS output data (right).
-
New events2bids
plugin – Convert NeuroBS Presentation logfiles into events.tsv files effortlessly.
Edit window for conversion of Presentation log data to BIDS output data. Note that, since the first row condition has a non-selective matching pattern .*
, all input rows are included. Also note that, for selected rows, each of the two subsequent conditions add data (“go” and “stop”) to the new task
output column.
What else changed
- The plugin programming interface now uses abstract base classes
- Manufacturer-derived source data is no longer saved in the
derivatives
folder (BIDS doesn’t require this).
- Comments in the study bidsmap are now removed due to recurrent issues with invalid (ruamel) yaml-files
- In the bidsmap, anon is now a
bidscoin
option rather than a plugin
option
- Original images are no longer removed by
echocombine
(when the input and output folder were the same)
woooah great work!! I’d love to see something similar for psychopy
Thanks, I also like how it worked out. I tried to make it as generic as possible, meaning that all that is needed is some code that parses your psychopy as a pandas table. I myself have never worked with psychopy, so I don’t know how to do this in a standardized way. From what I heard, it seems that the way events are written to disk in psychopy depends totally on the programmer who implemented the paradigm? That makes makes writing a generic plugin a lot harder of course…
To give you an idea, here is the relevant part of the current Presentation plugin, shortened to only parse the event table see here for the actual code):
class PresentationEvents(EventsParser):
"""Parser for Presentation (Neurobs) logfiles"""
def __init__(self, sourcefile: Path, _data: dict, options: dict):
"""
Reads the event table from the Presentation log file
:param sourcefile: The full filepath of the log file
:param data: The run['events'] data (from a bidsmap)
:param options: The plugin options
"""
super().__init__(sourcefile, _data, options)
# Read the log-tables from the Presentation log file
self._sourcetable = pd.read_csv(self.sourcefile, sep='\t', skiprows=options.get('skiprows',3), skip_blank_lines=True)
"""The Presentation log-tables (https://www.neurobs.com/pres_docs/html/03_presentation/07_data_reporting/01_logfiles/index.html)"""
@property
def logtable(self) -> pd.DataFrame:
"""Returns a Presentation log-table"""
df = self._sourcetable
nrows = len(df)
stimulus_header = (df.iloc[:, 0] == 'Event Type').idxmax() or nrows
# Get the row indices to slice the event table
if self.options['table'] == 'event':
begin = 0
end = min(stimulus_header)
# Return the sliced table
return df.iloc[begin:end]
So all that is really needed for a psychopy plugin is some code to load a table (just any table basically) from its log file. Then we are in business and BIDScoin will do the rest…
1 Like