A simple tool to enable blinded analysis of images (or other files) in a lab setting.
Perl
Switch branches/tags
Nothing to show
Clone or download
Latest commit 0b19503 Jan 13, 2016
Permalink
Failed to load latest commit information.
LICENSE.md Update LICENSE.md Oct 14, 2015
README.md Update README.md Jan 13, 2016
blindrename.pl

README.md

DOI

blindrename.pl is a simple, citable Perl script to rename all files in a folder, and create a simple CSV file in the same folder which serves as a "key" to match the original filename to the new, randomly-generated names. This is suitable for blind analysis, such as in a laboratory setting. And it's almost certainly easier than trying to create or find an appropriate ImageJ plugin. =)

There are no prerequisites or dependencies beyond Perl itself: just download it, make sure it's executable, and run it. On Linux or BSD or Mac, you should already have Perl, and I'd recommend putting it in /usr/local/bin and chmod 755 /usr/local/bin/blindrename.pl, after which you can just type blindrename.pl foldername and it will obligingly do its thing. On Windows... well, do whatever you need to do to run a Perl script on Windows. (If you're a lost little scientist with only Windows: check out Cygwin or ActivePerl for Windows implementations of Perl.)

blindrename.pl is reasonably smart - it will test to make sure that you supply a foldername, and that the foldername exists and is a folder. It also refuses to blindrename a folder twice - if there's already a keyfile.csv present, it'll die and let you know why. It logs each rename to keyfile.csv before actually performing the operation, and will die if it can't successfully rename a file. Finally, it will refuse to run as root, won't traverse subdirectories, and won't rename dotfiles. With all that said... this is still a potentially really destructive operation. Don't run blindrename.pl on any important system folders, please... including but not limited to your own home folder!

Sample usage:

me@banshee:~/git/blindanalysis$ ls -l /tmp/test
total 24
-rw-rw-r-- 1 me me    2 Oct 14 13:44 1.tif
-rw-rw-r-- 1 me me    2 Oct 14 13:44 2.tif
-rw-rw-r-- 1 me me    2 Oct 14 13:44 3.tif
-rw-rw-r-- 1 me me    2 Oct 14 13:44 4.tif
-rw-rw-r-- 1 me me    2 Oct 14 13:44 5
drwxrwxr-x 2 me me 4096 Oct 14 12:56 subdir

me@banshee:~/git/blindanalysis$ ./blindrename.pl /tmp/test
Renaming: 1.tif... 2.tif... 3.tif... 4.tif... 5... 
5 files successfully blind renamed; keyfile saved to /tmp/test/keyfile.csv.

me@banshee:~/git/blindanalysis$ ls -l /tmp/test
total 28
-rw-rw-r-- 1 me me    2 Oct 14 13:44 B4LOz.tif
-rw-rw-r-- 1 me me    2 Oct 14 13:44 Ek76e.tif
-rw-rw-r-- 1 me me    2 Oct 14 13:44 kdVFM.tif
-rw-rw-r-- 1 me me  131 Oct 14 14:02 keyfile.csv
-rw-rw-r-- 1 me me    2 Oct 14 13:44 Oklr1
drwxrwxr-x 2 me me 4096 Oct 14 12:56 subdir
-rw-rw-r-- 1 me me    2 Oct 14 13:44 wsy7e.tif

me@banshee:~/git/blindanalysis$ cat /tmp/test/keyfile.csv
"Original Filename","Cloaked Filename"
"1.tif","kdVFM.tif"
"2.tif","Ek76e.tif"
"3.tif","B4LOz.tif"
"4.tif","wsy7e.tif"
"5","Oklr1"