Group 4 fax tiff ?

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

Group 4 fax tiff ?

Gabriel Landini
Hi
I was trying to load a Group 4 fax tiff file in IJ but this does not seem to
be supported either natively nor with the LOCI importer.

With the latter I get:

loci.formats.FormatException: Sorry, CCITT T.6 bi-level encoding (Group 4 Fax)
compression mode is not supported
        at loci.formats.TiffTools.uncompress(TiffTools.java:1876)
        at loci.formats.TiffTools.getSamples(TiffTools.java:1378)
        at loci.formats.in.BaseTiffReader.openBytes(BaseTiffReader.java:144)
        at loci.formats.ChannelSeparator.openBytes(ChannelSeparator.java:156)
        at loci.formats.ChannelSeparator.openBytes(ChannelSeparator.java:165)
        at loci.plugins.Util.openProcessor(Util.java:80)
        at loci.plugins.Importer.run(Importer.java:414)
        at loci.plugins.LociImporter.run(LociImporter.java:74)
        at ij.IJ.runUserPlugIn(IJ.java:158)
        at ij.IJ.runPlugIn(IJ.java:124)
        at ij.Executer.runCommand(Executer.java:104)
        at ij.Executer.run(Executer.java:58)
        at java.lang.Thread.run(Thread.java:595)

The file I am trying to load is this one:

http://www.vincent-net.com/luc/papers/91pami_watersheds.tif

Alternatively, does anybody know a linux app that would load this? (It tried
the gimp, but it shows the last page only and gwenview only the first one).

Regards,

Gabriel
Reply | Threaded
Open this post in threaded view
|

Re: Group 4 fax tiff ?

Adam Goode
Gabriel Landini wrote:
> Alternatively, does anybody know a linux app that would load this? (It tried
> the gimp, but it shows the last page only and gwenview only the first one).
>


Hi,

You can try the "tiffsplit" command. It will break apart a tiff image
into individual parts. See also "tiffinfo". Both come with libtiff, on
Linux and others.



Thanks,

Adam
Reply | Threaded
Open this post in threaded view
|

Re: Group 4 fax tiff ?

Gabriel Landini
On Sunday 20 January 2008, Adam Goode wrote:
> You can try the "tiffsplit" command. It will break apart a tiff image
> into individual parts. See also "tiffinfo". Both come with libtiff, on
> Linux and others.

That is handy, specially for scripting. Thanks Adam.
I just also found that there is a KFaxView app in KDE that lets you drop a
tiff into it and shows all the pages (I did not have that installed).

Thanks again.
Regards,

Gabriel
Reply | Threaded
Open this post in threaded view
|

Re: Group 4 fax tiff ?

Jarek Sacha-2
In reply to this post by Gabriel Landini
JAI I/O plugin (http://ij-plugins.sf.net/plugins/imageio) seems to load
it fine. The last (16th) page is of a different size so pages are no
combined in a stack but loaded separately into ImageJ.

Jarek

Gabriel Landini wrote:

> Hi
> I was trying to load a Group 4 fax tiff file in IJ but this does not seem to
> be supported either natively nor with the LOCI importer.
>
> With the latter I get:
>
> loci.formats.FormatException: Sorry, CCITT T.6 bi-level encoding (Group 4 Fax)
> compression mode is not supported
> at loci.formats.TiffTools.uncompress(TiffTools.java:1876)
> at loci.formats.TiffTools.getSamples(TiffTools.java:1378)
> at loci.formats.in.BaseTiffReader.openBytes(BaseTiffReader.java:144)
> at loci.formats.ChannelSeparator.openBytes(ChannelSeparator.java:156)
> at loci.formats.ChannelSeparator.openBytes(ChannelSeparator.java:165)
> at loci.plugins.Util.openProcessor(Util.java:80)
> at loci.plugins.Importer.run(Importer.java:414)
> at loci.plugins.LociImporter.run(LociImporter.java:74)
> at ij.IJ.runUserPlugIn(IJ.java:158)
> at ij.IJ.runPlugIn(IJ.java:124)
> at ij.Executer.runCommand(Executer.java:104)
> at ij.Executer.run(Executer.java:58)
> at java.lang.Thread.run(Thread.java:595)
>
> The file I am trying to load is this one:
>
> http://www.vincent-net.com/luc/papers/91pami_watersheds.tif
>
> Alternatively, does anybody know a linux app that would load this? (It tried
> the gimp, but it shows the last page only and gwenview only the first one).
>
> Regards,
>
> Gabriel
>
>
>  
Reply | Threaded
Open this post in threaded view
|

Re: Group 4 fax tiff ?

Johannes Hermen
In reply to this post by Gabriel Landini
> Hi
> I was trying to load a Group 4 fax tiff file in IJ but this does not
seem to
> be supported either natively nor with the LOCI importer.

It is not directly ImageJ, but we open G4 TIFF files in Java using JAI.

        /**
         * converts the TIFF's from the byte[] to buffered images
         * @param bArr
         * @return
         */
        private Vector<BufferedImage> getAsBufferedImages(byte[] bArr) {
                Vector<BufferedImage> v = new Vector<BufferedImage>();
                ByteArraySeekableStream stream = null;
        try {
            stream = new ByteArraySeekableStream(bArr);
        } catch (IOException e) {
            e.printStackTrace();
        }
        TIFFDecodeParam decodeParam = new TIFFDecodeParam();
        decodeParam.setDecodePaletteAsShorts(true);
        try {
                BufferedImage bi = null;

                ImageDecoder dec = ImageCodec.createImageDecoder("tiff",
stream, decodeParam);
                for (int i = 0; i < dec.getNumPages(); i++) {
                        RenderedImageAdapter ria = new
RenderedImageAdapter(dec.decodeAsRenderedImage(i));
                        bi = ria.getAsBufferedImage();
                        v.add(bi);
                        }
        } catch (IOException e) {
                logger.log(Level.WARNING, "Error converting TIFFs", e);
                }
                return v;
        }

This returns a Vector of Buffered Images, as the TIFF can contain multiple
pages.

Hope this helps.

        Johannes

-----------------------------------------------------------------
Johannes Hermen  -  Ingenieur de Recherche
[hidden email]
-----------------------------------------------------------------
CRP Henri Tudor  http://www.santec.tudor.lu
29, Avenue John F. Kennedy
L-1855 Luxembourg
-----------------------------------------------------------------