= Selecting files in the database [TODO] = ''Authors: Francois Tadel'' When you have lots of files in a folder, like multiple source reconstructions of time-frequency files for each trial, it is difficult to grab just the ones you are interested in. Two mechanisms can help you: the Filter box and the process "File > Select files with tag". == Filter text box == You want to select only the averages in the data files in the protocol TutorialRaw. Drag and drop all your files there, then use the Filter search box at the bottom-right of the Brainstorm window. Type the string "Avg" to keep only the files that contain this string. {{attachment:allFiles.gif}} The options offered in the Filter menu are: * '''Search comments''': Look for the string in the comments of the files, ie. what is displayed in the database explorer to represent them (the .Comment field) * '''Search file names''': Look for the string in the full file names (including their relative path) * '''Select files''': Only the files that contain the string are selected * '''Exclude files''': Only the files that DO NOT contain the string are selected * '''Reset filters''': Removes the current file filters applied on Process1 and Process2 * '''Case insensitive''': Note that the search is not sensitive to case. If you try to select the constrained sources using the string "Constr" in the comments, it would return all the files, because this matches at the same time "Constr" and "Unconstr". But you can do the opposite instead: exclude the files that contain "Unconstr". == Select files with tag == You can get to the exact same result by adding the process "File > Select files with tag" before the process you want to execute, to keep only a subset of the files that were placed in the Process1 list. It is less convenient in interactive mode because you don't see immediately the effect of your file filter, but it can be very useful when writing scripts. {{attachment:selectFiles.gif}} To see the list of files that was selected by the process, you can open the report viewer (File > Report viewer). This lists the input files (all the files) and the final files (the selected files), with a summary of how many files where selected on the top. {{attachment:selectReport.gif}} ==== After ==== This process is useless if it is not followed immediately by another process that would do something with the selected files. An application can be the deletion of some files, by adding the process "File > Delete files". == How to control the output file names == If you are running two processes with different parameters but that produce exactly the same file names and file comments, you wouldn't be able to select them with this process. But immediately after calling any process, you can add the process "File > Add tag" to tag one specific set of files, so that you can re-select them easily later. Example: you run twice the time-frequency decomposition with different options on the same files, tag the files after calculating them with different tags. {{attachment:addTag.gif}} == Select files from the pipeline editor [TODO] == * Process: File > Select files: Recordings * Process: File > Select files: Sources * Process: File > Select files: Time-frequency == Select subset [TODO] == * Process: File > Select files: Subset * Process: File > Select uniform number of trials * Set the Description field of all the processes.