フィルターのクリア

fastest way to read single tiff images

35 ビュー (過去 30 日間)
Humberto
Humberto 2014 年 9 月 10 日
回答済み: Dylan Muir 2015 年 1 月 27 日
I am working with relatively large data sets of single (4 MP, 8-bit) tiff images. Each set contains somewhere in the vicinity of 5000 images (i.e. 20 GB per set). Working with such sets can be very time consuming. For example, simply calculating the time average of a 4000-image set takes over 40 minutes (2441 seconds, to be exact) according to the profiler. Of this, about 85% of the time comes from imread. Is there a way, either by optimizing the use of imread or by using a low-level function, that I can reduce the read out time of the files? I am using imread as follows:
img = imread(filename, 'tif');
Thanks for any help.
Humberto

回答 (4 件)

Image Analyst
Image Analyst 2014 年 9 月 10 日
Copy the images to s solid state drive, or even faster, a RAMdisk, before you begin processing. Look at the charts on this page: http://blog.laptopmag.com/faster-than-an-ssd-how-to-turn-extra-memory-into-a-ram-disk
  3 件のコメント
Humberto
Humberto 2014 年 9 月 11 日
Thanks for your suggestions. I am, however, a little skeptical about this solution. While I do not doubt that a RAM disk may improve the performance of the image processing, I have doubts that the main cause is a slow data transfer from the disk. I believe that the low speed is more an issue regarding the coding efficiency.
Additionally, my RAM is relatively limited, so I could not take full advantage of a RAMdisk.
Joseph Cheng
Joseph Cheng 2014 年 9 月 11 日
Well from your profiler results the time of read is 85% of your processing time. so if we run the numbers for a single image processing it takes 0.48 seconds which 0.41sec is the opening (73 milli seconds processing). so yeah the reading from the disk is not "slow" however you're doing this 5000 times. and to cut the time you wouldn't get much by processing faster reducing the 6 min (15% processing portion). lets be conservative and say read time is 2x for a SSD then you're reducing the 34 min by about 15 min.

サインインしてコメントする。


Sean de Wolski
Sean de Wolski 2014 年 9 月 10 日
Consider using blockproc with the 'UseParallel' option enabled (if you have Parallel Computing Toolbox).
This will do the analysis on pieces of your image chunks at a time, and with parallel enabled will work on the pieces in parallel. You're in luck that tiff images are ideal for this process since the strips can be read in independently.
doc blockproc

Stefano
Stefano 2014 年 9 月 14 日
either low level tiff: http://www.matlabtips.com/how-to-load-tiff-stacks-fast-really-fast/ or if it is uncompressed, fread or memory mapping, the latter seems faster than fread, e.g. m = memmapfile(fname,'Offset',250,'Format','uint16','Writable', false); a2=reshape(swapbytes(m.Data),size2,size1)';

Dylan Muir
Dylan Muir 2015 年 1 月 27 日

カテゴリ

Help Center および File ExchangeImages についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by