1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Igor_画像の読み込み

Posted at

撮影したtiff画像をIgorに読み込むときにただ放り込むと16 bitで読み込まれてしまって後で解析をかけるときにいちいちdouble floatに直すのが面倒なので読み込みの時点でdouble floatにするためのProcedureです。名前とスケールを変えてフォルダに放り込む際に同じサイズのファイルをdouble floatで作成したうえで値だけコピーしてしまっています。

今回の実験では変数を変えながら測定して'g3900_100s_40_4'のような名前で保存した画像を後でfor loopで一括で読み込むことを想定しているので(この例ではCCDカメラにかける電圧を3900、露光時間を100 sと固定して遅延時間を40刻みで変えながら各5回測定したのでこのようなファイル名になっています)適宜ファイルの名前(FilePath)とファイルの保存場所(FolderPath)を変えて使用してください。

Function load_image(delay,count)
Variable delay,count
Variable gain,t
	gain = 3900
	t = 100	//sec
Variable length_x,length_y
    length_x = 150e-6
    length_y = 150e-6
String FilePath,FolderPath,FullPath
	FilePath   = "g"+num2str(gain)+"_"+num2str(t)+"s_"+num2str(delay)+"_"+num2str(count)
	Folderpath = "D:research:Experiment:20221001:"
	Fullpath   = FolderPath+FilePath+".tif"
    	Imageload/T=tiff/Q/O/N=tmpfile Fullpath
    	Wave refWave = tmpfile
String LoadName = "sub_d"+num2str(delay)+"_"+num2str(count)+"_"
Variable Num_x,Num_y
	Num_x = dimsize(refWave,0)
	Num_y = dimsize(refWave,1)
Variable step_x,step_y
    step_x = length_x/Num_x
    step_y = length_y/Num_y

String Folder = "OriginalImage"
	Newdatafolder/o/s $(Folder)
		Make/o/d/n = (Num_x,Num_y) $(LoadName)
		Wave NewWave = $(Loadname)
            setscale/p x, -(Num_x*step_x/2),step_x,NewWave
            setscale/p y, -(Num_y*step_y/2),step_y,NewWave
		NewWave = refWave
cd root:
killwaves refWave	
end
Function Auto()
Variable delay,count
for(delay = 40; delay <= 880; delay += 40)
	for(count = 1; count <= 5; count += 1)
		load_image(delay,count)	
	endfor
endfor
end
1
1
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?