Description

This notebook allows you to rename a set of files. You can define

  • the prefix file name from scratch or used part of the old name
  • the starting index
  • the index number of digits

The main use of this notebook

In this notebook, we will correctly format the file name index of the file selected. This allows the sorting of the file name to work all the time. For example, there are many cases where the images are saved using the following convention.

Wrong filename index

    image_1.tif
image_2.tif
image_3.tif
image_4.tif
...
image_10.tif
image_11.tif
...
image_100.tif
    

Using this convention, any sorting algorithm will sort them as followed

wrong sorting

    image_1.tif
image_10.tif
image_100.tif
...
    

So this notebook will fix this issue by renaming the files

correct filename index

    image_001.tif
image_002.tif
image_003.tif
image_004.tif
...
image_010.tif
image_011.tif
...
image_100.tif
    

Tutorial

Select your IPTS

 

Need help using the IPTS selector?

Select images to rename

Using the folder selection tool, select the folder for which you want to rename the files.

 

Only the most dominant file type (ex: tiff, fits) from the folder will be renamed

Define new naming schema

Current schema name

This is where you define the way the current file name is defined. You need to specify what string separates the first part of the file name from the index. If you decide to not fully rename the images, the string before this separator will be kept in the new file name.

The Random input dropdown list displays a random selection of the input files, to help you in defining the separator string. Play with it to make sure you correctly defined the current file name (what is the prefix, what is a separator). Use the slider to the right of the file name prefix to define the prefix part of the name (as shown in the following animation).

New naming schema

Here, you define if you want to keep the old prefix or not, the new prefix file name, index separatornumber of digits, and offset of this index.

Example:

  • old file name: experiment_0845454_10.tiff
  • separator: _
  • new file name prefix: my_image
  • number of digits: 4
  • offset: 15
  • extension: .tif
  • new file name will be: my_image_0025.tif

Checking new names

Running this cell will display the old file names and the new file names.

Output folder

You simply need to select where the newly renamed file will be created. Then the program will copy the selected files and rename them in the folder you selected.