-1

I am trying to stitch images using the MosaicJ plugin in Fiji (ImageJ), however, I get the error in the code below. Does anyone know what it means and how I can fix this please? I have no experience using Java at all. I am using a MacBook by the way if this is relevant.Thanks. Java error

Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space
at ij.gui.NewImage.createFloatImage(NewImage.java:326)
at MosaicJTree.getGlobalImage(MosaicJ_.java:5306)
at MosaicJTree.createMosaic(MosaicJ_.java:4692)
at MosaicJ_.actionPerformed(MosaicJ_.java:222)
at java.awt.MenuItem.processActionEvent(MenuItem.java:669)
at java.awt.MenuItem.processEvent(MenuItem.java:628)
at java.awt.MenuComponent.dispatchEventImpl(MenuComponent.java:357)
at java.awt.MenuComponent.dispatchEvent(MenuComponent.java:345)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:763)
at java.awt.EventQueue.access$500(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.awt.EventQueue$3.run(EventQueue.java:703)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:84)
at java.awt.EventQueue$4.run(EventQueue.java:733)
at java.awt.EventQueue$4.run(EventQueue.java:731)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:730)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space

Tobi Lawal
  • 1
  • 1
  • 1
  • Well - it is an `OutOfMemoryError`, so your JVM has run out of memory. How large is the image you were trying to create? How much heap space is assigned to your JVM? – Hulk Apr 13 '22 at 11:38
  • Does this answer your question? [How to deal with "java.lang.OutOfMemoryError: Java heap space" error?](https://stackoverflow.com/questions/37335/how-to-deal-with-java-lang-outofmemoryerror-java-heap-space-error) – Hulk Apr 13 '22 at 11:39
  • @Hulk The file size is about 1.2GB and I assigned 6GB (75%) of my Maximum memory to ImageJ. Thank you for sending that link, I would have a look at it. – Tobi Lawal Apr 13 '22 at 13:32
  • Please provide enough code so others can better understand or reproduce the problem. – Community Apr 13 '22 at 15:02

1 Answers1

0

In your case, you're exceeding the maximum memory available in ImageJ.
So, if your data is not big and it can be handled in the memory. you can increase the memory that ImageJ can use: By: Edit > Options > Memory and Threads.

2- If your data is big, I will recommend using BigStitcher ImageJ plugin. you can find tutorials here: https://www.youtube.com/playlist?list=PLNZz8lLDpAeVOeAmQWMrKGOeB3vv28yJE .

MosaicJ was made a long time ago. So I am not sure if they supports lazy loading mode. or if they are using virtual stacking.

And I will recommend asking in : https://forum.image.sc/ and you can tag @ctrueden or one of the author, it is more effecient than stackoverflow in ImageJ related questions.

mzouink
  • 487
  • 1
  • 5
  • 13