24小时热门版块排行榜    

查看: 3600  |  回复: 0

niuran1212

木虫 (知名作家)

[求助] IDL读入.tif格式文件,IDL高手请进

本人初学IDL用已有的脚本读入.tif格式的文献遇到问题
程序如下:

function readtiffstack,imagefile,rect=rect,start_frame=start_frame, $
   stop_frame=stop_frame


ok = query_tiff(imagefile, info)
start = 0
stop = info.num_images-1
if (keyword_set(start_frame)) then start = start_frame
if (keyword_set(stop_frame)) then stop = stop_frame


if (keyword_set(rect)) then $
imgarr = bytarr(rect[2]-rect[0],rect[3]-rect[1],stop-start+1) $
else imgarr=bytarr(info.dimensions[0],info.dimensions[1],stop-start+1)

if (ok) then begin
        for i=start,stop do begin
                if (keyword_set(rect)) then $
                        img=read_tiff(imagefile,image_index=i,sub_rect=rect) $
                else img=read_tiff(imagefile,image_index=i)
                s=size(a)
                if (s[0] eq 3) then begin
                        imgarr = img
                        i = stop
                endif else begin
                        imgarr[*,*,i-start] = img
                endelse
        endfor
endif

return, imgarr
end
我以一下格式调用:IDL> a = readtiffstack('filename.tif')只输入文件名或者全部路径都出现一下问题:
% Expression must be a structure in this context: INFO.
% Execution halted at: READTIFFSTACK      16 D:\IDL\everything\readtiffstack.pro
%                      $MAIN$         
这是啥原因?图像要放在IDL安装路径下吗?

» 猜你喜欢

已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

智能机器人

Robot (super robot)

我们都爱小木虫

相关版块跳转 我要订阅楼主 niuran1212 的主题更新
信息提示
请填处理意见