Inverted Image upon import

Hi,

I am importing a tiff image and when I create a new image within IP7, it is the gray scale is inverted.

What is going on and how do I prevent it?

Attached is the IP7 image and the preview as seen in Finder.

Andy
If you would attach the actual TIFF that'd be more helpful.

--Jim Prouty
Software Engineer, WaveMetrics, Inc.
I am not allowed to attach the tiff file.


The selected file 1167159U_02.tif can not be attached to this post, because it is only possible to attach files with the following extensions: jpg jpeg gif png txt doc xls pdf ppt pps odt ods odp pxp uxp pxt uxt ipf ihf ifn xop ibw zip dmg csv.

Andy
Since we can't really see the image you're dealing with, it's hard to tell if this is the issue, but I have found that with some TIFF images, Igor doesn't load the color table correctly. In that case, this macro fixes the problem.

<br />
macro getTIFFcolors()   //  if TIFF displays as b&w image and doesn't have a color map, run this. Bug in Igor?<br />
    Silent 1; PauseUpdate<br />
    <br />
    ImageLoad/RAT/RTIO/T=tiff       // load color tag info from TIFF that was just loaded.<br />
    Duplicate/O root:Tag0:tifTag320,cmap    // puts it in root<br />
    Redimension/n=(256,3) cmap<br />
    ModifyImage W_Raster cindex= cmap<br />
end<br />


Ken
You can zip the .tiff and then post that. Or send your question to support.
Hello Ken,

kaikin wrote:
Since we can't really see the image you're dealing with, it's hard to tell if this is the issue, but I have found that with some TIFF images, Igor doesn't load the color table correctly. In that case, this macro fixes the problem.


If you have an example please send it to support@wavemetrics.com. Igor does not do much with colortable information in TIFF. The use of 8-bit with colortable is somewhat Byzantine.

A.G.
WaveMetrics, Inc.
Hmm

Your TIF file has Photometric tag set to 1, which means "minIsWhite", and your values are nearly the max (black), so your expectation of a dark image is correct.

--Jim Prouty
Software Engineer, WaveMetrics, Inc.
Simply reversing the default Grays color table with Modify Image Appearance is the obvious workaround.

--Jim Prouty
Software Engineer, WaveMetrics, Inc.
I also encountered this problem. I have TIFFs with values of 0 or 255. 0 should be black. Igor interprets 0 as white and 255 black in explicit mode. Applying Grays color table to the image gives the correct result. Explicit mode seems to be the default when I do NewImage/k=0 myTiff. The line ModifyImage myTiff explicit=0,ctab= {*,*,Grays,0} corrects the image.

I guess the solution is to just add this line to my procedure, but it's odd that this is the default for this type of image. Other grayscale TIFFs of identical size and bit depth display as expected.

I have attached a zipped example of two tiffs, one inverts the other doesn't.
tiffInvert.zip (80.76 KB)
I think it would help if one understands why Igor displays the images this way.

Igor displays grayscale images (of more than two levels) with 0 corresponding to black and 255 to white. All bets are off if you apply an external colorscale.

When reading TIFF images, Igor creates waves representing different parts of the data in the file. In the example considered here we have data values that are correctly read and stored into waves. The file also contains an extra bit of information (Photometric Interpretation tag) indicating that a different mapping should be used when the data are displayed. In applications that only use TIFF images for display, it may be appropriate to use this extra tag to scale the data as appropriate for the display of the image. Igor however is data based and so you can't assume that data in the TIFF file should be scaled, flipped or otherwise converted because the user may or may not use the data for display. Igor reads the data. End of story.

I think it is interesting to explore why the original file was saved in this manner. I suspect it may have something to do with the way the image was acquired.

A.G.
WaveMetrics, Inc.