Login  Register

Re: Opening images from Different folders for stacking

Posted by degussa on Dec 18, 2008; 12:50am
URL: http://imagej.273.s1.nabble.com/Opening-images-from-Different-folders-for-stacking-tp3694155p3694157.html


Johannes Schindelin wrote

        for (i = 0; i < list1.length; i++) {
                if (File.exists(dir2 + list1[i]) &&
                                File.exists(dir3 + list1[i])) {
                        // do your thing
                }
        }

Hth,
Dscho

 Hi Johannes,

I agree with you on the repeating steps, but its necessary here because the files  i need must have just the last four numbers in the file names common to them. The folders i am using have equal numbers of files (1-1000), but different file name prefix such as MW24C2_1_S101_0020( folder 1), MW24C2_2_S101_0020( folder 2), MW24C2_3_S101_0020( folder 3).

Then the operation i need to perform requires the images to be open, which is why i cannot just check if they exist, i need to open the file and check that they all correspond in terms of the last four digit in their name before i make  a stack of them. but the code you suggested below only checks for the existence of the files and will not necessarily open them, and they need to be all open for the stack operation to take place.
The main problem with the macro which i cannot resolve is the non performance of the third loop. Thanks

Mosi degussa