LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Labview libtiff implementation

I suspect you can get this faster still. With a small bit of code, you could check that all the stripes are contiguous (normally they will be, but the TIFF spec doesn't require that). If so, you can read all the stripes at once. Read it as a 1-D array, reverse the array (to get the rotation), and reshape it to the 2-D.

 

Note that my code only works for a 16-bit grayscale TIFF since that's what you provided as an example. It will probably work for all such TIFFs generated by the same program, but may fail if your TIFF comes from a different source, since I didn't fully implement the TIFF spec.

0 Kudos
Message 71 of 106
(2,098 Views)

Thank you, Nathand.

I tried, but was not successful. I do not really know what I am doing. I know that my stripes are contiguous. Simply reversing the array will not rotate the image by 90degrees clockwise. I first need to tranpose the array, then invert each line (or display the image in the intensity graph with the y-scale inverted, which is faster). I am also just using U16 tiff files in this application.

0 Kudos
Message 72 of 106
(2,092 Views)

Here's a quick change demonstrating what I meant about reading all the stripes at once. It doesn't do nearly the checks that it should do if you're processing a variety of TIFF files, but if the same source is always generating the images and you want it to process as fast as possible, it's not unreasonable to make some assumptions and report an error if the file doesn't match those expectations.

 

As an alternative to transposing the array, you can right-click the graph and choose "Transpose Array" (maybe that's what you're already doing).

 

Convert to Values is the same as the previous version so I'm not uploading that.

 

(edited for clarity)

Message 73 of 106
(2,085 Views)

Hello nathand,

 

This is working great and it is very fast. It takes about 114ms to load a new file, and about 10 ms to reload the same file. (Not sure why this is so, but I am ok with that.) Thank you so much for your patience and for putting in your time to help me with this application. I appreciate it. And I hope that many LabVIEW users in the future will also benefit from it.

 

Peter

0 Kudos
Message 74 of 106
(2,047 Views)

Hey all,

 

First of all, cheers to Nico for creating this library! It's something i'm going to find very useful in the future.

 

Second thing, I'm trying to work out how create a TIFF file with multiple images (multipage?) from single images.

 

I have a camera streaming images which i can capture and convert single frames into simple IMAQ format, U16 array or TIFF. Can someone show me how to group the incoming single images into a multipage TIFF and then save them to a file location?

 

Thank you in advance,

 

Samuel

 

0 Kudos
Message 75 of 106
(1,996 Views)

Hi Samuel,

if you are not overtly performance limited have a look at the code I posted in message 44. If Nico's library is quicker (it probably is)  then writing multiple pages within one file basicly amounts to:

  • write tags and image data,
  • do not close the file
  • instead use the writeDirectory method
  • write tags and image data of next image
  • close file after last image.

Hope this already helps you

stran

0 Kudos
Message 76 of 106
(1,978 Views)

Hi Stran,

 

Thanks for helping. Unfortunately I'm using LV2011, I can't open your VIs. So I think i will stay with Nico's library. Should the save image to tiff look something like this? (See attachement)

 

The VI is running in a For Loop. The For Loop runs until the specified number of images to capture have been reached. The Open File to Write is called once before the For Loop starts.

0 Kudos
Message 77 of 106
(1,978 Views)

Hi, Dan

 

Thanks a lot for your sharing! This is just what I need for my work now. I am just trying to save single .tiff files into a stack. But I have met a problem when I tried your code and I don't know why. Can you help me with the error solving? Attached is the error message. I am using Labview 2014, 64bit. 

 

Thanks a lot!test_error.png

0 Kudos
Message 78 of 106
(1,932 Views)

Have you installed the right .Net component? You would most likely need the LibTiff.Net component installed on your system for LabVIEW to be able to use it.

Rolf Kalbermatter
Averna BV
0 Kudos
Message 79 of 106
(1,917 Views)

Thanks a lot for this reply! I have downloaded the libtiff.net.dll file from http://bitmiracle.com/libtiff/, but it seems that I will need Visaul Studio to build the .net file in. But I don't have VS installed, so will there be another way to build the .net.dll file in? Thanks again for your help!

0 Kudos
Message 80 of 106
(1,895 Views)