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

Home » Public Forums » archive » Re: Image reading
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Image reading [message #82349] Mon, 10 December 2012 08:43 Go to next message
Norbert Hahn is currently offline  Norbert Hahn
Messages: 46
Registered: May 2003
Member
Dry in water <ndugarsuren@gmail.com> wrote:

> IDl version on my PC is following
> { x86_64 Win32 Windows Microsoft Windows 6.3 Mar 23 2006 64 64}
>
> This is a temperature image. I have set of point data with coordinate information. Second, I did interpolation in ARCGIS to produce raster image covering whole study area. Third, as I said, I export it into raster image by setting the same cell size with other image that I have. Fourth, I subsetted this image using country boundary shapefile to eliminate other area except study area. Then I want to read this image in IDL. Because tiff is a main file format of ARCGIS. I tried to produce tiff image that can be read in IDL using other 2 programm which were ENVI and ERDAS. Results were same cannot be read.

You may run tiffinfo on the file and post the results here.
About tiffinfo:
http://www.remotesensing.org/libtiff/tools.html

Norbert
Re: Image reading [message #82350 is a reply to message #82349] Mon, 10 December 2012 08:08 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Dry in water writes:

> Arcgis, ENVI, ERDAS can read this image properly. But matlab and IDL cann't read it. What I mean was the tiff image exported from those program (Arcgis etc) couldn't be read in IDL and matlab correctly.

This still doesn't totally convince me it is a TIFF file,
although I suppose it could be a TIFF file with proprietary
TIFF tags that are getting in the way of the "standard"
TIFF reading mechanism.

I would be more convinced if you saved the file
as a TIFF file from within ENVI and then tried to
read *that* file in IDL.

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.")
Re: Image reading [message #82351 is a reply to message #82350] Mon, 10 December 2012 08:07 Go to previous messageGo to next message
Dry in water is currently offline  Dry in water
Messages: 18
Registered: October 2012
Junior Member
> Hi,
>
> you might have to wait for some experts or some Tiff-experienced users to answer your question.
>
> My guess would be that if you cannot query the file, you cannot read the file.
>
> I never had problems importing tiff. I did this for 8-bit and 16-bit images, for black and white and for 24 color images.
>
>
>
> Do you have any idea what type of data you have in the image?
>
> How big is your image? About 380 Mb or 740 Mb?


> Do you have enough free RAM to read that much data?
>
> Have you tried using the SUB_RECT keyword for Read_tiff, to check if that is a memory issue?
>
>
>
> Sorry, I'm just making questions and have no ready answer...
>
>
>
> Success,
>
> Helder

Hello,
Yes, I know interior value of this image should be between -1.7 and 27.6. I saw it using Arcgis.
The size of file is 1.36 GB. I'm working on PC with 8 GB RAM and 64 bit operating system. Disks space are more than 50GB.

Anyway, thanks you very much Helder.
Re: Image reading [message #82352 is a reply to message #82351] Mon, 10 December 2012 07:57 Go to previous messageGo to next message
Dry in water is currently offline  Dry in water
Messages: 18
Registered: October 2012
Junior Member
On Monday, December 10, 2012 10:34:51 PM UTC+8, David Fanning wrote:
> Helder writes:
>
>
>
>> My guess would be that if you cannot query the file, you cannot read the file.
>
>
>
> If IDL, ENVI, ERDAS, and MATLAB can't read this as a TIFF
>
> image, I would think this is pretty conclusive evidence
>
> that this is not a well formed TIFF image (at the very least),
>
> if it is a TIFF image at all. :-)
>
>
>
> 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.")


Hello,

Arcgis, ENVI, ERDAS can read this image properly. But matlab and IDL cann't read it. What I mean was the tiff image exported from those program (Arcgis etc) couldn't be read in IDL and matlab correctly.
Re: Image reading [message #82353 is a reply to message #82352] Mon, 10 December 2012 06:51 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
David Fanning writes:

> If IDL, ENVI, ERDAS, and MATLAB can't read this as a TIFF
> image, I would think this is pretty conclusive evidence
> that this is not a well formed TIFF image (at the very least),
> if it is a TIFF image at all. :-)

In fact, if we use Occam's Razor here to choose the
simplest hypothesis consistent with the known facts,
I think the working hypothesis would have to be that
this proprietary ARCGIS image was converted to a TIFF
file by changing its file extension to "tif".

Are there any bettors out there? :-)

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.")
Re: Image reading [message #82354 is a reply to message #82353] Mon, 10 December 2012 06:34 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Helder writes:

> My guess would be that if you cannot query the file, you cannot read the file.

If IDL, ENVI, ERDAS, and MATLAB can't read this as a TIFF
image, I would think this is pretty conclusive evidence
that this is not a well formed TIFF image (at the very least),
if it is a TIFF image at all. :-)

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.")
Re: Image reading [message #82355 is a reply to message #82354] Mon, 10 December 2012 06:22 Go to previous messageGo to next message
Helder Marchetto is currently offline  Helder Marchetto
Messages: 520
Registered: November 2011
Senior Member
On Monday, December 10, 2012 2:24:07 PM UTC+1, Dry in water wrote:
> IDl version on my PC is following
>
> { x86_64 Win32 Windows Microsoft Windows 6.3 Mar 23 2006 64 64}
>
>
>
> This is a temperature image. I have set of point data with coordinate information. Second, I did interpolation in ARCGIS to produce raster image covering whole study area. Third, as I said, I export it into raster image by setting the same cell size with other image that I have. Fourth, I subsetted this image using country boundary shapefile to eliminate other area except study area. Then I want to read this image in IDL. Because tiff is a main file format of ARCGIS. I tried to produce tiff image that can be read in IDL using other 2 programm which were ENVI and ERDAS. Results were same cannot be read.

Hi,
you might have to wait for some experts or some Tiff-experienced users to answer your question.
My guess would be that if you cannot query the file, you cannot read the file.
I never had problems importing tiff. I did this for 8-bit and 16-bit images, for black and white and for 24 color images.

Do you have any idea what type of data you have in the image?
How big is your image? About 380 Mb or 740 Mb?
Do you have enough free RAM to read that much data?
Have you tried using the SUB_RECT keyword for Read_tiff, to check if that is a memory issue?

Sorry, I'm just making questions and have no ready answer...

Success,
Helder
Re: Image reading [message #82357 is a reply to message #82355] Mon, 10 December 2012 05:24 Go to previous messageGo to next message
Dry in water is currently offline  Dry in water
Messages: 18
Registered: October 2012
Junior Member
IDl version on my PC is following
{ x86_64 Win32 Windows Microsoft Windows 6.3 Mar 23 2006 64 64}

This is a temperature image. I have set of point data with coordinate information. Second, I did interpolation in ARCGIS to produce raster image covering whole study area. Third, as I said, I export it into raster image by setting the same cell size with other image that I have. Fourth, I subsetted this image using country boundary shapefile to eliminate other area except study area. Then I want to read this image in IDL. Because tiff is a main file format of ARCGIS. I tried to produce tiff image that can be read in IDL using other 2 programm which were ENVI and ERDAS. Results were same cannot be read.
Re: Image reading [message #82358 is a reply to message #82357] Mon, 10 December 2012 04:37 Go to previous messageGo to next message
Helder Marchetto is currently offline  Helder Marchetto
Messages: 520
Registered: November 2011
Senior Member
On Monday, December 10, 2012 1:25:43 PM UTC+1, Dry in water wrote:
> Do you have any suggestion for file format?

I never had trouble with reading tif files as long as I was sure that these were tif files. If Query_tiff gives zero, then the file type is not a Tiff or cannot be read by IDL.
Just a guess... the support for BigTIFF files was added to IDL in Version 8.2. What version of IDL do you have?
Use
print, !version
to find out and you should get something like
{ x86_64 Win32 Windows Microsoft Windows 8.2.1 Aug 20 2012 64 64}

Do you know "how" the file was produced? With which command and version was it produced?

Regards,
Helder
Re: Image reading [message #82360 is a reply to message #82358] Mon, 10 December 2012 04:25 Go to previous messageGo to next message
Dry in water is currently offline  Dry in water
Messages: 18
Registered: October 2012
Junior Member
Do you have any suggestion for file format?
Re: Image reading [message #82361 is a reply to message #82360] Mon, 10 December 2012 04:24 Go to previous messageGo to next message
Dry in water is currently offline  Dry in water
Messages: 18
Registered: October 2012
Junior Member
> There are two things you should try:
>
> 1) use Read_tiff instead of Read_tif (two "f"s)
>
>
>
> 2)Try the Query command:
>
> Result = QUERY_TIFF ( Filename [, Info] [, GEOTIFF=variable] [, IMAGE_INDEX=index] )
>
> Check then the content of the Info variable. O would guess that if you don't get a positive result from Query_tiff, you will not be able to use Read_tiff
>
>
>
> Regards,
>
> Helder


firstly, I tried first method you said. Output was "READ_TIFF: D:\tmp\temp_opp\temp_exam.tiff: Cannot open
% Execution halted at: $MAIN$

Secondly, when I tried your second suggestion. Description of output (info, variable, index) were all undefined. And 'result' type is LONG and value is 0.

I tried to extract tiff images from different softwares again and again. It is so strange all tiff images cannot be read in IDL.
Re: Image reading [message #82362 is a reply to message #82361] Mon, 10 December 2012 02:41 Go to previous messageGo to next message
Helder Marchetto is currently offline  Helder Marchetto
Messages: 520
Registered: November 2011
Senior Member
On Monday, December 10, 2012 11:31:10 AM UTC+1, Dry in water wrote:
> Hello all,
>
> I'n really hard time to reading tif images. I have extracted tif image using ENDVI software. Then I import this really huge tif image (4526,12879,7) into IDL using 2 different ways; The one I used is importwizard to import this image into IDL as a variable. In this case, the following info are displayed on locals window. The type of image is STRUCT, value is ANONYMOUS. what does this info tell me? Does it mean this image didn't read?
>
> The another one is to use read_tif command. In this case, I get "variable is undefined: READ_TIF. Execution halted at: $MAIN$". Then I checked the file exist in a folder by file_test command like this,ok=file_test('D:\tmp\temp_opp\tmp_exam.tif'). It gave me 1. It exist in a folder. So what is the problem variable is undefined.
>
> Thank you very much

There are two things you should try:
1) use Read_tiff instead of Read_tif (two "f"s)

2)Try the Query command:
Result = QUERY_TIFF ( Filename [, Info] [, GEOTIFF=variable] [, IMAGE_INDEX=index] )
Check then the content of the Info variable. O would guess that if you don't get a positive result from Query_tiff, you will not be able to use Read_tiff

Regards,
Helder
Re: Image reading [message #82526 is a reply to message #82361] Tue, 18 December 2012 12:47 Go to previous message
karo03de is currently offline  karo03de
Messages: 21
Registered: March 2007
Junior Member
Am Montag, 10. Dezember 2012 13:24:34 UTC+1 schrieb Dry in water:
>
>
> firstly, I tried first method you said. Output was "READ_TIFF: D:\tmp\temp_opp\temp_exam.tiff: Cannot open
>
> % Execution halted at: $MAIN$
>

My remark might be silly: but extension tiff is quite unusual, especially on PCs. Are you sure with the extension? tif would be better

Karsten
Re: Image reading [message #82534 is a reply to message #82351] Mon, 17 December 2012 08:23 Go to previous message
Jim  Pendleton is currently offline  Jim Pendleton
Messages: 165
Registered: November 2011
Senior Member
On Monday, December 10, 2012 9:07:04 AM UTC-7, Dry in water wrote:
>> Hi,
>
>>
>
>> you might have to wait for some experts or some Tiff-experienced users to answer your question.
>
>>
>
>> My guess would be that if you cannot query the file, you cannot read the file.
>
>>
>
>> I never had problems importing tiff. I did this for 8-bit and 16-bit images, for black and white and for 24 color images.
>
>>
>
>>
>
>>
>
>> Do you have any idea what type of data you have in the image?
>
>>
>
>> How big is your image? About 380 Mb or 740 Mb?
>
>
>
>
>
>> Do you have enough free RAM to read that much data?
>
>>
>
>> Have you tried using the SUB_RECT keyword for Read_tiff, to check if that is a memory issue?
>
>>
>
>>
>
>>
>
>> Sorry, I'm just making questions and have no ready answer...
>
>>
>
>>
>
>>
>
>> Success,
>
>>
>
>> Helder
>
>
>
> Hello,
>
> Yes, I know interior value of this image should be between -1.7 and 27.6. I saw it using Arcgis.
>
> The size of file is 1.36 GB. I'm working on PC with 8 GB RAM and 64 bit operating system. Disks space are more than 50GB.
>
>
>
> Anyway, thanks you very much Helder.

Try the QUERY_IMAGE function in IDL. It will march down through a series of image format types and attempt to open the image with each in turn until it is successful or it runs out of options, ignoring the "hint" provided by the file name extension. If this function returns a 1, then you can check the INFO.TYPE structure tag that's returned through a positional argument to see what type the file really is.

You could also try the READ_IMAGE function if you don't trust your file extensions.

Finally, you could simply open up the file in IDL and read the "magic number" from the start of the file. Most image file formats have magic numbers.

IDL> openr, lun, /get_lun, dialog_pickfile()
IDL> b = bytarr(4)
IDL> readu, lun, b
IDL> print, b, b, string(b), format = '(4z,4i,z4)'
IDL> free_lun, lun

Standard TIFFs should begin with "MM*" or "II*", in ASCII, depending on the byte order of the data. If the file is indeed a TIFF you should see output resembling

49 49 2a 0 73 73 42 0 II*


If you have some other byte sequence at the start of your file, you don't have a standard TIFF.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: fonts in coyote graphics: how to replicate supermongo?
Next Topic: Re: plot z vector on x-y plot

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

Current Time: Wed Oct 08 15:16:33 PDT 2025

Total time taken to generate the page: 0.00529 seconds