ImageJ not recognizing my directory for some reason?

I am trying to open a file using Image Sequence through a macro. The line of code that I’m having issues with is:
run(“Image Sequence…”, “open=[C:/Users/jcata/OneDrive/Documents/Research/120919_tiff/cell_001/0001.tif] number=800 starting=1 increment=1 scale=100 sort”);
ImageJ is properly reading the directory as listed and I know the directory is correct as it is identical to the directory listed in my file explorer, but despite that, ImageJ is telling me that the inputted directory is not found. I assume there is some issue with my formatting of the directory or there is some other reason ImageJ cannot find the directory. Sorry if this is a very basic question, but I have been struggling with this issue and wanted some guidance.

Hello Jenna -

Could this be the windows backslash ("\") path-separator issue?
If so, you might try (not tested):

run(“Image Sequence…”, “open=[C:\Users\jcata\OneDrive\Documents\Research\120919_tiff\cell_001\0001.tif] number=800 starting=1 increment=1 scale=100 sort”);

Hopefully the quotes (") will protect the backslashes in the pathname,
but if not, you might have to escape the backslashes further.

Thanks, mm

Hey! thank you for your response. I was wondering if this may be the problem but when I tried what you suggested with replacing the slashes with backslashes, I was having the issue of ImageJ not recognizing the backslashes. You mentioned at the end of your comment having to potentially escape the backslashes further, sorry that I don’t have much expertise on the topic but could you give an example on how I would do that?

I see one potential problem. This is a file path, not a directory path. Try removing the file name (“0001.tif”) from the end of the path. Some versions of ImageJ did not correctly handle paths to a file in the directory. Changing the “/” characters to “\” will not help since “\” is the escape character in string constants.

1 Like

Amazing amazing Amazing. That totally fixed the problem. Thank you so much, I’ve been messing with the macro for weeks and this simple fix solved my problem, thanks so much.