Steve on Image Processing
July 30th, 2008
Reading Massively Multipage TIFFs: An Update
Last fall I wrote about a complaint some MATLAB users had about reading certain kinds of TIFF files. Specifically, some users have TIFF files that each contain tens of thousands of images—or more! One user sent us a single TIFF file containing almost 130,000 individual images. My tongue-in-cheek name for these files is "Massively Multipage TIFF" (MMT).
The problem is that the syntax for reading the k-th image from a TIFF file:
>> I = imread(filename, k);
takes significantly longer for images at the end of the file. As a result, reading all of the images in such a file takes way too long. I discussed the technical issues in the post "How many images can fit in a TIFF file" last September.
We now have updated files you can use to improve import performance on these TIFF files. The necessary files and instructions can be downloaded here. The patch is only for the most recent MATLAB release, R2008a. Please do not try to apply the patch to earlier releases.
[Update - August 11, 2008 - The download link above now points to an official MathWorks technical support solution page.
With the updated files, images at the end of a TIFF file can be read in the same amount of time as images at the beginning of the file. Note that a different syntax is necessary, so please read the instructions in the download carefully.
You should be aware that these updates will NOT be included in the upcoming R2008b release. These changes were implemented very recently, and the relevant development deadline for R2008b changes was a couple of months ago.
Also, we don't have any updates available yet for improving the performance of creating such TIFF files using imwrite.
2:02 pm |
Posted in Uncategorized |
Permalink |
You can follow any responses to this entry through the RSS 2.0 feed.
You can skip to the end and leave a response. Pinging is currently not allowed.
Leave a Reply
|
I think aviread suffers the same quadratic time problem for long movies. Are there any plans to address that problem similarly?
Jason,
AVIREAD generally does not suffer from issues reading most movies on Windows. There are some files that will cause an increase in the time to read frames at the end of files, generally those without any key frames. AVIREAD on non-Windows platforms is more likely to have this problem.
I would suggest using MMREADER, the replacement to AVIREAD. Note that MMREADER is not currently available for Linux.
Thanks! nice to see Mathworks responds to its user base. Yet another reason (beside the OOP) to upgrade to the 2008a.
Roy—I love using the new object-oriented programming features in R2008a, and I hope many of our users will, too.
As a new user, I want to ask the maximum file size that can be read from IMREAD? I downloaded a 94 Mb tiff map, but I am not able to import the file into MATLAB.
Regards
Waqas
Steve,
You did not reply to my last query, so I will be pleasantly surprised if you can answer this. I have mosaiced several MrSID images into a TIFF, and the resulting image is giving me a memory error. Do I need a badder machine or can I compress the data somehow? -Giles
I suppose this has to do with the previous question, the image size is 1.5 Gb.
Giles—I do not see a previous query from you on this post. It’s possible I may have deleted your comment; it is my policy to delete comments that are not relevant to the posted topic. Also, I make no promises about when I will reply to relevant comments. Often I answer simple questions immediately, but sometimes it takes a week or so for me to catch up on comments. If you are looking for a reliably quick response, you are better off contacting technical support.
Your image size is quite large, and if you are running on a 32-bit OS you will likely run out of virtual address space (an OS limitation), even if you do have enough RAM.
See this product support note.
Wagas—It depends on how much memory you have on your computer. You should be able to load a 94 MB TIFF file into MATLAB on a modern computer, unless perhaps the file is highly compressed.