Login  Register

Re: handling very large images

Posted by Mark J. Chopping on Dec 03, 2015; 2:13pm
URL: http://imagej.273.s1.nabble.com/handling-very-large-images-tp5015116p5015118.html

Hi Aryeh,

I have put some pretty large (>4GB) mosaics together using Image Sequence
with the "use" (virtual memory) option, followed by Make Montage, by
running ImageJ from the commandline: change directory to (for example,)
/Applications/ImageJ_148 (or wherever your ImageJ binary is), with:

java -jar -Xmx5120m ImageJ64_148.app/Contents/Resources/Java/ij.jar

-- where the number after Xmx is the desired memory limit in MB.

Macro code:

print("Mosaicing the "+numfiles+" ("+xLocations+" x "+ NumSlices +") images...");

run("Image Sequence...", "open="+sampleTIFF+" number="+numfiles+" starting=1 increment=1 scale=100 file=.tif sort use");

print("Image Sequence run; doing Make Montage...");

run("Make Montage...", "columns="+xLocations+" rows="+ NumSlices +" scale=1 first=1 last="+numfiles+" increment=1 border=0");

saveAs("Tiff", outDir+"CAN_"+base+".tif");

-- where xLocations and NumSlices are the number of images in X and Y,
respectively; and sampleTIFF is one of a series of TIFFs that are tiles,
numbered sequentially (_0000.tif, _0001.tif, _0002.tif and so on)

This is the only way I could avoid the NegativeArraySizeException erorr.

HTH.

   Mark

  Mark Chopping, Ph.D.
  Montclair State University, Montclair, NJ 07043
  http://www.montclair.edu/csam/remote-sensing-lab/

----

> Date: Thu, 3 Dec 2015 14:34:39 +0200
> From: Aryeh Weiss <[hidden email]>
> To: [hidden email]
> Subject: handling very large images
>
> I have a very large image (25x30 images, each is 1600x1200 pixels) that I
> want to load into imagej.
>
> This produces the java.lang.NegativeArraySizeException that was discussed in
> the following thread:
> imagej.1557.x6.nabble.com/Montage-java-lang-NegativeArraySizeException-td5014201.html
>
> In this thread, Curtis refers to a FAQ entry
> http://imagej.net/FAQ#I_got_a_NegativeArraySizeException._What_caused_it.3F
> but I did not find it in the FAQ after following the link.
>
> This image is not a stack, so I cannot use virtual stack.
> I tried to use the crop on import option, and asked for a 12000x12000
> section.
> It started off ok , and reported that it is verifying the cropping.
> Memory monitor reported that about 6.7GB were being used.
> It ran for about 45 minutes, and then finally threw the
> NegativeArraySizeException.
>
> Now I am trying it with a 5000x5000 crop, which should be no problem to load.
> memory monitor claims
> 6.4 GB are in use. Again, no image has appeared even after about 20 minutes.
>
> Is there a work around to load it?
> Alternatively, is there a way to subsample it?
>
> --aryeh
>
> --
> Aryeh Weiss
> Faculty of Engineering
> Bar Ilan University
> Ramat Gan 52900 Israel
>
> Ph:  972-3-5317638
> FAX: 972-3-7384051
>
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html