Leica Tiff sequence plugin and Stack Deinterleaver plugin

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Leica Tiff sequence plugin and Stack Deinterleaver plugin

lechristophe
I'm heavily using the Leica TIFF sequence importer from Tony Collins :

http://rsb.info.nih.gov/ij/plugins/leica-tiff.html

There is one problem I really would like to be able to solve, but I'm
struggling with java (I'm more used to macros).

The plugin parses the .txt file generated by Leica confocal microscopes,
and generates stacks of the different series (usually z-series) in an
experiment folder. There is an option to "Split Channels", that is
deinterleave the Z-series to get each color channel in a different stack.

The plugin keeps the image informations in the generated stack
(individual names as label in the stack, scaling) but only if the "Split
Channels" options is not checked. The problem with the code is the same
in the "Stack Deinterleaver" plugin that is part of the MBF distribution
of ImageJ, as it is used after initial file parsing and generation of
the interleaved stack in the plugin. If you deinterleave a stack you
loose all informations for the images.

Below is the code for the Deinterleaver function from the plugin. Do you
know I it could be modified to keep image informations ? Another
consequence is that when you do a getDirectory("image") on a stack
generated by this plugin, it returns an empty string.

Christophe Leterrier


CODE START

public ImagePlus deInterleave(ImagePlus imp, int sections, int chn, int
tCh, Calibration cal, String name, String col)

        {

        ImagePlus imp2;

        ImageStack img1 = imp.getStack();

        ImageStack img2 = new ImageStack(imp.getWidth(), imp.getHeight());

        int nSlices = (int)((int)imp.getStackSize()/(int)tCh);

        ImageProcessor ip = imp.getProcessor();

        for (int s=0; s<nSlices; s++)

                {

                ip = img1.getProcessor(chn+(tCh*s));

                img2.addSlice(null, ip);

                }

        new ImagePlus(name+ " "+col,img2).show();



        imp2 = WindowManager.getCurrentImage();



        if((col.indexOf("Red")<0)&&
(col.indexOf("Green")<0)&&(col.indexOf("Blue")<0)){

                                        //IJ.showMessage(col);

                                        col = "Grays";



                                        }

       

        if(imp2.getType()!=imp2.COLOR_RGB) IJ.run(col);

        imp2.setCalibration(cal);

        imp2.updateAndDraw();

        imp2.getWindow().repaint();

        return (imp2);

        }

CODE END