LSM MDB and LOCI

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

LSM MDB and LOCI

suendermann
Dear Users,

I'm writing a plugin, which uses loci-tools.jar to open lsm image files.
The lsm files (z-stacks) belong to a timeseries, where every timepoint
is stored in a separate file. Additionally, every series has its own mdb
file. Now I found the following strange behavior: If I open any lsm file
via the loci-tools (code see below) it always opens the first timepoint
in the series. If I delete the mdb file, the file I choosed will be opened.
Deleting the mdb file is not my method of choice, so my question is: How
can I program a workaroud (on plugin basis)?

Greetings
   Fred


I use ImageJ 1.42k
Java jdk 1.6.0_16
loci-tools revision 5626

code:
    private ImagePlus openWithLOCI(String fName){
        ImagePlusReader r = new ImagePlusReader(new
ChannelSeparator(ImagePlusReader.makeImageReader()));
        try {
            r.setId(fName);
            IJ.showStatus("opening "+fName);
            int num = r.getImageCount();
            int w = r.getSizeX();
            int h = r.getSizeY();
            ImageStack stack = new ImageStack(w,h);
            IJ.showStatus("opening...");
            for (int i=0;i<num;i++){
                IJ.showProgress(i, (num-1));
                ImageProcessor lociIP = r.openProcessors(i)[0];
                stack.addSlice(""+i, lociIP);
            }
            r.close();
            IJ.showStatus("generating ImagePlus");
            ImagePlus lociImp = new ImagePlus(fName,stack);
            IJ.showStatus("");
            return lociImp;
        } catch (FormatException e){
            IJ.error(e.getMessage());
            return null;
        } catch (IOException e){
            IJ.error(e.getMessage());
            return null;
        }
    }
Reply | Threaded
Open this post in threaded view
|

Re: LSM MDB and LOCI

Melissa Linkert-2
Hi Fred,

If you add this line of code immediately before the try/catch block:

r.setGroupFiles(false);

...then only the selected LSM file will be opened.  You will need to
update to the latest trunk build of loci_tools.jar in order for this
to work correctly.

Please let me know if that does not solve the problem for you.

Regards,
-Melissa

On Thu, Jan 7, 2010 at 4:31 AM, suendermann
<[hidden email]> wrote:

> Dear Users,
>
> I'm writing a plugin, which uses loci-tools.jar to open lsm image files. The
> lsm files (z-stacks) belong to a timeseries, where every timepoint is stored
> in a separate file. Additionally, every series has its own mdb file. Now I
> found the following strange behavior: If I open any lsm file via the
> loci-tools (code see below) it always opens the first timepoint in the
> series. If I delete the mdb file, the file I choosed will be opened.
> Deleting the mdb file is not my method of choice, so my question is: How can
> I program a workaroud (on plugin basis)?
>
> Greetings
>  Fred
>
>
> I use ImageJ 1.42k
> Java jdk 1.6.0_16
> loci-tools revision 5626
>
> code:
>   private ImagePlus openWithLOCI(String fName){
>       ImagePlusReader r = new ImagePlusReader(new
> ChannelSeparator(ImagePlusReader.makeImageReader()));
>       try {
>           r.setId(fName);
>           IJ.showStatus("opening "+fName);
>           int num = r.getImageCount();
>           int w = r.getSizeX();
>           int h = r.getSizeY();
>           ImageStack stack = new ImageStack(w,h);
>           IJ.showStatus("opening...");
>           for (int i=0;i<num;i++){
>               IJ.showProgress(i, (num-1));
>               ImageProcessor lociIP = r.openProcessors(i)[0];
>               stack.addSlice(""+i, lociIP);
>           }
>           r.close();
>           IJ.showStatus("generating ImagePlus");
>           ImagePlus lociImp = new ImagePlus(fName,stack);
>           IJ.showStatus("");
>           return lociImp;
>       } catch (FormatException e){
>           IJ.error(e.getMessage());
>           return null;
>       } catch (IOException e){
>           IJ.error(e.getMessage());
>           return null;
>       }
>   }
>