How to batch-convert VSI files? (solved)

EDIT: it turns out there’s a much simpler way to do it, by choosing Process > Batch > Macro. Apparently this reads VSI files effortlessly, whereas Batch > Convert does not. Sneaky.

I’m trying to batch convert VSI to TIFF. For some reasons, the pre-existing plugins to do so (e.g. BIOP) are extremely slow, as if they’re analyzing the VSI files frame-by-frame (5000 frames per video usually).

So I’ve tried to hack up my own script:

> macro "vsitotiff" {
>       dir = getDirectory("Choose Source Directory ");                                    
>       list = getFileList(dir);                                                           // get the list of all filenames in the directory
>       setBatchMode(true);                                                                 // do not show the images while processing them
>       for (i=0; i<list.length; i++) {                                                     // go through the files of the folder
> //          showProgress(i+1, list.length); NOT SURE IF NEEDED                                                 // the progress of the processing of the actual stack is shown in the ImageJ window
>           open(dir+list[i]);                                                             // open an original stack
>           name = list[i];                                                                 // get the filename of the original stack
>           saveAs("tiff", name);                                                      // save each substack of the current original stack in the preset directory and close the substack
>           close();
>     }                                                                                     // end of "saving with suffices" path
> }                                                                                         // end of macro                                                        

But this gives me the error “this folder does not appear to contain any tiff, jpeg, bmp, dicom, gif, fits or pgm files.”

Recording the GUI command to open a VSI gives me the code open("org.scijava.Context@31fb9a17"); but I have no idea how to use this in a macro.

Anyone have a solution?

Hi @komodovaran,

What were your results with this? Is this all you had for code? And did you just put this code into the Process > Batch > Macro gui?

I’ve been struggling to convert my Olympus .vsi files for a while, so hopefully this will work.

This old conversaton lack the vsitotiff macro, which is the main topic of this subject. As such, it remains unsolved. Please reload the macro vsitotiff code accordingly.