Not an ImageJ macro, but this is the shell script (linux and preobably
Mac) I used when I need random file name.
#!/bin/bash
# This script is to randomize the name of the file in the folder
# and keep a record for reversion
du -a *.tif | cut -f 2- > tempa
cp tempa tempb
foo=$(head tempb -n 1)
while [ -n "$foo" ]
do
md5=$(md5sum $foo)
echo "$md5" >> Randomized.txt
mv $(echo $md5 | cut -d" " -f 2-) $(echo $md5 | cut -d " " -f 1).tif
lines=$(cat tempb | wc -l)
file=$(tail -n $(expr $lines - 1) tempb)
echo "$file" > tempb
foo=$(head tempb -n 1)
done
rm tempb
--
Gabriel Lapointe, MSc.
Laboratoire de Luc DesGroseillers, PhD.
Pavillon Roger-Gaudry Local A-538
Département de biochimie
Faculté de Médecine de l'Université de Montréal
2900 boul. Édouard-Montpetit,
Montréal, Qc, H3T 1J4
Tel : (514) 343-6111 poste 5187
Fax : (514) 343-2210
[hidden email]
Andrew Bell wrote:
> Dear All,
>
> I am trying to write a macro to blind my images for analysis. I have so
> far succeeded in writing a macro that will rename an open image and save
> two copies, one with the original image file name attached. The problem I
> have is that my macro needs the image open, whereas I would like to apply
> it to a whole folder. Any suggestions would be greatly appreciated - my
> macro writing skills are not particularly good! Below is what I have so
> far.
>
> idcode = (random)
> trueid = getTitle();
> path = getDirectory("Choose a Directory ")+idcode save(path+".tif"); save
> (path+trueid);
>
> Thanks
>
> Andrew
>
> Andrew Bell
> Department of Infection, Immunity and Inflammation
> Maurice Shock Medical Sciences Building
> University of Leicester
> University Road
> Leicester
> LE1 9HN
> United Kingdom
>