Jump to content

TIFF Reader


Recommended Posts

Hello friends,
I finally expanded the TIFF-reader of .. (found somewhere, before sometime) to a hopefully good level of usefulness.
I tested it on a Mac, but it should work on other machines as well.
The reader accepts
BW
Gray 8,16,32 bit
Gray 8 with LUT
RGB 8,16,32 bit
as well as documents with multiple pages.
It does not accept compressed TIFF.


In the hope that many will profit from this code :) .

Herbert

 

 

[moderator note]

The attached file(s) could not be found due to server error.

Link to comment

QUOTE(HeLo @ Mar 3 2008, 07:17 AM)

Hello friends,

I finally expanded the TIFF-reader of .. (found somewhere, before sometime) to a hopefully good level of usefulness.

I tested it on a Mac, but it should work on other machines as well.

[...]

QUOTE(HeLo @ Mar 3 2008, 07:17 AM)

In the hope that many will profit from this code.

Herbert

Wow - how your old code comes back to byte you ! <img src="http://lavag.org/public/style_emoticons/default/smile.gif" style="vertical-align:middle" emoid=" :) " border="0" alt="smile.gif" />

I think I wrote the original version of that code about 10 years ago now. Certainly the orginal (still available from <a href="http://dmg-stairs.msm.cam.ac.uk/%7Egb119/labview/" target="_blank"><a href="http://dmg-stairs.msm.cam.ac.uk/~gb119/labview/" target="_blank">http://dmg-stairs.msm.cam.ac.uk/~gb119/labview/</a></a>) was written in LabVIEw 5.1 which was shiny and new then (and now 8.5 won't even open the original version !). Good to see that after a decade the code is still some use to folk.

Link to comment
  • 1 month later...

QUOTE (Tomi Maila @ Apr 23 2008, 03:50 AM)

There was a bug in the byte order handling when reading 16-bit and 32-bit little-endian tags from a TIFF file. The byte-order in these cases was ignored and as a result wrong value was read from a tag. The problem fixed in the attached version.

That was my first reaction when reading the OP. Does it handle Little Endian and Big Endian TIFF files alike given that it was tested on a Mac only :-)

Rolf Kalbermatter

Link to comment

QUOTE (rolfk @ Apr 24 2008, 08:32 AM)

That was my first reaction when reading the OP. Does it handle Little Endian and Big Endian TIFF files alike given that it was tested on a Mac only :-)

The code tries to handle the byte order issue but it seems that at least in this one place I fixed, it was ignored. There may be other byte order bugs as well, I only used one type of TIFF image to test the code.

Furthermore, be careful when using this code in a parallel application. The library uses LV global to specify the byte order of a single file. If multiple files with different byte orders are read in parallel, the code will fail. This would be rather easy to fix, but I didn't fix it yet. Maybe I will in a month or so as I need to start reading TIFF files for a project.

Link to comment

QUOTE (Tomi Maila @ Apr 24 2008, 01:27 PM)

The code tries to handle the byte order issue but it seems that at least in this one place I fixed, it was ignored. There may be other byte order bugs as well, I only used one type of TIFF image to test the code.

Furthermore, be careful when using this code in a parallel application. The library uses LV global to specify the byte order of a single file. If multiple files with different byte orders are read in parallel, the code will fail. This would be rather easy to fix, but I didn't fix it yet. Maybe I will in a month or so as I need to start reading TIFF files for a project.

Hmmm, I'm pretty sure I didn't put the global in there... on the other hand I'm also pretty sure I just ignored byte-order issues all together (the original version of the code read images generated on a Windows machine (from an FEI FIB200 system for those that are interested) and displayed on a Windows LabVIEW).

Perhaps we should put the TIFF library up on the new Lava code-repository project on Googlecode to keep a track of bug fixes to it....

Edit: Now done - in 8.5.x\Machine Vision and Imaging\TIFF File Reader

Probably the easiest thing to do is to LVOOP up the internal file processing routines and then the endian-ness can be kept to a per image setting without globals. I think I can see one bug already with the Get Tag value has two outputs - single value and multiple value, but for one type of endian-ness the former isn't being set...

Link to comment
  • 1 year later...

QUOTE (HeLo @ Mar 3 2008, 08:17 AM)

