Login  Register

Re: 16bit-TIF with LUT

Posted by Peter Haub on Jul 16, 2013; 2:15pm
URL: http://imagej.273.s1.nabble.com/Plugin-for-compiling-all-plugins-tp5003613p5003984.html

Hi Curtis,

surely it is not a TIFF standard but I managed to save 8bit LUT in a
16bit grayscale TIFF and to apply the LUT during opening those files in
ImageJ.

In short my code modifications are:
1) WriteColorMap for GRAY16_UNSIGNED and adapt the header accordingly
during file writing
2) GetColorMap for GRAY16_UNSIGNED and create IndexColorModel during
file opening

Of coarse the big question is how to deal with this non-standard TIFF
format.
If anybody is interested in the IJ modification please let me know.

In addition, it seems as other bio imaging software has realized similar
features too.

Regards,
Peter

On 10.07.2013 20:22, Curtis Rueden wrote:

> Hi Peter,
>
>> My idea was to use 8bit LUTs in 16bit TIFF files.
>> Maybe this is already possible and I just mist some ImageJ options.
> Sorry if my long-winded response made it unclear. In brief:
>
> * It is not possible with ImageJ
> * It is not possible with the TIFFs at all
> * It is not possible with PNGs, or *any* other graphics format I know of
>
> Regards,
> Curtis
>
>
> On Sun, Jul 7, 2013 at 1:05 AM, Peter Haub <[hidden email]> wrote:
>
>> Thanks Nikolay
>> and Thanks Curtis
>> for your detailed feedback.
>>
>> My idea was to use 8bit LUTs in 16bit TIFF files.
>> Since ImageJ offer 8bit LUT support for displayed 16bit images and since
>> 16bit images are mapped to 8bit during opening in ImageJ I thought that it
>> could also be possible to save the 8bit LUT in the 16bit TIFF and to apply
>> it during opening.
>>
>> Maybe this is already possible and I just mist some ImageJ options.
>>
>> Regards,
>> Peter
>>
>>
>>
>> On 26.06.2013 18:56, Curtis Rueden wrote:
>>
>>> Hi Nikolay & everyone,
>>>
>>>   I don't think it is possible to save TIFF with LUT inside the file.
>>> You can, but only for 8-bit indices. See the TIFF6 specification [1], Part
>>> 1, Section 5: "Palette-color Images". You can save such indexed color
>>> images using ImageJ's File > Save As > TIFF, or using the Bio-Formats
>>> Exporter plugin [2].
>>>
>>> However, if you have 16-bit indices, TIFF does not support that. The funny
>>> thing is that TIFF's ColorMaps are actually 8-bit indices into 48-bit RGB
>>> triples (so each of red, green and blue range from 0-65535). But that is
>>> the "wrong direction" if you want to have a color table with 65536
>>> elements
>>> mapped to either 24-bit or 48-bit RGB triples.
>>>
>>> Unfortunately, I do not know of any general image formats that support
>>> 16-bit color tables. There are some proprietary microscopy formats that
>>> do,
>>> and Bio-Formats supports importing them, but will not export to such
>>> formats. Neither of the two most promising common graphics formats, TIFF
>>> and PNG, support it.
>>>
>>> For ImageJ2 we can add some custom metadata to the TIFF (like ImageJ1 does
>>> for hyperstacks), to preserve the LUTs. But then they would only be
>>> written
>>> & read by SCIFIO-based software [3], not all image processing software.
>>>
>>> Regards,
>>> Curtis
>>>
>>> [1] http://partners.adobe.com/**public/developer/en/tiff/**TIFF6.pdf<http://partners.adobe.com/public/developer/en/tiff/TIFF6.pdf>
>>> [2] http://fiji.sc/Bio-Formats
>>> [3] http://scif.io/
>>>
>>>
>>> On Wed, Jun 26, 2013 at 7:24 AM, Nikolay Rogoshchenkov
>>> <[hidden email]>wrote:
>>>
>>>   I don't think it is possible to save
>>>> TIFF<http://en.wikipedia.org/**wiki/Tagged_Image_File_Format<http://en.wikipedia.org/wiki/Tagged_Image_File_Format>
>>>>> **with LUT
>>>> inside the file.
>>>>
>>>> --
>>>> Rogoshchenkov Nikolay
>>>>
>>>>
>>>> On Wed, Jun 26, 2013 at 5:01 AM, Peter Haub <[hidden email]> wrote:
>>>>
>>>>   Dear List,
>>>>> in ImageJ (1.47q)  I saved a 16bit TIF image with a Color-LUT.
>>>>>
>>>>> Problem: The LUT will not be stored in the file.
>>>>>
>>>>> Is the a something I can fix with configuration settings, is this
>>>>> feature
>>>>> not supported in ImageJ or is this not an option in the TIF format?
>>>>>
>>>>> Peter
>>>>>
>>>>> --
>>>>> ImageJ mailing list: http://imagej.nih.gov/ij/list.****html<http://imagej.nih.gov/ij/list.**html>
>>>>> <
>>>>>
>>>> http://imagej.nih.gov/ij/list.**html<http://imagej.nih.gov/ij/list.html>
>>>> --
>>>> ImageJ mailing list: http://imagej.nih.gov/ij/list.**html<http://imagej.nih.gov/ij/list.html>
>>>>
>>>>   --
>>> ImageJ mailing list: http://imagej.nih.gov/ij/list.**html<http://imagej.nih.gov/ij/list.html>
>>>
>>>
>> --
>> ImageJ mailing list: http://imagej.nih.gov/ij/list.**html<http://imagej.nih.gov/ij/list.html>
>>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html