Batch Trainable Weka Segmentation in MATLAB?

Hello,

I’m interested in using MATLAB to call the ImageJ Trainable Weka Segmentation. Right now, in the code, below I am 1) loading an image ‘avgimg’: 2) loading a classifier, and then 3) calculating the probability of the image using a classifer.

Instead I would like 1) load the classifier 2) iterate through a list of images and get the probability for each image using the same classifier.

Does anyone know how I can modify my code to do this?

Thank you

IJM.show(‘avgimg’); % Load an image and show it in IJ
MIJ.run(‘Trainable Weka Segmentation’); % Start Weka, do the magic
pause(1);
trainableSegmentation.Weka_Segmentation.loadClassifier(classifer_file);
trainableSegmentation.Weka_Segmentation.getProbability();
IJM.getDatasetAs(‘probmaps’); % Receive computed results
probmapObject = probmaps(:,:,2)’;
MIJ.run(‘Close All’); % close all image windows

1 Like

@jclab

You can actually do this in ImageJ directly - within the Script Editor - by using this example code in BeanShell that allows you to apply a classifier to all images in a folder… :slight_smile: