Problems dealing with large tiff stack

  • Follow


In brief, I have 12,000 512X512 individual and uncompressed 16-bit
tiffs. For a program that I am using, I need to make these into a
large tiff stack. I have been using the imread function with 'append'
to write them into the file, and it goes ok until about frame 9000,
but in the end I keep getting java memory heap errors.

I have tried changing the java.opts files as instructed but it still
seems to hang around 4.89GB. Both systems are 64-bit with 64 bit OS
(OS 10.6.3 or 64-bit XP). The XP machine has 32GB of RAM and the OS X
machine has 4GB but I get similar errors on both machines.

I was wondering if anyone else has experience with these sorts of
large image stacks that might suggest a possible solution? I fear it
is with the Java side as even ImageJ seems to mess up the individual
images to stack option. Right now, I am trying to do the appending in
small 500-1000 frame segments and then doing a clear/pack on the
terminal line before continuing, but there must be a better way.

Basically, the code looks like this:

%% for frames 1-10 - original stack starts at 0 so that is the reason
for the step offset
clear
step = 0;
for i = 1:10
    temp_image = imread(['img    ' int2str(step) '.tif']);
    imwrite(temp_image, 'matlab_created_stack.tif', 'tif',
'WriteMode', 'append', 'Compression', 'none');
    i
step = step+1;
end
clear

And help would be appreciated.

-smb
0
Reply smbaca (4) 4/8/2010 4:16:03 PM

On Apr 8, 6:16=A0pm, smb <smb...@gmail.com> wrote:
> In brief, I have 12,000 512X512 individual and uncompressed 16-bit
> tiffs. For a program that I am using, I need to make these into a
> large tiff stack. I have been using the imread function with 'append'
> to write them into the file, and it goes ok until about frame 9000,
> but in the end I keep getting java memory heap errors.
>
> I have tried changing the java.opts files as instructed but it still
> seems to hang around 4.89GB. Both systems are 64-bit with 64 bit OS
> (OS 10.6.3 or 64-bit XP). The XP machine has 32GB of RAM and the OS X
> machine has 4GB but I get similar errors on both machines.
>
> I was wondering if anyone else has experience with these sorts of
> large image stacks that might suggest a possible solution? I fear it
> is with the Java side as even ImageJ seems to mess up the individual
> images to stack option. Right now, I am trying to do the appending in
> small 500-1000 frame segments and then doing a clear/pack on the
> terminal line before continuing, but there must be a better way.
>
> Basically, the code looks like this:
>
> %% for frames 1-10 - original stack starts at 0 so that is the reason
> for the step offset
> clear
> step =3D 0;
> for i =3D 1:10
> =A0 =A0 temp_image =3D imread(['img =A0 =A0' int2str(step) '.tif']);
> =A0 =A0 imwrite(temp_image, 'matlab_created_stack.tif', 'tif',
> 'WriteMode', 'append', 'Compression', 'none');
> =A0 =A0 i
> step =3D step+1;
> end
> clear
>
> And help would be appreciated.
>
> -smb

a hint:
- look at the new tiff library wrapper

     help tiff;

us
0
Reply us 4/8/2010 4:20:26 PM


smb wrote:
> In brief, I have 12,000 512X512 individual and uncompressed 16-bit
> tiffs. For a program that I am using, I need to make these into a
> large tiff stack. I have been using the imread function with 'append'
> to write them into the file, and it goes ok until about frame 9000,
> but in the end I keep getting java memory heap errors.
> 
> I have tried changing the java.opts files as instructed but it still
> seems to hang around 4.89GB. Both systems are 64-bit with 64 bit OS
> (OS 10.6.3 or 64-bit XP). The XP machine has 32GB of RAM and the OS X
> machine has 4GB but I get similar errors on both machines.
> 
> I was wondering if anyone else has experience with these sorts of
> large image stacks that might suggest a possible solution? I fear it
> is with the Java side as even ImageJ seems to mess up the individual
> images to stack option. Right now, I am trying to do the appending in
> small 500-1000 frame segments and then doing a clear/pack on the
> terminal line before continuing, but there must be a better way.
> 
> Basically, the code looks like this:
> 
> %% for frames 1-10 - original stack starts at 0 so that is the reason
> for the step offset
> clear
> step = 0;
> for i = 1:10
>     temp_image = imread(['img    ' int2str(step) '.tif']);
>     imwrite(temp_image, 'matlab_created_stack.tif', 'tif',
> 'WriteMode', 'append', 'Compression', 'none');
>     i
> step = step+1;
> end
> clear
> 
> And help would be appreciated.
> 
> -smb

That's too much data for a TIFF file.  The TIFF format uses 32-bit offsets.

 >> log2(12000 * 512 * 512 * 2)

ans =

    32.5507

---
Steve Eddins
http://blogs.mathworks.com/steve/
0
Reply Steve 4/9/2010 11:51:34 AM

2 Replies
371 Views

(page loaded in 0.056 seconds)

Similiar Articles:













7/24/2012 4:06:06 PM


Reply: