Re: 16 bit Tiff image [message #58925] |
Thu, 28 February 2008 00:09  |
Andrew Cool
Messages: 219 Registered: January 1996
|
Senior Member |
|
|
On Feb 28, 5:01 pm, Stefano Scardigli <s.scardi...@libero.it> wrote:
> On Wed, 27 Feb 2008 16:12:24 -0700, David Fanning wrote:
>> Stefano Scardigli writes:
>
>>> better, thanks:
>
>>> IDL> img=read_tiff("V13A5.00.tif",/unsigned)
>>> IDL> help,img
>>> IMG LONG = Array[1000, 1000]
>>> IDL> print,max(img)
>>> 65535
>>> IDL> write_tiff,"prova.tiff",fix(img),/SHORT <---------
>>> IDL> help,img
>>> IMG LONG = Array[1000, 1000]
>>> IDL> print,max(img)
>>> 65535
>>> IDL> img2=read_tiff("prova.tiff",/unsigned)
>>> IDL> help,img2
>>> IMG2 LONG = Array[1000, 1000]
>>> IDL> print,max(img2)
>>> 255
>
>>> and now both img and img2 are LONG, but the reloaded img2 is still shrunk
>>> to 255 levels (ie 8 bit)!
>
>> I still don't think so. Are you being *very*
>> careful with your variables? You might try using
>> a .reset after you write the file and before you
>> read it again. I think it is not possible to get
>> what you are getting. :-)
>
>> Cheers,
>
>> David
>
> I'm very careful with my variables, and all the "code" I'm using is just
> this:
>
> img=read_tiff("V13A5.00.tif",/unsigned)
> help,img
> print,max(img)
> write_tiff,"prova.tiff",fix(img),/LONG
> help,img
> print,max(img)
> img2=read_tiff("prova.tiff",/unsigned)
> help,img2
> print,max(img2)
My IDL5.3 manuals say that /UNSIGNED is used to read in unsigned 16-
bit integer data and convert it to
unsigned 32-bit longword arrays. That keyword was obsolete by IDL 5.3.
Are you quite sure of the format of the data in your TIFF file? Have
your tried QUERY_TIFF and inspected the resultant information
structure?
Perhaps you could post the TIFF file somewhere for us to investigate?
Cheers,
Andrew
|
|
|
Re: 16 bit Tiff image [message #58926 is a reply to message #58925] |
Wed, 27 February 2008 23:01   |
Stefano Scardigli
Messages: 7 Registered: February 2008
|
Junior Member |
|
|
On Wed, 27 Feb 2008 16:12:24 -0700, David Fanning wrote:
> Stefano Scardigli writes:
>
>> better, thanks:
>>
>> IDL> img=read_tiff("V13A5.00.tif",/unsigned)
>> IDL> help,img
>> IMG LONG = Array[1000, 1000]
>> IDL> print,max(img)
>> 65535
>> IDL> write_tiff,"prova.tiff",fix(img),/SHORT <---------
>> IDL> help,img
>> IMG LONG = Array[1000, 1000]
>> IDL> print,max(img)
>> 65535
>> IDL> img2=read_tiff("prova.tiff",/unsigned)
>> IDL> help,img2
>> IMG2 LONG = Array[1000, 1000]
>> IDL> print,max(img2)
>> 255
>>
>> and now both img and img2 are LONG, but the reloaded img2 is still shrunk
>> to 255 levels (ie 8 bit)!
>
> I still don't think so. Are you being *very*
> careful with your variables? You might try using
> a .reset after you write the file and before you
> read it again. I think it is not possible to get
> what you are getting. :-)
>
> Cheers,
>
> David
I'm very careful with my variables, and all the "code" I'm using is just
this:
img=read_tiff("V13A5.00.tif",/unsigned)
help,img
print,max(img)
write_tiff,"prova.tiff",fix(img),/LONG
help,img
print,max(img)
img2=read_tiff("prova.tiff",/unsigned)
help,img2
print,max(img2)
|
|
|
|
|
Re: 16 bit Tiff image [message #58934 is a reply to message #58931] |
Wed, 27 February 2008 15:12   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Stefano Scardigli writes:
> better, thanks:
>
> IDL> img=read_tiff("V13A5.00.tif",/unsigned)
> IDL> help,img
> IMG LONG = Array[1000, 1000]
> IDL> print,max(img)
> 65535
> IDL> write_tiff,"prova.tiff",fix(img),/SHORT <---------
> IDL> help,img
> IMG LONG = Array[1000, 1000]
> IDL> print,max(img)
> 65535
> IDL> img2=read_tiff("prova.tiff",/unsigned)
> IDL> help,img2
> IMG2 LONG = Array[1000, 1000]
> IDL> print,max(img2)
> 255
>
> and now both img and img2 are LONG, but the reloaded img2 is still shrunk
> to 255 levels (ie 8 bit)!
I still don't think so. Are you being *very*
careful with your variables? You might try using
a .reset after you write the file and before you
read it again. I think it is not possible to get
what you are getting. :-)
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming (www.dfanning.com)
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|
Re: 16 bit Tiff image [message #58935 is a reply to message #58934] |
Wed, 27 February 2008 15:03   |
Stefano Scardigli
Messages: 7 Registered: February 2008
|
Junior Member |
|
|
better, thanks:
IDL> img=read_tiff("V13A5.00.tif",/unsigned)
IDL> help,img
IMG LONG = Array[1000, 1000]
IDL> print,max(img)
65535
IDL> write_tiff,"prova.tiff",fix(img),/SHORT <---------
IDL> help,img
IMG LONG = Array[1000, 1000]
IDL> print,max(img)
65535
IDL> img2=read_tiff("prova.tiff",/unsigned)
IDL> help,img2
IMG2 LONG = Array[1000, 1000]
IDL> print,max(img2)
255
and now both img and img2 are LONG, but the reloaded img2 is still shrunk
to 255 levels (ie 8 bit)!
Stefano Scardigli
On Wed, 27 Feb 2008 14:01:12 -0700, Jean H wrote:
> Stefano Scardigli wrote:
>> nothing is changed
>>
>> IDL> img=read_tiff("V13A5.00.tif",/unsigned)
>> IDL> help,img
>> IMG LONG = Array[1000, 1000]
>> IDL> print,max(img)
>> 65535
>> IDL> write_tiff,"prova.tiff",img,/SHORT
>> IDL> print,max(img)
>> 255
>> IDL> help,img
>> IMG BYTE = Array[1000, 1000]
>
> img is a long and you try to save it as an integer... have you tried
>
> write_tiff,"prova.tiff",fix(img),/SHORT
> or
> write_tiff,"prova.tiff",img,/LONG
> ?
>
> Jean
|
|
|
Re: 16 bit Tiff image [message #58938 is a reply to message #58935] |
Wed, 27 February 2008 13:26   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Stefano Scardigli writes:
> nothing is changed
>
> IDL> img=read_tiff("V13A5.00.tif",/unsigned)
> IDL> help,img
> IMG LONG = Array[1000, 1000]
> IDL> print,max(img)
> 65535
> IDL> write_tiff,"prova.tiff",img,/SHORT
> IDL> print,max(img)
> 255
> IDL> help,img
> IMG BYTE = Array[1000, 1000]
Well, I don't know what to tell you. That's not what
happens when I type the code. :-(
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming (www.dfanning.com)
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|
Re: 16 bit Tiff image [message #58939 is a reply to message #58938] |
Wed, 27 February 2008 13:01   |
Jean H.
Messages: 472 Registered: July 2006
|
Senior Member |
|
|
Stefano Scardigli wrote:
> nothing is changed
>
> IDL> img=read_tiff("V13A5.00.tif",/unsigned)
> IDL> help,img
> IMG LONG = Array[1000, 1000]
> IDL> print,max(img)
> 65535
> IDL> write_tiff,"prova.tiff",img,/SHORT
> IDL> print,max(img)
> 255
> IDL> help,img
> IMG BYTE = Array[1000, 1000]
img is a long and you try to save it as an integer... have you tried
write_tiff,"prova.tiff",fix(img),/SHORT
or
write_tiff,"prova.tiff",img,/LONG
?
Jean
|
|
|
Re: 16 bit Tiff image [message #58942 is a reply to message #58939] |
Wed, 27 February 2008 12:32   |
Stefano Scardigli
Messages: 7 Registered: February 2008
|
Junior Member |
|
|
nothing is changed
IDL> img=read_tiff("V13A5.00.tif",/unsigned)
IDL> help,img
IMG LONG = Array[1000, 1000]
IDL> print,max(img)
65535
IDL> write_tiff,"prova.tiff",img,/SHORT
IDL> print,max(img)
255
IDL> help,img
IMG BYTE = Array[1000, 1000]
On Wed, 27 Feb 2008 12:12:16 -0700, David Fanning wrote:
> Stefano Scardigli writes:
>
>> I'm new in using IDL and I'm using an old version too.
>> I have a strange problem in writing 16 bit TIFF files
>>
>> this is the dump of my problem (I omitted the unuseful rows):
>>
>> IDL Version 5.1 (OSF alpha). Research Systems, Inc.
>> IDL> img=read_tiff("V13A5.00.tif",/unsigned)
>> IDL> help,img
>> IMG LONG = Array[1000, 1000]
>> IDL> print,max(img)
>> 65535
>> IDL> write_tiff,"prova.tiff",img
>> IDL> print,max(img)
>> 255
>> IDL> img2=read_tiff("prova.tiff",/unsigned)
>> IDL> print,max(img2)
>> 255
>> IDL> help,img
>> IMG BYTE = Array[1000, 1000]
>> IDL> help,img2
>> IMG2 BYTE = Array[1000, 1000]
>> IDL>
>>
>> as you can see the file prova.tiff is a 8 bit image and also the array img
>> is changed from LONG to BYTE. I tried all the parameter of the write_tiff
>> procedure, but nothing change
>
> I think you forgot the SHORT keyword here:
>
> IDL> write_tiff,"prova.tiff",img
>
> This should be:
>
> IDL> write_tiff,"prova.tiff",img, /SHORT
>
> Cheers,
>
> David
|
|
|
Re: 16 bit Tiff image [message #58944 is a reply to message #58942] |
Wed, 27 February 2008 11:12   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Stefano Scardigli writes:
> I'm new in using IDL and I'm using an old version too.
> I have a strange problem in writing 16 bit TIFF files
>
> this is the dump of my problem (I omitted the unuseful rows):
>
> IDL Version 5.1 (OSF alpha). Research Systems, Inc.
> IDL> img=read_tiff("V13A5.00.tif",/unsigned)
> IDL> help,img
> IMG LONG = Array[1000, 1000]
> IDL> print,max(img)
> 65535
> IDL> write_tiff,"prova.tiff",img
> IDL> print,max(img)
> 255
> IDL> img2=read_tiff("prova.tiff",/unsigned)
> IDL> print,max(img2)
> 255
> IDL> help,img
> IMG BYTE = Array[1000, 1000]
> IDL> help,img2
> IMG2 BYTE = Array[1000, 1000]
> IDL>
>
> as you can see the file prova.tiff is a 8 bit image and also the array img
> is changed from LONG to BYTE. I tried all the parameter of the write_tiff
> procedure, but nothing change
I think you forgot the SHORT keyword here:
IDL> write_tiff,"prova.tiff",img
This should be:
IDL> write_tiff,"prova.tiff",img, /SHORT
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming (www.dfanning.com)
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|
Re: 16 bit Tiff image [message #58995 is a reply to message #58934] |
Thu, 28 February 2008 23:34  |
Stefano Scardigli
Messages: 7 Registered: February 2008
|
Junior Member |
|
|
what a mess =:-O
I'm on IDL 5.1 and I'm working on a remote server via ssh.
I haven't QUERY_TIFF
I haven't SWAP_ENDIAN_INPLACE
the images I'm dealing with are about 24 Mb each and they seem fine.
I'm thinking about some problem with multiband image (what is thinking
IDL) and the monocromatic mine.
I'm thinking to give up to this IDL.
I spent a lot of time in compiling GDL and all the other stuff it
requires. But I'm still not sure it is working fine.
Any idea?
Thanks to all
Stefano Scardigli
On Wed, 27 Feb 2008 16:12:24 -0700, David Fanning wrote:
> Stefano Scardigli writes:
>
>> better, thanks:
>>
>> IDL> img=read_tiff("V13A5.00.tif",/unsigned)
>> IDL> help,img
>> IMG LONG = Array[1000, 1000]
>> IDL> print,max(img)
>> 65535
>> IDL> write_tiff,"prova.tiff",fix(img),/SHORT <---------
>> IDL> help,img
>> IMG LONG = Array[1000, 1000]
>> IDL> print,max(img)
>> 65535
>> IDL> img2=read_tiff("prova.tiff",/unsigned)
>> IDL> help,img2
>> IMG2 LONG = Array[1000, 1000]
>> IDL> print,max(img2)
>> 255
>>
>> and now both img and img2 are LONG, but the reloaded img2 is still shrunk
>> to 255 levels (ie 8 bit)!
>
> I still don't think so. Are you being *very*
> careful with your variables? You might try using
> a .reset after you write the file and before you
> read it again. I think it is not possible to get
> what you are getting. :-)
>
> Cheers,
>
> David
|
|
|