Saturday, 15 September 2012

Interact with very large Tiff (or rset) images in MATLAB -


I have some very large tiff images that I am trying to use in the MATLAB GUI application. If I try to load images using imshow, I get an out-of-memory error. (Yes, I know that the catalog is not the best choice for GUI, or not to load large images, but in this case there is a good reason to use MATLAB).

I use a low resolution data set (rset file)) and imtool to see the image, but this is not useful because I want that a user to draw that image from X-ray To be removed, click on it to be able to interact. Imshow does not seem to be compatible with rset files directly, do I have a way to load a rosed'd image in a dumb / zoommable shape, or can I achieve the target in some other way?

I saw the code for the item, but it seems that rset files to read undocumented classes and I can not repeat my behavior.

You can use the low level to avoid the OOM problem, to the fullness or parts of the TIFF image File the MATLAB I / O function to read.

  fileName = 'LargeTiff.tif'; Info = imfinfo (fileName)% set the number of frames nFramesStr = regexp (info.ImageDescription, 'images = (\ d *)', 'token'); NFrames = str2double (nFramesStr {1} {1}); Use low-level file I / O function to read% file fp = fopen (fileName, 'rb'); The "strip offsets" field provides offset to the first bar Fseek (FP, info.StripOffsets, 'bof'); Assume that the image format is 16-bit per pixel and large-endian% also believe that images are stored in one after another% For example, read the first 100 frame frame nan = 100; Imdata = cell (1, frame new); For Cnt = 1: Framemom IMData {cnt} = fread (fp, [info.Width info.Height], 'uint16', 0, 'IEEE-B'); End fclose (FP);  

No comments:

Post a Comment