[ome-devel] Compression in OME-TIFF file?

Curtis Rueden ctrueden at wisc.edu
Tue Sep 8 18:33:07 BST 2009


Hi Nick,

I will second Will's suggestion to try the latest Bio-Formats trunk build
(in addition to the link Will sent, it is also linked directly from the
Bio-Formats download page:
http://www.loci.wisc.edu/ome/formats-download.html). In particular, you
should no longer receive the error message about SamplesPerPixel with that
build.

However, there is still a critical bug in the Bio-Formats Exporter. The
problem is basically that the OME-XML block from the imported data gets fed
directly to the exporter, when doing so is not always appropriate. There are
times when some of the metadata has changed (e.g., the image has been
cropped) and the OME-XML values need to be updated.

For more information, feel free to browse the ticket:
  https://skyking.microscopy.wisc.edu/trac/java/ticket/405

For now, here is a working macro to generate some compressed OME-TIFF files
from the MRI Stack example dataset:

dir = getDirectory("Choose output directory");
run("MRI Stack (528K)");
run("Save", "save="+dir+"/mri-stack.tif");
close();
run("Bio-Formats Importer", "open="+dir+"/mri-stack.tif view=Hyperstack
stack_order=XYCZT");
run("Bio-Formats Exporter", "save="+dir+"/mri-stack-lzw.ome.tif
compression=LZW");
run("Bio-Formats Exporter", "save="+dir+"/mri-stack-j2k.ome.tif
compression=J2K");
run("Bio-Formats Exporter", "save="+dir+"/mri-stack-j2k-lossy.ome.tif
compression=J2K-Lossy");
run("Bio-Formats Exporter", "save="+dir+"/mri-stack-jpeg.ome.tif
compression=JPEG");
close();

Here is a file size comparison:
1,138,427 mri-stack.tif
654,514 mri-stack-lzw.ome.tif
422,370 mri-stack-j2k.ome.tif
275,379 mri-stack-j2k-lossy.ome.tif
144,257 mri-stack-jpeg.ome.tif

-Curtis

On Tue, Sep 8, 2009 at 3:38 AM, Will Moore <will at lifesci.dundee.ac.uk>wrote:

>  Hi Nick,
>  One more thing to try, just to use the latest build of Bio-Formats.
> You can get this from our automated build site. For LOCI this is
>
> http://hudson.openmicroscopy.org.uk/job/LOCI/
>
> Grab the latest loci_tools.jar there and put in ImageJ plugins folder
> etc...
>
>  Let us know if that helps.
> If not, could you send any error message you get when exporting from ImageJ
> fails?
>
>  Cheers,
>
>    Will.
>
>
>
> On 8 Sep 2009, at 09:31, Nick Perry wrote:
>
> Nope, I gave up.
>
> Nick
>
> On Tue, Sep 8, 2009 at 10:29 AM, Will Moore <will at lifesci.dundee.ac.uk>wrote:
>
>>  Hi Nick,
>>  I just tried this yesterday and also failed to export from ImageJ with
>> Bioformats. (Don't remember the error I'm afraid).
>> However, I tried again today (possibly with different images) and it seems
>> to be working OK (no errors).
>>
>> Hopefully you've got this to work now?
>>
>>    Will.
>>
>>
>> On 7 Sep 2009, at 08:12, Nick Perry wrote:
>>
>> So I can't actually get the ImageJ plugin for bio-formats to actually
>> work... Every time I import an image either with the LOCI tool or the
>> standard ImageJ 'open' and try to export it, I get errors. I've tried
>> playing around with the import options as well (splitting channels into
>> separate images, etc). I've attached one of the error messages as an image.
>> Anyone know how to actually get this to work..? I've tried opening .ome.tif
>> files and a .jpg.
>>
>> Nick
>>
>> On Fri, Sep 4, 2009 at 6:15 PM, Ghislain Bonamy <GBonamy at gnf.org> wrote:
>>
>>>  Nick,
>>>
>>>
>>> I am sure you are aware of this, but though I would point this out
>>> anyways. The JPEG200 compression is a lossless compression (not like regular
>>> JPEG). The advantage of LZW over JPEG2000 is that the image can still be
>>> read by other image readers. On the flip side JPEG2000 will give you much
>>> better compression of your data (in particular if your data is complex), but
>>> the image will only be correctly handled by Bio-Formats.
>>>
>>>
>>> Best,
>>>
>>>
>>> Ghislain Bonamy, PhD
>>>
>>> __________________________________________
>>>
>>> Research Investigator
>>>
>>>
>>> *G*enomic Institute of the
>>>
>>> *N*ovartis Research
>>>
>>> *F*oundation
>>>
>>> Department of Informatics, room C117
>>>
>>> 10675 John Jay Hopkins Drive
>>>
>>> San Diego CA 92121
>>>
>>> USA
>>>
>>>
>>> +1 (858) 812-1534 (W & F)
>>>
>>> +1 (757) 941-4194 (H)
>>>
>>> +1 (858) 354-7388 (M)
>>>
>>> www.gnf.org
>>>
>>>
>>> *From:* ome-devel-bounces at lists.openmicroscopy.org.uk [mailto:
>>> ome-devel-bounces at lists.openmicroscopy.org.uk] *On Behalf Of *Curtis
>>> Rueden
>>> *Sent:* Friday, September 04, 2009 6:56 AM
>>> *To:* Nick Perry
>>> *Cc:* ome-devel at lists.openmicroscopy.org.uk
>>> *Subject:* Re: [ome-devel] Compression in OME-TIFF file?
>>>
>>>
>>> Hi Nick,
>>>
>>>
>>> You can generate one using the Bio-Formats Exporter plugin for ImageJ.
>>>
>>>
>>> First, open any image. Then choose Plugins > LOCI > Bio-Formats Exporter,
>>> save as OME-TIFF format, and a dialog box will appear allowing you to select
>>> the compression type—give either "LZW" or "JPEG2000" a try.
>>>
>>> The compression will change nothing about the embedded OME-XML, only how
>>> the TIFF planes are stored in the file. And all OME-TIFF compression is
>>> plane by plane (i.e., no compression over a 3D block of pixels).
>>>
>>>
>>> -Curtis
>>>
>>>
>>> On Fri, Sep 4, 2009 at 4:16 AM, Nick Perry <nperry at stanford.edu> wrote:
>>>
>>> Hi,
>>>
>>> Does anyone know where I can download an example OME-TIFF file that is
>>> compressed? I see on the LOCI site (
>>> http://www.loci.wisc.edu/ome/ome-tiff-data.html) that it is possible to
>>> compress the data in an OME-TIFF file, like with LZW for example, and I'm
>>> trying to find out where in an OME-TIFF file the compression is specified.
>>> (This all hinges of course on my intuition that it is the raw image data
>>> that is compressed, and not the surrounding tiff structure/ome-xml block.)
>>>
>>> Thanks,
>>> Nick
>>>
>>> _______________________________________________
>>> ome-devel mailing list
>>> ome-devel at lists.openmicroscopy.org.uk
>>> http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-devel
>>>
>>>
>>
>> <bio-formats_error.tiff>_______________________________________________
>> ome-devel mailing list
>> ome-devel at lists.openmicroscopy.org.uk
>> http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-devel
>>
>>
>>  William Moore
>> Division of Gene Regulation and Expression
>> College of Life Sciences
>> University of Dundee
>> Scotland
>> DD1 5PH
>>
>> Tel 01382 386364
>>
>>
> _______________________________________________
> ome-devel mailing list
> ome-devel at lists.openmicroscopy.org.uk
> http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-devel
>
>
>  William Moore
> Division of Gene Regulation and Expression
> College of Life Sciences
> University of Dundee
> Scotland
> DD1 5PH
>
> Tel 01382 386364
>
>
> _______________________________________________
> ome-devel mailing list
> ome-devel at lists.openmicroscopy.org.uk
> http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-devel
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.openmicroscopy.org.uk/pipermail/ome-devel/attachments/20090908/8160fcf9/attachment.htm 


More information about the ome-devel mailing list