comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: TIFF Read/Write Bug?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: TIFF Read/Write Bug? [message #84253 is a reply to message #84252] Fri, 10 May 2013 13:48 Go to previous messageGo to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
David Fanning writes:

> Is there a problem writing signed integer arrays to TIFF files?
>
> Here is my code:
>
> outFilename = Filepath('forest.tif')
> ageImage = Fix(ageImage)
> Help, ageImage
> AGEIMAGE INT = Array[8600, 8407]
> ageImage[missingIndices]=-999
> Write_Tiff, outFilename, Reverse(ageImage,2), /SHORT, /SIGNED
> testImage = Read_Tiff(outfilename)
> testimage = Reverse(testimage,2)
> Help, testImage
> TESTIMAGE BYTE = Array[8600, 8407]
>
> This is IDL 8.2.2, 64-bit, on Windows 7. '

Whoa! I left this out of my example the other day because it seemed (at
the time) completely irrelevant.

Here is test code that works perfectly:

;*********************************************
outFilename = 'forest.tif'
ageimage = read_tiff(file_which('boulder.tif'))
ageImage = Fix(ageImage)
Help, ageImage
dims = SIZE(ageimage, /DIMENSIONS)
missingIndices = long(randomu(seed, 1000) * product(dims))
ageImage[missingIndices]=-999
Write_Tiff, outFilename, Reverse(ageImage,2), GEOTIFF=geo, $
/SHORT, /SIGNED
testImage = Read_Tiff(outfilename)
testimage = Reverse(testimage,2)
Help, testImage
END
;*********************************************
Running it gives me:

AGEIMAGE INT = Array[1071, 1390]
TESTIMAGE INT = Array[1071, 1390]

BUT!!!

If I add color vectors to the file, watch this:

;*********************************************
outFilename = 'forest.tif'
ageimage = read_tiff(file_which('boulder.tif'))
ageImage = Fix(ageImage)
Help, ageImage
dims = SIZE(ageimage, /DIMENSIONS)
missingIndices = long(randomu(seed, 1000) * product(dims))
ageImage[missingIndices]=-999
TVLCT, r, g, b, /GET
Write_Tiff, outFilename, Reverse(ageImage,2), GEOTIFF=geo, $
/SHORT, /SIGNED, RED=r, GREEN=g, BLUE=b
testImage = Read_Tiff(outfilename)
testimage = Reverse(testimage,2)
Help, testImage
END
;*********************************************

AGEIMAGE INT = Array[1071, 1390]
TESTIMAGE BYTE = Array[1071, 1390]

Is that weird, or what!?

Can anyone reproduce this on their machines?

Cheers,

David


--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Help in Astronomy /curvefitting
Next Topic: Maximum number of elements in a hash

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 17:28:11 PDT 2025

Total time taken to generate the page: 0.00431 seconds