Loading...
 

Data scaling when saving in TIFF format

The TIFF export File Formats available in the Huygens Software may require that the data is rescaled to make the intensities fit the destination format's Dynamic Range. If not rescaled, a data clipping or a loss of dynamic range (intensity resolution) may occur. If you are interested in quantifying your data, you may want to pay attention to the scaling of images and how to treat them properly. See also Signal Quantification.

The basic TIFF format can store 8 bit data only.

The 16 bit TIFF variant can hold unsigned (positive) 16 bit data.
  • Huygens Essential converts 16 bit Tiff files always to 16 bit signed integer, dividing it by 2 if necessary.
  • Huygens Professional always asks the user what to do with 16 bit Tiff files; convert them to 8 bit, 16 bit, or 32 bit float?
  • The Batch Processor, present in both, converts all 16 bit Tiff images, irrespective their range, to 32 bit float.

This means that restoration results with dynamic range higher than 8 bit will need a downscaling when saved in RGB TIFF to avoid clipping, scaling the maximum to a value of 255.
Similarly, 32 bit Float Type images may need stretching when saved in 16 bit TIFF format, whose maximum scales to 65535.

In both cases, only the positive intensities present in the image are saved.

If you want to export to TIFF files for further analysis you may be interested in having more control on how the data is scaled. It is of course possible with the advanced tools present in Huygens Professional and Huygens Scripting. Since version 3.1 of Huygens Essential some options are available when exporting to TIFF to give priority to analysis, instead of the previous priority to visualization and contrast stretching.

In case the current range of the image data does not fit in the range of the selected Tiff type, the following choices to reduce the range are offered:

  • Contrast stretch (positive data range for each channel is adapted to the Tiff range, the different per-channel factors are not reported)
  • Linked scale (as stretch, but now the relation between channels is retained: the same factor is applied to all channels that stretches the one with maximum intensity to the Tiff range. The factor is reported by Huygens.)
  • Clip (positive data outside the Tiff range is clipped to that range)

tiffScaling.png


If you have a single channel image, the first two modes are equivalent, but only in the second one the scaling factor is reported.

Again, remember that in all three cases the negative values are always clipped.

See below for examples and details.

Keeping the information

What determines the necessity of the scaling is not only the value of the maximum, but mostly the difference in Dynamic Range between the image and the file format to export to. Imagine for example that you have a Float Type image with a maximum intensity of 220, and some other pixels have intensities like 219.0, 219.2 and 219.6. The maximum of 220 is smaller than 255, thus it could be stored directly in a 8 bit TIFF, but then the other mentioned values would have to be rounded to either 219 or 220, loosing the intensity resolution. This happens even if you save the intensities directly in a 16 bit TIFF.

By applying a contrast stretching and exporting to 16 bit TIFF you can preserve the contrast, at least partially. If you scale the maximum up to 65535, the other mentioned values could be 65237, 65297 and 65416 respectively, and you can still distinguish them.

If the image data type matches the selected TIFF format type, no stretching is necessary.

Visualization purposes

One must be careful with Multi Channel images when a stretching is applied. The default behavior is to stretch each channel independently to obtain maximum contrast. One may think that this is changing the information too much, but in many cases the users are interested in the TIFF format for visualization purposes. Moreover, further analysis might not be affected by this scaling, as happens with many of the most extended colocalization coefficients, that are insensitive to these scaling factors different for each channel.

This is not the case, of course, of Ratiometric Images, where the ratio between channels is directly affected by independent scaling. If you are saving float images in low dynamic range formats like TIFF, you should do it carefully to take care of this adaptative rescaling.

Analysis purposes

Since version 3.1 of the Huygens Software an option is available to couple the channels when saving to TIFF, to preserve intensity ratios in case a scaling is necessary. In Huygens Professional this can be already done manually, properly scaling the whole dataset and converting the image to Integer Type before saving it to 16 bit TIFF.

Moreover, saving to TIFF can be done without any scaling, writing the actual values directly (and probably loosing dynamic range). The user must be careful because clipping will happen if the image intensity range exceeds the destination file's.

An example

Having the original (raw) data in 8 bits doesn't mean that the deconvolution result really fits the 8 bit range. Actually, it
is quite unlikely. The deconvolution collects blurred light and puts it
back to the original sources, preserving the total intensity while increasing the intensity of some pixels. This increased values can go beyond the 8 bit dynamic range if the original data filled it well. The deconvolution result will require more bits than 8 to keep the intensities.

When deconvolving a particular 8 bit test image, the highest intensity increased from 246 to 370 after a few iterations. 370 needs at least 9 bits to be stored, thus the Huygens Software will return the result in 16 bit Integer Type. You can't save this directly into a 8 bit file format anymore.

The intensities will be preserved when the data is saved in the recommended ICSfile Format. But when you export the dataset to a TIFF format, some scaling will occur depending on the destination Dynamic Range. When saved in 8 bit TIFF, it is downscaled by a factor < 1. Otherwise the data would be clipped.

When saved in 16 bit TIFF stretching is in principle not necessary. Still, you have to notice the difference between Huygens 16 bit (Integer Type) mode, and Tiff format 16 bit. Huygens' is signed (allowing possitive and negative values), and Tiff's is unsigned (only possitive values allowed). When exporting to Tiff negative values, if existing, are lost (clipped to zero). What the program does now with the remaining range depends on your saving options: you can multiply it by 2, or leave it as it is.

Another example

Saving in unsigned 16 bit Leica Tiff a signed 32 bit (Float Type)
image, for example, may require a downscaling to make the data fit in there. Otherwise one could obtain a Clipped Image. In Huygens Float Type, intensities can have any real value (possitive or negative) with absolute value betwen approximately 10-38 to 1038, with 7 digits precision. But in 16 bit unsigned integer format, the possible values range from 0 to 65535 only. Even in the case the maximum in the 32 bit image falls inside the 16 bit range, keeping the contrast as much as possible requires a scaling, as explained above.

Comments for Huygens 3.1

You can skip this section if you have a newer version of Huygens.

In this version, and for historical reasons now deprecated, there was a difference between the image having zero or negative intensities and having only positive intensities. When some zero or negative was present, the stretched intensity range went from zero to the maximum. When only positive intensities existed (for example when a background remains after restoration), the stretched range went from the smallest positive to the maximum. This was intended to enhance the visualization of the dataset, but it was discarded because it was too complex to explain.

Since version 3.2 of the Huygens Compute engine all three saving modes clip the negative data at zero before doing any stretching or linked scaling.

See also...

Try
Huygens ×
Click for pronunciation
for Free!


Request Trial


Contact Information

Scientific Volume Imaging B.V.

Laapersveld 63
1213 VB Hilversum
The Netherlands


Phone: +31 (0)35 64216 26
Fax: +31 (0)35 683 7971
E-mail: info at svi.nl

Image Image Image Image Image Image Image

Upcoming Events