From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Intensity graph save as tiff with z value

Solved!
Go to solution

Hello,

 

I have an intensity graph that I would like to save as tiff with its z value (contrast). When I save as tiff, it saves as raw intensity graph (contrast from 0-255) without contrast that I'm seeing from the graph. Is there a way to save the intensity graph with current contrast?

 

Thanks in advance.

 

Intensity_Z.PNGintensity_as_tiff.PNG

0 Kudos
Message 1 of 14
(3,630 Views)

You forgot to wire the "Color Palette" when you save to tiff.

 

George Zou
0 Kudos
Message 2 of 14
(3,619 Views)

Hi George,

 

Thanks for the reply. I wired color palette as below but doesn't seem to change. Is this the right way to get color from the intensity graph?intensity_as_tiff.PNG

 

Thanks.

0 Kudos
Message 3 of 14
(3,596 Views)

Did you take a look the image before save to file?

 

George Zou
0 Kudos
Message 4 of 14
(3,584 Views)

Hello George,

 

Sorry about the late response - I was on other project for awhile. Now I'm back to this project. Can you elaborate little bit further about what you meant by to look at image before save? I changed contrast of intensity graph (max/min) but saved image doesn't show updated contrast. Thank you for the help.

 intensity_as_tiff_1.PNG

0 Kudos
Message 5 of 14
(3,535 Views)

The Z-scale property of the intensity graph only specifies the colors. The min value of the Z-scale will get the lowest specified color, the max value will get the highest specified color (the table should be 256 colors IIRC). The Z-scale might be set to autoscale, so you need to read them from the property node as well. It could even be set to Logarithmic...

 

So to use those in a tiff, you need to scale the colors or the data to a format the tiff uses (could be 0-1 or 0-255), not sure, don't have vision installed right now.

0 Kudos
Message 6 of 14
(3,531 Views)

Hello,

 

Thanks for the reply. The tiff color palette scale is 0 - 255. So, what you mean is I need to rescale color table (basically it gives me an array of 0 - 255 of RGB [{0,0,0}, {1,1,1}, {2,2,2},....,{255,255,255}]) using Z-scale min and max values? Is there an example? It doesn't seem to make any difference when I tried.

Thank you.

0 Kudos
Message 7 of 14
(3,515 Views)

@dk91 wrote:

 

Thanks for the reply. The tiff color palette scale is 0 - 255. So, what you mean is I need to rescale color table (basically it gives me an array of 0 - 255 of RGB [{0,0,0}, {1,1,1}, {2,2,2},....,{255,255,255}]) using Z-scale min and max values? Is there an example? It doesn't seem to make any difference when I tried.


Be very careful. The R, G and B values have a range. But to what floating value does the maximum value map? That's another range. So there are two ranges.

 

The intensity graph has a color scale. These are defined as R, G and B values of 0-255. But the floating value that gets the first color, and the floating value that gets the maximum color are not defined by those colors. You need the z-scale minimum and maximum for that as well.

 

So in short: both the intensity graph as the tiff have a minimum and maximum z-scale, and 256 colors defined as R, G and B with a scale (could very well be 0-1 for tiff, not sure).

 

I think the tiff will regard floating number 0 as the lowest color, and 1 as highest color. So you need to:

 

1) scale all data to so the intensity graph's color scale minimum is 0 (subtract minimum from data), and the maximum color scale of the intensity graph is 1 (divide data by max-min). So:

Tiff_Data = (Data - Int_Graph_Min) / (Int_Graph_Max - Int_Graph_Min)

 

2) Make sure the color scale uses the correct format. Maybe you need to divide those colors by 255, so R, G and B are 0-1. Not sure.

 

If one of them is off, it won't work.

0 Kudos
Message 8 of 14
(3,509 Views)

So do you mean scale the actual intensity data? Say if my z-scale min and max are 20 and 40 (ZScale.Marker Values property node returns current min/max scale). I should do ([2D intensity data] - 20) / 20. And Intensity graph's ColorTbl (RGB) property should be scaled to either 0-1 or 0-255. When I tried this, returned image is all black...I must be missing something...

 

 

intensity_as_tiff_2.PNG

0 Kudos
Message 9 of 14
(3,498 Views)

I think I see it now. From the intensity data, I get min and max values and re-scaled them. But the result is the same. Any suggestion on what I'm doing wrong?intensity_as_tiff_3.PNG

0 Kudos
Message 10 of 14
(3,488 Views)