Weka Segmentation not enough memory

Hello everyone,

I am trying to use the Weka Segmentation (v3.2.34) Plugin in Fiji for identification of cells with a process and cells without a process. When I am trying to train the Classifier with an image of my cells (9338x9339 pixel, 32 bit, z-projection “Sum Slices”), it either gives me an error that there is not enough memory or I wait for several days and it keeps calculating without a result. The computer I am using has 192 GB RAM with a Intel® Xeon® Silver 4214 CPU @2.20GHz 2.19GHz (2 processors) Processor and Fiji is already using up to 70% of the memory.
For assigning the classes for the Segmentation I first run a threshold on my original image and invert it to get the Background and by creating a Selection and restoring the Selection in Weka I add the trace for the Background.
Similarly, I use the “Analyze Particles” function to selet round cells without a process by setting the circularity to 0.75-1.00 and load the created mask into Weka as the trace for cells without a process.
Cells with a process I select manually with the “Wand” tool.

open(“Z:/image.tif”);
selectWindow(“image.tif”);
//setTool(“freeline”);
run(“Advanced Weka Segmentation”);
call(“trainableSegmentation.Weka_Segmentation.setFeature”, “Mean=true”);
call(“trainableSegmentation.Weka_Segmentation.setFeature”, “Maximum=true”);
call(“trainableSegmentation.Weka_Segmentation.setFeature”, “Anisotropic_diffusion=true”);
call(“trainableSegmentation.Weka_Segmentation.setFeature”, “Bilateral=true”);
call(“trainableSegmentation.Weka_Segmentation.setFeature”, “Kuwahara=true”);
call(“trainableSegmentation.Weka_Segmentation.setMembraneThickness”, “3”);
call(“trainableSegmentation.Weka_Segmentation.changeClassName”, “0”, “Cells with Process”);
call(“trainableSegmentation.Weka_Segmentation.changeClassName”, “1”, “Cells without Process”);
call(“trainableSegmentation.Weka_Segmentation.createNewClass”, “Background”);
open(“image.tif”);
selectWindow(“image.tif”);
setAutoThreshold(“Default dark”);
//run(“Threshold…”);
setOption(“BlackBackground”, false);
run(“Convert to Mask”);
run(“Invert”);
run(“Create Selection”);
selectWindow(“Trainable Weka Segmentation v3.2.34”);
run(“Restore Selection”);
call(“trainableSegmentation.Weka_Segmentation.addTrace”, “2”, “1”);
selectWindow(“image.tif”);
open(“image.tif”);
selectWindow(“image.tif”);
setAutoThreshold(“Default dark”);
//run(“Threshold…”);
run(“Convert to Mask”);
run(“Analyze Particles…”, “size=30-300 circularity=0.75-1.00 show=Masks include”);
run(“Create Selection”);
selectWindow(“Trainable Weka Segmentation v3.2.34”);
run(“Restore Selection”);
call(“trainableSegmentation.Weka_Segmentation.addTrace”, “1”, “1”);
//setTool(“wand”);
//run(“Wand Tool…”, “tolerance=2868 mode=Legacy”);
doWand(2598, 3198, 2868.0, “Legacy”);
doWand(2580, 3130, 2868.0, “Legacy”);
//setTool(“wand”);
//run(“Wand Tool…”, “tolerance=3589 mode=Legacy”);
call(“trainableSegmentation.Weka_Segmentation.addTrace”, “0”, “1”);
doWand(4414, 3839, 3589.0, “Legacy”);
call(“trainableSegmentation.Weka_Segmentation.addTrace”, “0”, “1”);
doWand(4188, 5796, 3589.0, “Legacy”);
doWand(4182, 5823, 3589.0, “Legacy”);
doWand(4168, 5846, 3589.0, “Legacy”);
doWand(4170, 5841, 3589.0, “Legacy”);
doWand(4179, 5826, 3589.0, “Legacy”);
call(“trainableSegmentation.Weka_Segmentation.addTrace”, “0”, “1”);
doWand(2733, 7477, 3589.0, “Legacy”);
doWand(2703, 7402, 3589.0, “Legacy”);
doWand(2762, 7528, 3589.0, “Legacy”);
doWand(2755, 7523, 3589.0, “Legacy”);
call(“trainableSegmentation.Weka_Segmentation.addTrace”, “0”, “1”);
doWand(7061, 4044, 3589.0, “Legacy”);
doWand(7060, 4032, 3589.0, “Legacy”);
call(“trainableSegmentation.Weka_Segmentation.addTrace”, “0”, “1”);
call(“trainableSegmentation.Weka_Segmentation.trainClassifier”);

This is the error I get:

Here you can find an example image and examples of cells with processes and without:
https://drive.google.com/drive/folders/1-CLm59wXBCsGvDCrzawOGYAZuXPSv-GW?usp=sharing

Is there a way this segmentation could still work?
Reducing the size of the image unfortunately doesn’t work since you cannot see the processes of the cells in a reduced image.
Might the problem be that the trace for the Background is too big?

Thanks a lot in advance,
Frederike

It sounds like you are giving too much information to the classifier. My understanding is that you only need a few pixels per label for training. Furthermore, your image is very large and it may be easier if you were to tile it (i.e. smaller images without reducing resolution).