Hi Ben,
Thank You for your answer.
Over here you are right , for reading the image file which has small
dimension, But my image dimension is 14000x14000 or more than that, and
i want to display this image in the size of 500X500 window. Here is my
code, try out with the image which has dimension more than 6000 X 6000.
pro read_geotiff
file = dialog_pickfile(filter=['*.tif', '*.tif'])
if file eq '' then return
print,systime(0)
res = query_tiff(file,info,geotiff=geostruct)
samples = info.dimensions[0]
lines = info.dimensions[1]
xper = 25
yper = 25
ximg = samples/xper
yimg = lines/yper
print,samples,lines,ximg,yimg
image = bytarr(3,ximg,yimg)
for i = 0, yimg*(yper-1), yimg do begin
for j = 0, ximg*(xper-1), ximg do begin
a = read_tiff(file,sub_rect=[j,i,ximg,yimg])
sx = j/xper
sy = i/yper
image[0:2,sx:sx+ximg/xper,sy:sy+yimg/yper] = a[0:2,$
0:ximg-1:xper,0:yimg-1:yper]
endfor
endfor
print,systime(0)
window,0,xsize=ximg,ysize=yimg
tv, image, /order, /true
end
If you know the other methode apart from this then please let me know.
Over here one solution is to make our program to read tiff file, but i
do not want to do this. Because if ENVI is using this read_tiff
function then there should be other method as I think ( Because envi is
taking less time to display the big tiff image).
Regards
Chintan
Ben Tupper wrote:
> raval.chintan@gmail.com wrote:
>> Hi...
>>
>> I have a geo tiff file which containing the 14000 X 14000 Pixels
>> (Samples and Lines), I am reading it through the read_tiff function.
>> Over here i want to show that image on to the 500 X 500 window Means
>> by buffer for image will contain dimension [3,500,500]. For that I am
>> reading with the help of read_tiff function with the sub_rect keyword.
>> Where i m reading the pixels based on the ratio of 14000/500, but it is
>> taking to much time. While the same thing in ENVI it is taking less
>> time to read the image and display it. So is there any other method for
>> read that image fast. for that i have to write my own code in IDL to
>> read the tiff file?
>>
>> Regards,
>> Chintan Raval
>>
> Hello,
>
> I don't think I understand what it is that you are trying to do, but I
> would assume that IDL and ENVI are accessing the image using the same
> procedure. Here is an example of how to use the SUB_RECT keyword (which
> I use all the time on much smaller images with no problem.)
>
> file = FILE_SEARCH(!DIR, 'image.tif')
> whole = READ_TIFF(file[0])
> sub = READ_TIFF(file[0], sub_rect = [200, 200, 50, 100] )
> TV, whole
> TV, sub, 100, 0
>
> Is this example similar to how you are using the SUB_RECT keyword?
>
> Ben
|