I am trying to convert a .czi file to .tiff with 'bfconvert' and am getting failures due to Java memory issues.
My code is
- Code: Select all
module load bioformats
fdir=/scratch_space/jmichael/LightMicroscopy/data
fname=filename
cmd="time bfconvert -bigtiff $fdir/$fname.czi $fname.tiff"
echo "Command is $cmd"
$cmd
with output
- Code: Select all
Command is time bfconvert -bigtiff /scratch_space/jmichael/LightMicroscopy/data/filename.czi filename.tiff
Output file filename.tiff exists.
Do you want to overwrite it? ([y]/n)
y
/scratch_space/jmichael/LightMicroscopy/data/filename.czi
ZeissCZIReader initializing /scratch_space/jmichael/LightMicroscopy/data/filename.czi
[Zeiss CZI] -> filename.tiff [Tagged Image File Format]
Tile size = 1024 x 1024
Series 0: converted 1/1 planes (100%)
Tile size = 1024 x 1024
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
at java.io.ByteArrayOutputStream.<init>(ByteArrayOutputStream.java:77)
at loci.formats.tiff.TiffSaver.writeImage(TiffSaver.java:323)
at loci.formats.tiff.TiffSaver.writeImage(TiffSaver.java:273)
at loci.formats.out.TiffWriter.saveBytes(TiffWriter.java:270)
at loci.formats.tools.ImageConverter.convertTilePlane(ImageConverter.java:744)
at loci.formats.tools.ImageConverter.convertPlane(ImageConverter.java:630)
at loci.formats.tools.ImageConverter.testConvert(ImageConverter.java:559)
at loci.formats.tools.ImageConverter.main(ImageConverter.java:880)
627.21user 18.15system 9:19.73elapsed 115%CPU (0avgtext+0avgdata 2140928maxresident)k
0inputs+2336outputs (0major+6825080minor)pagefaults 0swaps
If I edit my original code with
- Code: Select all
export BF_MAX_MEM=30g
- Code: Select all
Command is time bfconvert -bigtiff /scratch_space/jmichael/LightMicroscopy/data/filename.czi filename.tiff
Output file filename.tiff exists.
Do you want to overwrite it? ([y]/n)
y
/scratch_space/jmichael/LightMicroscopy/data/filename.czi
ZeissCZIReader initializing /scratch_space/jmichael/LightMicroscopy/data/filename.czi
[Zeiss CZI] -> filename.tiff [Tagged Image File Format]
Tile size = 1024 x 1024
Series 0: converted 1/1 planes (100%)
Tile size = 1024 x 1024
Exception in thread "main" java.lang.OutOfMemoryError: Requested array size exceeds VM limit
at java.util.Arrays.copyOf(Arrays.java:3236)
at java.io.ByteArrayOutputStream.grow(ByteArrayOutputStream.java:118)
at java.io.ByteArrayOutputStream.ensureCapacity(ByteArrayOutputStream.java:93)
at java.io.ByteArrayOutputStream.write(ByteArrayOutputStream.java:135)
at java.io.DataOutputStream.writeByte(DataOutputStream.java:153)
at loci.formats.tiff.TiffSaver.writeImage(TiffSaver.java:346)
at loci.formats.tiff.TiffSaver.writeImage(TiffSaver.java:273)
at loci.formats.out.TiffWriter.saveBytes(TiffWriter.java:270)
at loci.formats.tools.ImageConverter.convertTilePlane(ImageConverter.java:744)
at loci.formats.tools.ImageConverter.convertPlane(ImageConverter.java:630)
at loci.formats.tools.ImageConverter.testConvert(ImageConverter.java:559)
at loci.formats.tools.ImageConverter.main(ImageConverter.java:880)
570.11user 19.40system 9:41.87elapsed 101%CPU (0avgtext+0avgdata 30623312maxresident)k
0inputs+2320outputs (0major+6664982minor)pagefaults 0swaps
How can I go about changing the use of bfconvert so that memory is not an issue? Please note that I am running on Linux with very large memory machines (multiple TB of RAM) so actual memory should not be an issue.