LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

16 bit TIFF file saved not working in ImageJ

Solved!
Go to solution

Hi, 

I have a camera that saves 12-bit TIFF file.  When I have a recorded TIFF file, it can be opened in ImageJ and all pixel values are preserved.  Also if I display it in Labview using IMAQ, it can be correctly displayed and if I use ImageToArray, all values are correct too.  However, if I save it as a new file using IMAQ writing File 2, the saved file can be loaded into Labview with correct pixel values, however, if I open this saved file in ImageJ, all values are converted into 16-bit wrongly.  For example, value 62 (00111110) becomes 1000000000111110.  Apparently the first digit when converting to 16bit, it designate the first bit to 1 instead of 0.  I'm confused because the same saved image when loaded in labview vi, the value stays 62.  

Is there a way to fix it?  Could it be a problem with ImageJ instead of labview? I attached the original file and saved file here.  

0 Kudos
Message 1 of 9
(6,087 Views)

Greetings, soljiang;

 

Since the images are saved correctly and then displayed correctly in LabVIEW even after writing the file, I would guess that ImageJ simply processes images differently and that there is most likely not a problem in LabVIEW itself.

 

How exactly are you saving the image in LabVIEW ?

 

I have previously run into a problem when using ImageJ; I was saving images that were in I16 in LabVIEW but when opening them and saving them in ImageJ it seemed as if the image was being saved as a U16 by default.

 

Cordially;

 

Simon P.

 

National Instruments
Applications Engineer
0 Kudos
Message 2 of 9
(6,071 Views)

Hi, Simon, 

Thank you so much for your reply.  I attached the portion of the code for savinng the image.  Basically I have an image, and I tried to wire the same image to image terminal of IMAQ writing File 2 vi in Vision and Motion panel.  I ran into the problem as I described.  Then I created another IMAQ and converted origianl image to array and then array to image and then saved that image using the same method.  I even verified the pixel values by using a third image to array function and all pixel values are right.  Also the images are right when I read out that saved image in a different vi.  

I didn't do any operation on the image or save the image on ImageJ.  I simply opened the same saved image in ImageJ and all pixel values are messed up in a way I described above.  I think it could be the sign issue as you said since in 16 bit binary, imageJ for some reason have the first digit as 1.  But I do set the data type to I16 in imageJ as well.  

Any more information would be very much appreciated.  Thank you very mcuh!

 

Best,

Charles

0 Kudos
Message 3 of 9
(6,065 Views)
Solution
Accepted by topic author soljiang

Greetings, Charles;

 

After having looked at the attached screenshot, I have a question for you. What is being wired into the IMAQ Create for Source2 ? I would assume it is an Enum with I16 selected, correct?

 

Does the same thing happen if you use U16 both on LabVIEW and ImageJ, or any lower bit depth? Finally, if you save the image on a different file format, do you get similar behaviour?

 

Cordially;

 

Simon P.

National Instruments
Applications Engineer
Message 4 of 9
(6,047 Views)

Yeah, I solved my problem.  I need to convert image pixels to U32 and then it can be read by imageJ correctly.  Thank you so much for your help!

0 Kudos
Message 5 of 9
(6,043 Views)

Greetings;

 

It has been my pleasure; glad your application is now working correctly!

 

Cordially;

 

Simon P.

National Instruments
Applications Engineer
0 Kudos
Message 6 of 9
(6,028 Views)

Hi,

I also have the problem that  I was saving images that were in I16 in LabVIEW but when opening them and saving them in ImageJ it seemed as if the image was being saved as a U16 by default. 

How to solve this problem ?  Thank you very much.

 

Best,

Run

0 Kudos
Message 7 of 9
(4,559 Views)

Hi clarkewayne,

Have you tried the steps outlined above, or the suggestion of using U32 made by soljiang?

This is a much older post, and per our community guidelines I would recommend creating a new thread instead of posting on this one. You'll likely get more input on a newer thread as well. 

Charlie J.
National Instruments
0 Kudos
Message 8 of 9
(4,542 Views)

Thank you so much for your help . 

I have post a new thread in Labview plate ( https://forums.ni.com/t5/LabVIEW/I16-bit-tif-image-can-not-read-in-ImagJ-correctly/td-p/3761379 ). 

 

Best

 

0 Kudos
Message 9 of 9
(4,530 Views)