Skip to Main Content Skip to Search
File Exchange
MATLAB Newsgroup
Link Exchange
  Blogs  
 Contest 
MathWorks.com

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.

9 Responses to “Reading Massively Multipage TIFFs: An Update”

  1. Jason Merrill replied on :

    I think aviread suffers the same quadratic time problem for long movies. Are there any plans to address that problem similarly?

  2. Dave Tarkowski replied on :

    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.

  3. Roy replied on :

    Thanks! nice to see Mathworks responds to its user base. Yet another reason (beside the OOP) to upgrade to the 2008a.

  4. Steve replied on :

    Roy—I love using the new object-oriented programming features in R2008a, and I hope many of our users will, too.

  5. Waqas replied on :

    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

  6. Giles Kingsley replied on :

    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

  7. Giles Kingsley replied on :

    I suppose this has to do with the previous question, the image size is 1.5 Gb.

  8. Steve replied on :

    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.

  9. Steve replied on :

    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.

Leave a Reply


Steve Eddins manages the Image & Geospatial development team at The MathWorks and coauthored Digital Image Processing Using MATLAB. He writes here about image processing concepts, algorithm implementations, and MATLAB.

  • Mikr: I look for answers before asking people… “But we still can’t see the coordinates!...
  • Steve: Mikr—You might want to take a look at the Getting Started section of the MATLAB documentation in order...
  • Mikr: thanks but is it possible to see and write to file (Excel ?) that matrix of pixel coordinates ? instead of...
  • Steve: Mikr—An image in MATLAB is simply a matrix of pixel values. It can be saved (exported) to several common...
  • Mikr: thanks, Steve just started to learn matlab and to clarify matlab saves image files as a matrix of pixel...
  • Steve: Mikr—As far as I know, the commonly used image file formats such as TIFF, JPEG, PNG, etc., do not...
  • Mikr: how to write pixel coordinates in file ?
  • Steve: M.S.—Code for the bwtraceboundaries function ships with the Image Processing Toolbox.
  • M.S.Cheema: i need to know the detailed algorithm for bwtraceboundaries. i want how that function works. so please...
  • Steve: Wagas—It depends on how much memory you have on your computer. You should be able to load a 94 MB TIFF...

These postings are the author's and don't necessarily represent the opinions of The MathWorks.

Related Topics