|
> Dear all: pls anyone knows some way to rename all the files
> (DICOM image files) enclosed on a same folder, as each file
> takes the name of a specif DICOM tag??
>
> I know a way to rename the file, but once the image is
> manually opened with ImageJ; then it neccessary to save the
> renamed image manually. Maybe someone knows a
> automaticcally way to do this.
>
> Thank you very much!!! Juan Francisco
You can do this using a macro. Here is an example that renames the
DICOMs in a folder to the value of the "Study Description" tag
("0008,1030"). It requires the 1.43k daily build, which adds the
getInfo(DICOM_Tag) macro function. You have watch out for missing tags
and tag values that contain characters (e.g., "/") that are not valid
in file names.
requires("1.43k");
dir = getDirectory("Choose a Folder");
list = getFileList(dir);
setBatchMode(true);
for (i=0; i<list.length; i++) {
open(dir+list[i]);
name = getInfo("0008,1030");
print(i, name);
if (name=="") exit("Not DICOM or missing tag");
err = File.rename(dir+list[i], dir+name+".dcm");
close;
}
-wayne
|