imageimage-processingsplitdata-conversionimagej-macro

Bio-Formats conversion of LIF file with splitted timestep and splitted channel (macro ImageJ)


I'm trying to open a LIF file (Leica format) with ImageJ in a macro. The LIF file contains 4 "LIF series" of 52 or 45 timesteps. Each timestep contains 3 channels.

filepath = "/mydirectory/myfile.lif";
out = "/mydirectory/myTIFF/";
run("Bio-Formats Importer", "open=["+ filepath + "] color_mode=Default split_timepoints split_channels view=Hyperstack stack_order=XYCZT");
for(myt ...) { // I don't know how having all the UNIQUE timestep of all the series
    for(mych=0;mych<3;mych++) {
        saveAs("Tiff", "save=[" + out + "/myID" + "_t" + myt + "_ch" + mych + ".tif" + "]");
    }
}

I want to save as TIFF one file per timestep+channel.

But 1: I cannot open the series with the "split_channels" and "split_timepoins" options cause ImageJ crash (not enough memory) 2: I cannot open all the series automatically cause ImageJ crash... And I don't know how I can open the series one by one. Or/and the timestep one by one

Do you know how I can open timestep by timestep the LIF file and save it automatically in Fiji ? Or how I can split channel and timestep of a LIF file ?


Solution

  • I find what I needed ! I can work serie by serie now.

    Ext.setId(path);// Initializes the given path (filename).
    Ext.getSeriesCount(seriesCount); // Gets the number of image series in the active dataset.
    

    I have to do the code to generate unique timestep but it should be fine.

    Source