Re: Including folder name in image naming by a macro

Posted by BenTupper on
URL: http://imagej.273.s1.nabble.com/Including-folder-name-in-image-naming-by-a-macro-tp3689365p3689367.html

Hi,

On Feb 16, 2010, at 3:08 PM, John Oreopoulos wrote:

> Oliver, have you tried the "getFileList" macro function?
>
> http://rsbweb.nih.gov/ij/developer/macro/functions.html#getFileList
>

You might also want to look at the many "File.xyz" functions - in  
particular the File.getName and File.getParent functions.  You can see  
them all here...

http://rsbweb.nih.gov/ij/developer/macro/functions.html#F

//this takes the name of the file (including path info) and creates a  
new file name using the directory name
dir = File.getParent(file);
dirName = File.getName(dir);
newFile = dir + File.separator + dirName + ".tif";

Ben


> Maybe this will help.
>
> John Oreopoulos, BSc,
> PhD Candidate
> University of Toronto
> Institute For Biomaterials and Biomedical Engineering
> Centre For Studies in Molecular Imaging
>
>
> On 16-Feb-10, at 2:54 PM, Oliver Tills wrote:
>
>> Hi, is there a way when running a macro which is running on images  
>> in subfolders to use the folder name in the naming of the images  
>> produced by the macro?
>>
>> Also, I've succesfully got a macro to run on my PC, but when I try  
>> to move it across to a Mac it doesn't work. I think the problem  
>> might be the file extension, how should a Mac file extension be  
>> written and how do you find it e.g. the C:\\ part of the extension?
>>
>> Many thanks,
>>
>> Oli Tills
>> [hidden email]