LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to save TIFF 64 bit

Solved!
Go to solution

Hi,

 

I'm using the GigE vision camera and I want to save the captured image in 64-bit TIFF format. There are the options to save up to u16 bit TIFF for IMAQ.  Is there any other way that we can save the images in 64-bit TIFF format? I'm using the 2018 SPI NI Vision. I have attached the VI.

0 Kudos
Message 1 of 10
(442 Views)
Solution
Accepted by ugg88

It depends what you assuming under "64-bit TIFF format".

Not every image processing library will support all possible image types, and if under "64 bit" you assuming 8 byte Double representation or 64-bit integer, then you have to use third-party library, like libtiff (as far as i remember, it could be possible to save 64 bit floats in double precision, not sure about integers). But both representations are very seldom used, usually 32 bit is fully sufficient for most processing needs.

 

On the other hand, if under "64-bit TIFF format" you assuming Big TIFF (sometimes known as Large TIFF) which is a TIFF variant file format which uses 64-bit offsets and supports much larger files than 4GB (or >2GB in case of signed offsets), then I can share small library, based on the message from Nico_MPI and modified by me to stay compliant with Big TIFF. It is multipage implementation (usually when you go over 4GB limit you have stack of the images)

Use it like this:

snippet.png

Multipage TIFFs can be opened in Fiji:

2024-03-23 07.10.56 - MultiPage.tiff.png

This library still pure LabVIEW implementation (don't expect huge performance), with no external libraries needs,except OpenG LargeFile used somewhere.

 

Feel free to use it as starting point and modify if needed. Downgraded to LV2018.

 

Message 2 of 10
(385 Views)
Solution
Accepted by ugg88

Tiff leaves some room for application specific design. That is why I used the camera vendor's dll so far for saving and opening tiff. 

But there are several tiff libraries out there. Check VIPM or here: https://github.com/kleinsimon/LV-Tiff

Message 3 of 10
(375 Views)
Solution
Accepted by ugg88

@ugg88 wrote:

I'm using the GigE vision camera and I want to save the captured image in 64-bit TIFF format. There are the options to save up to u16 bit TIFF for IMAQ.  Is there any other way that we can save the images in 64-bit TIFF format?


As others have already said, it is not really clear what you want. In the subject, you are talking about "saving", but your attached VI is about "reading". There is a 64bit RGB version, but I seriously doubt that any camera, eye, or display device can support or distinguish 18446744073709551615 different levels of 64bit greyscale.

 

altenbach_0-1711207269234.png

 

 

Reading a tiff is hard, unless you only want to deal with one specific type. Writing a tiff using plain LabVIEW is relatively simple. Just stick to the common tags and avoid compression. All documentation can be found on the internet.

 

 

Message 4 of 10
(349 Views)

@Andrey_Dmitriev wrote:

 

This library still pure LabVIEW implementation (don't expect huge performance), with no external libraries needs,except OpenG LargeFile used somewhere.


You mention the OpenG Large File library. i wonder as original author of that library why you would do that. LabVIEW 8.0 and newer supports full 64-bit file offsets in the file functions. The use of floating point numbers in that library as offsets is because there was no official U64 and I64 support in LabVIEW before 8.0 but it was really suboptimal to do like that.

in LabVIEW 8.0 and newer I would recommend to use the native file functions instead. Also will make the library work on other platforms than Windows.

Rolf Kalbermatter
My Blog
Message 5 of 10
(313 Views)

@rolfk wrote:

@Andrey_Dmitriev wrote:

 

This library still pure LabVIEW implementation (don't expect huge performance), with no external libraries needs,except OpenG LargeFile used somewhere.


You mention the OpenG Large File library. i wonder as original author of that library why you would do that.


Oh, it was just artefact used somewhere and I was too lazy to remove it from library before posting (don't think that actively used inside). For sure, novadays will work without as well.

0 Kudos
Message 6 of 10
(310 Views)

Thank you everyone for the suggestions. Sorry for the delayed reply. I was on leave. 

 Sorry for the confusion & Excuse my English. I'm trying to capture the image and save it in TIFF 64-bit.

 

I got the solution to save the image in Tiff 64-bit by changing  2 settings.  From NI max I set the output image type as RGB64bit and set the RGB(64) for the image create function from VI. 

But I'm getting different Image values when I save the image directly from NI max and VI.

When I save the image from NI MAX it gives the Grayscale LUT and display range values from 0-65535. But when I save the image from VI it gives the color LUT and display range values from 0-4095. 

Do I need to set anything from VI to get the Grayscale LUT and display range values from 0-65535?

 

I have attached image information and VI. Many thanks for considering my request.

 

 

0 Kudos
Message 7 of 10
(240 Views)

@ugg88 wrote:

I'm getting different Image values when I save the image directly from NI max and VI.

 


Usually this happened if you have different camera settings when acquired in MAX or in LabVIEW using IMAQ like pixel depth, etc. In most cases it is sufficient to save camera's settings in MAX, then they will be used in LabVIEW:

 

Screenshot 2024-03-28 06.29.09.png

 

The differences between 4095/65535 grays can be easily demonstrated with simple VI:

save tiff snippet.png

Two simple gradient images - one will have the only 4095 grays per channel, another one is full range.

 

Some cameras can stretch histogram to utilize full range between black and white points automatically. Just curious - which camera you have? I've used RGB U64 in the past only for my Nikon camera to analyze 14 bit RGB RAW files.

 

Another interesting point is that the image acquired in MAX will show "Bits per pixel: 16 (unsigned, grayscale LUT)", but the image saved from LabVIEW will be "Bits per pixel: 16 (unsigned, color LUT)":

 

Screenshot 2024-03-28 06.15.09.png

 

but I don't know how to supply TIFF with 16 bit gray LUT. Are you 100% sure that your camera is really RGB with 16 bits per channel and not grayscale?

0 Kudos
Message 8 of 10
(218 Views)

Thank you so much for the reply. 

I'm using the same settings for both NI max and LabVIEW. I have tried by loading the same NI-Max config file from LabVIEW before capturing the image.  Also after running the VI, I have checked the settings from NI max just to confirm if any changes. But I didn't see any changes in settings.

I have also captured from Pylon viewer (Basler software) with same settings and I'm getting the same image as NI max. I'm not sure what's changing in LabVIEW as I'm not adding any extra configuration. (just a doubt -- may be IMAQ create image might have a default setting of color LUT. I don't know much in depth about each IMAXdx functions)

I'm using the Basler color camera acA5472-5gc with pixel format Basler RG 12  and bits/pixel as 16.

0 Kudos
Message 9 of 10
(181 Views)

@ugg88 wrote:

 

I'm using the Basler color camera acA5472-5gc with pixel format Basler RG 12  and bits/pixel as 16.


According to the spec this is 10/12 bit camera. You must compare histograms of both images to be sure that your images with full 16 bit range are not just 4 bits shifted 12 bits. Another point is de Bayer conversion. You might get "raw" bayer encoded image, which needs to be decoded using IMAQ Bayer To RGB.

0 Kudos
Message 10 of 10
(173 Views)