LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Reading 32 bit TIF

Hey all,

 

I am having trouble reading in 32 bit greyscale TIF images. We are working with hardware that generates 32 bit arrays, currently saved as TIF images. I am working to develop software that can open and manipulate these images, simple ROI drawing, rotate, crop, histogram equalization, etc. I have started with the basic "Display and Image file" example (https://forums.ni.com/t5/Example-Code/Display-an-Image-File/ta-p/3503606), but whenever I try to read in the image, I am met with error  -1074395984, NI vision does not support the file data type specified. I am wondering if there is an internal setting I can alter to force a 32 bit read of this image, or if there is a more elegant way.

 

Unfortunately I cannot share the image files themselves for size reasons, they are more than 20MB in size at their smallest. Are there any resources that I could look to for help with this read in issue?

 

Thank you!

 

Ed

0 Kudos
Message 1 of 8
(1,570 Views)

So what do these 32bits represent? (RGBA? 4 grey pixels? R=G=B?)

 

Tiff files can be arbitrarily complicated (details), for example do you know if the tiff file is compressed?

 

I've had success reading simple uncompressed tiff files by just using plain binary file IO and parsing according to the structure.

 

 

0 Kudos
Message 2 of 8
(1,567 Views)

Could you make a much smaller file to share? If the full resolution is 20 MB, maybe crop it to 5-10% or something?

0 Kudos
Message 3 of 8
(1,546 Views)

Thank you for helping Bert. I have attached a cropped TIF image, in a .zip folder (Community doesn't support TIF uploads).

0 Kudos
Message 4 of 8
(1,485 Views)

Thank you for your interest in the topic. I have uploaded a cropped version of the TIF in response to another commend in a .ZIP folder. I'm not intimately familiar with traditional the TIF or other image formats, but my understanding is all 32 bit is used in a single channel as pixel depth. The image is greyscale, coming out of an x-ray detector, with a pixel value range of 0 to 262,000. Best I can tell, the TIF file is not compressed, but the example I uploaded is cropped in imageJ and sent to a ZIP folder, so I can't attest to its uncompressed status now. 

 

Thank you!

0 Kudos
Message 5 of 8
(1,483 Views)

Hi Eddi,

 


@Eddi1i wrote:

I am having trouble reading in 32 bit greyscale TIF images. We are working with hardware that generates 32 bit arrays, currently saved as TIF images.


Is there an option to save those "32bit arrays" using a different data format? (As simple as CSV files!?)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 8
(1,476 Views)


 

looks like an uncompressed .tiff , but the pixels are formated as float (or single in terms of labview)

 

I don't know how to tweek imaq file io vis to read this ... but when I tried, my labview .vi crashed ... 

 

However,

 you can use the python node and a little  script to read the example file to labview as a 2d array (via Pillow and Numpy) - and after that pass this 2d float array to an imaq grayscale (sgl) image ...

 

 

 

tiff_float.png

 

 

 

I suppose, you could read the .tif file directly as altenbach suggested.

 

 

 

 

0 Kudos
Message 7 of 8
(1,470 Views)

A while ago I tried out the example from  in this thread:

https://forums.ni.com/t5/LabVIEW/Labview-libtiff-implementation/m-p/3078536#M879494

 

See the attached VIs for a lazy implementation for 32 bit float. It works on the cropped image saved with ImageJ, hopefully also on the original.

 

RamonG_0-1647607464622.png

 

Download All
Message 8 of 8
(1,453 Views)