[OpenSPIM] ome-tiff output
HongKee Moon
moon at mpi-cbg.de
Mon Nov 6 11:20:02 CST 2017
Dear Christoph,
We have also faced those problems because the default image opener is trying to get the metadata for every file.
I really recommend you to make own ImageStack class for reading the metadata just once for your whole series.
We had to create our version of VirtualStack class based on https://imagej.nih.gov/ij/plugins/virtual-opener.html <https://imagej.nih.gov/ij/plugins/virtual-opener.html> to avoid redundant metadata reading. The below code is not a perfect version, please, use it as a reference.
Hopefully, it will help you.
Cheers,
HongKee
———————————————————
import ij.ImageStack;
import ij.process.ByteProcessor;
import ij.process.ImageProcessor;
import loci.formats.FormatException;
import loci.formats.ImageReader;
import loci.plugins.util.ImageProcessorReader;
import loci.common.services.DependencyException;
import loci.common.services.ServiceException;
import loci.common.services.ServiceFactory;
import loci.formats.FormatException;
import loci.formats.ImageReader;
import loci.formats.meta.IMetadata;
import loci.formats.services.OMEXMLService;
public class MyImageStack extends ImageStack
{
private int bitDepth;
private int width, height;
ImageProcessorReader imageProcessorReader;
private int zSize = 1, tSize = 1, cSize = 1;
private int cEffectiveSize = 1;
public void addSlice( String path )
{
if(path != null)
{
if(width == 0)
{
// create format reader
ImageReader reader = getImageReader( path );
// output dimensional information
int sizeX = reader.getSizeX();
this.width = sizeX;
int sizeY = reader.getSizeY();
this.height = sizeY;
// System.out.println("Effective C" + reader.getEffectiveSizeC());
setcEffectiveSize( reader.getEffectiveSizeC() );
int sizeC = reader.getSizeC();
int sizeZ = reader.getSizeZ();
int sizeT = reader.getSizeT();
// System.out.println( "C=" + sizeC + " Z=" + sizeZ + " T=" + sizeT );
setcSize( sizeC );
setzSize( sizeZ );
settSize( sizeT );
this.bitDepth = reader.getBitsPerPixel();
this.imageProcessorReader = new ImageProcessorReader( reader );
}
}
}
public ImageProcessor getProcessor(int n)
{
// properly implement to get ImageProcessor based on n
}
public static ImageReader getImageReader( String path )
{
ImageReader reader = null;
try
{
ServiceFactory factory = new ServiceFactory();
OMEXMLService service = factory.getInstance(OMEXMLService.class);
IMetadata meta = service.createOMEXMLMetadata();
// create format reader
reader = new ImageReader();
reader.setMetadataStore(meta);
// initialize file
// System.out.println(path);
reader.setId( path );
}
catch ( DependencyException e )
{
e.printStackTrace();
}
catch ( ServiceException e )
{
e.printStackTrace();
}
catch ( IOException e )
{
e.printStackTrace();
}
catch ( FormatException e )
{
e.printStackTrace();
}
return reader;
}
}
———————————————
> On Nov 6, 2017, at 10:43 AM, Christoph Sommer <christoph.sommer at ist.ac.at> wrote:
>
> Dear OpenSpim folks,
>
> thanks for creating such a great resource!
>
> We are currently using an OpenSpim setup and the created output is a multi-file ome-tiff. For many applications (e.g. the MVR from Stephan Preibisch et al.) we need to convert the ome-tiff to normal tiff.
>
> Unfortunately, for long time-lapse the conversion takes forever, since for each conversion step all meta-data is parsed from each single time point. My script uses the Bioformats ImporterOptions class, but I can't see how I can bypass the meta-data parsing. I also tried the 'bvconvert' command line script but also got issues there. Also reading from Python (e.g. with the module 'tifffile' only return always the first angle image-stack...)
>
> Would you have any idea?
>
> Cheers,
>
> Chris
>
>
> _______________________________________________
> OpenSPIM mailing list
> OpenSPIM at openspim.org
> http://openspim.org/mailman/listinfo/openspim
--
HongKee Moon
Scientific Software Engineer
Scientific Computing Facility
Max Planck Institute of Molecular Cell Biology and Genetics
Pfotenhauerstr. 108
01307 Dresden
Germany
fon: +49 351 210 1923
fax: +49 351 210 1907
www.mpi-cbg.de
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://openspim.org/pipermail/openspim/attachments/20171106/b445dc2d/attachment.html>
More information about the OpenSPIM
mailing list