LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Labview libtiff implementation

Hi Jim,

 

U16 and U32 grayscale images are not supported by most standard programs. Instead, you can use ImageJ or Fiji (both free). I tested the files written by my VIs with that programs and they work. Did you try RGB multipage files with Win XP with Windows Picture and Fax Viewer?

 

Bye,

 

Nico

0 Kudos
Message 41 of 106
(2,320 Views)

Thanks Nico.  Your work has been a great help to me!  I will download "Fiji" today.

 

Best Regards,

Jim

 

0 Kudos
Message 42 of 106
(2,303 Views)

Thanks for creating these VIs, they are a great help.

 

I'm having some trouble writing metadata though. If I create a VI which writes metadata and then reads it, the metadata apears to be there. When I re-open this file, the metadata is gone. Not sure whats happening here. Has anyone been able to write metadata?

0 Kudos
Message 43 of 106
(2,197 Views)

Hi,

I ran into problems using a 64bit version of Labview 2012 so I wrote a new wrapper for BitMiracle's libtiff.NET to write multipage tiffs.

It supports U8 and U16 IMAQ images and can compress using the deflate algorithm (but just change the corresponding flag if you need another).

There is also support for writing to the image description tag for metadata, as e.g. done for the bioformats/ome-tiff standards.

 

Best,

Dan

Message 44 of 106
(1,931 Views)

Hi Guys,

 

Thank you all so much for your work on the Libtiff labVIEW implementation so far.

In my application, I am trying to create a tiff viewer that simply loads a tiff file and displays it in an Intensity Graph without using the Vision Development Module (which we have).

 

I tried using the tifflib laVIEW library and ran into the following problem:

I downloaded the libtiff from http://gnuwin32.sourceforge.net/packages/tiff.htm and the libtiff3.lvlib. We are running a 64-bit LabVIEW 2011 on a Win 7 Pro machine.

When I attempted to open the libtiff_test1.vi, I got a broken arrow leading me to libtiff3_close.vi. I tried configuring the call library function and point it to the dll at C:\Program Files (x86)\GnuWin32\bin\libtiff3.dll.

However, I got the message "The library selected is not valid for the current platform. For example, you are running 64-bit LabVIEW and the library might be a 32-bit library."

According to the information on the website, the library should work both for 32 and 64 bit machines. So what am I doing wrong? Please advise. Thank you.

 

Regards,

 

Peter

0 Kudos
Message 45 of 106
(1,856 Views)

Yes it will work on both 32-bit and 64-bit machines, but it is only a 32-bit library, so will only work in 32-bit code - in your case, 32-bit LabVIEW.  Even on a 64-bit machine.  Like a previous poster, I've had some success with using the BitMiracle libtiff.NET package in both 32-bit and 64-bit LabVIEW: http://bitmiracle.com/libtiff/

 

0 Kudos
Message 46 of 106
(1,823 Views)

Dear GregS,

 

Thank you for your help and suggestions. The LVTiffWriter.zip file provided by stranIO that is based on the Bitmiracle BitMiracle's libtiff.NET only provides a means for writing Tiff files.

 

I am looking for a VI that loads a single-page U16 TIFF file and converts it into a pixel array, similar to what the Read Tiff.vi in the libtiff2.lvlib from Nico_MPI was doing, but something that works with LV64-bit. Unfortunately, I have not enough experience in writing a Tiff reader myself, and was wondering whether one of you guys has something like this to share.

 

Thank you for your help and insight.

 

Peter

0 Kudos
Message 47 of 106
(1,791 Views)

Hi Peter,

 

I suggest to start you take Nico_MPI's vi as a template.

Every call to library function node there corresponds to a .NET Invoke method node in the BitMiracle libtiff.NET/LVTiffWriter code, they have same names (you can see which function is called by by right-click->configure). In the .NET nodes you select the function by right-click-> select method.

When Nico_MPI reads and sets tags by reference numbers (there were comments which tag they correspond to) you can take the BitMiracle libtiff.NET/LVTiffWriter tiffWriteTags.vi and change the nodes from setField to getField.

 

If you do not need to cover every variation of tiff it should not be too much work.

 

Good luck,

stran

 

 

0 Kudos
Message 48 of 106
(1,778 Views)

Hello stran,

 

Thank you for showing me a path to a solution. I appreciate it.

 

I ran to a problem though right at the beginning. See attached VIs. If I run the Test Get Field.vi, I get an error 91 (Error 91 occurred at Variant To Data in Test Get Field.vi, Possible reason(s): LabVIEW:  The data type of the variant is not compatible with the data type wired to the type input.). The Variant output is CB100001.

What am I doing wrong? Please advise. Thank you.

 

Best regards,

 

Peter

 

0 Kudos
Message 49 of 106
(1,768 Views)

On the off chance it's helpful, here's some pure LabVIEW code I wrote that reads a simple TIFF image. In this case, the same program always generated the TIFFs, so it's a bit specific to that output, but it covers the basics of TIFF parsing. Also, it reads a TIFF image arriving by TCP, but you should be able to directly replace all the TCP Reads with Read from Binary File. You'll get the bitmap data (without all the metadata) as a string, which you can unflatten to an array of the appropriate numeric type (if it's a black-and-white image you'll need to split the bytes into bits as well).

 

Take a look and see if you can use it. This is in LabVIEW 2013 but I can save it back to an earlier version if needed.

 

Parse TIFF.png

0 Kudos
Message 50 of 106
(1,756 Views)