====== renamedicom (function reference) ====== This function works in scripted mode, but also has its own UI window ===== Scripting ===== ===== UI-based ===== ==== Required steps ==== To open the UI of renamedicom, simply call the function without any arguments: renamedicom This opens the following dialog window: {{:renamedicom_ui.png|renamedicom UI window}} * select a search folder (either by entering the name or using the **Browse...** button) * once the settings (file extension limitation and sub-directory search) are made, click the **Search...** button * the list of found files will appear * files that are not supposed to be renamed (e.g. without extension limitation you also catch other files!) can be deleted by clicking the minus (**-**) button next to the list * you can click on any of those files and then read in the DICOM header by clicking the **//i//** button * from the available fields you can decide which fields to use to generate a target filename (see below) * this should be tested (!) by clicking the **Test** button * once everything seems to work fine, click the **Rename...** button This way, several subjects/session can be processed at once! ==== Target pattern creation ==== The target file name will be determined from DICOM header fiels. The pattern will be parsed for occurrences of the percent character (%), which must comply to the following format: * a single percent sign (**%**) * a valid printf length field (representing the length of the inserted particle, use a leading 0 for numbers, e.g. **04**) * the letter **k** (which indicates the separation of length and key number) * the dicom key as 8-digit number (with leading zeros, e.g. 00200010, representing the subject ID) Example: the string **'File-%04k00200010.dcm'** would be parsed to replace **%04k00200010** with the content of DICOM header field with key number 0020.0010, as a 4-digit number with leading zeros.