MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Importing a large image...

  • To: mathgroup at smc.vnet.net
  • Subject: [mg98658] Re: Importing a large image...
  • From: David Bailey <dave at removedbailey.co.uk>
  • Date: Wed, 15 Apr 2009 05:01:55 -0400 (EDT)
  • References: <grpiih$lqm$1@smc.vnet.net>

David Reiss wrote:
> So, my fellow denizens of the group.
> 
> I have a very large TIFF image--roughly 700MB in size.
> 
> Its dimension are 43201 by 15601.  It is single color with a bit depth
> of 8.
> 
> Mathematica is unable to Import this file on my 6 GM RAM powerbook
> without maxing out the memory.
> 
> I actually do not need to read in the whole file: I'd be happen with
> being able to break the file into a number of smaller TIFFs which tile
> it completely and then process each on independently (I am needing to
> act on the data in various ways to yield a processed result for
> further analysis down the line).   This is all for a larger project
> for a consulting client of mine.
> 
> Any suggestions for how to programmatically carve up the image without
> having to completely read it in first?   I am looking for quick
> solutions rather than ones that require a lot of programming.  Either
> it can be done pretty simply, or (more likely) Mathematica chokes on
> these very large files.
> 
> (Photoshop, on the other hand, does not choke on it at all, nor do
> some other programs that are optimized for image analysis such as ENVI
> (http://www.ittvis.com/ProductServices/ENVI.aspx): but I don't want to
> work with these...  nor do I have them....)
> 
> Of course this leads to a suggestion for the Import function: to allow
> reading in only a part of an image at a time.
> 
> Feel free to respond to the list, but also CC me on the replies so
> that I get them sooner than the usual turnaround.
> 
> Thanks!
> 
> --David
> 
TIFF format is uncompressed (at least in practice), so I think you could 
write code using binary I/O, re-positioning the stream as necessary to 
read a block out of a larger image. Note that there is a big/little 
endian flag at the start of the file.

Alternatively, you could perform the same operations in Java, using 
J/Link to communicate the results to Mathematica.

Of course, using a 64-bit machine (and operating system) with sufficient 
memory, it would be probably be possible to use Import in the normal way.

David Bailey
http://www.dbaileyconsultancy.co.uk


  • Prev by Date: Re: Fast calculation of pair correlation function
  • Next by Date: Re: Fast calculation of pair correlation function
  • Previous by thread: Re: Importing a large image...
  • Next by thread: Re: Importing a large image...