Hello friends,

I finally expanded the TIFF-reader of .. (found somewhere, before sometime) to a hopefully good level of usefulness.

I tested it on a Mac, but it should work on other machines as well.

The reader accepts

BW

Gray 8,16,32 bit

Gray 8 with LUT

RGB 8,16,32 bit

as well as documents with multiple pages.

It does not accept compressed TIFF.

In the hope that many will profit from this code :) .

Herbert

Hi, thank you for sharing your code. I would like to use it, unfortunately, I'm running on Labview 7.1 and so is unable to open your 8.5 version code. Is there any way you can post a 7.1 version of your TIFF Reader library? Thanks much.

Link to comment
  • 4 weeks later...

QUOTE (HeLo @ Mar 3 2008, 08:17 AM)

Hi, thank you for sharing your code. I would like to use it, unfortunately, I'm running on Labview 7.1 and so is unable to open your 8.5 version code. Is there any way you can post a 7.1 version of your TIFF Reader library? Thanks much.

Where is the code anyway?

Link to comment
  • 4 months later...

Hello friends,

I finally expanded the TIFF-reader of .. (found somewhere, before sometime) to a hopefully good level of usefulness.

I tested it on a Mac, but it should work on other machines as well.

The reader accepts

    BW

    Gray 8,16,32 bit

    Gray 8 with LUT

    RGB 8,16,32 bit

as well as documents with multiple pages.

It does not accept compressed TIFF.

In the hope that many will profit from this code :) .

Herbert

Hallo Herbert,

where can I find the tiff_reader?

Regards

Christian

Link to comment

There was a crash in the site which caused some attachments to disappear. We can ask the moderator to try to find them manually (which I've now done), but I don't know if they will find it or how long it will take them.

Alternatively, it's on the very little used LAVA Code Repository at http://code.google.com/p/lavacr/source/browse/#svn/trunk/8.5.x/Machine%20Vision%20and%20Imaging/TIFF%20File%20Reader

There's instructions there on how to use subversion to pull off the repository. Unfortunately 8.5 will only save back to 8.0 so someone who still has 8.0 will have to back port it to 7.1. Alternatively, you can forward port the 5.1 original version which should stillbe at the link given in one of my earlier posts on the thread and fix up the bugs....

EDIT: Except that I've just checked and my old research group have stopped directory listings on the web server. The direct link still works ok:

http://dmg-stairs.msm.cam.ac.uk/~gb119/labview/Tiff_reader.llb

Edit2: .htaccess is a wonderful thing :rolleyes:

Link to comment
  • 5 years later...

Dear Gavin and Herbert,

 

Thank you so much for making these VIs available. I was looking for some time for a replacement for a libtiff LabVIEW library that only ran on 32-bit LabVIEW. Your reader is by far the fastest that I have found loading a 11MB U16 TIFF file in 133ms. What makes it special is that it runs both with 32-bit and 64-bit LabVIEW. After some minor optimization, your VI loads the file in 74ms (!). I have renamed the modified reader into TIFF File Reader (LAVA.org).vi.

 

Note also, that I have crosslinked this thread with a discussion on the LabVIEW discussion board, http://forums.ni.com/t5/LabVIEW/Labview-libtiff-implementation/td-p/929843/highlight/false/page/7. I hope you don't mind. I attach an updated copy of the library to this message (LabVIEW 2011).

 

Thank you again for your work.

 

Best regards,

 

Peter

LAVA TIFF File Reader (32 bit + 64 bit).zip

  • Like 1
Link to comment

I don't speak for the original developers, but I thank you.  It sounds like the changes you made were for the better, and after the server crash years ago, having a new version uploaded in the original thread will help others who stumble here looking for a good TIFF reader.

Link to comment

I think there may be an error in the library. The "main" VI is not actually part of the library and the library references a file that does not exist, so I presume some form of renaming (outside the IDE) has gone on?

 

After fixing this I tried this on the one TIFF file I have but it is compressed and looking at the code it appears there is not yet support for compressed TIFFs.

Link to comment

After fixing this I tried this on the one TIFF file I have but it is compressed and looking at the code it appears there is not yet support for compressed TIFFs.

YEs, that would mean implementing LZW compression in native LabVIEW which seemed like a lot of work....:-)

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.