You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, i want to use Trainable Weka Segmentation to analyse images of fluorescent cell clusters.
When manually running the plugin i can load a saved classifier and apply it just fine.
However, when automating the segmentation using a beanshell script it returns a black image instead as the result. This is the script used:
import ij.IJ;
import ij.ImageStack;
import ij.ImagePlus;
import ij.process.ColorSpaceConverter;
import ij.process.ByteProcessor;
import trainableSegmentation.*;
import weka.clusterers.EM;
import weka.clusterers.SimpleKMeans;
import weka.core.WekaPackageManager;
import weka.core.WekaPackageClassLoaderManager;
// input train image
input = IJ.getImage();
// create Weka Segmentation object
segmentator = new WekaSegmentation( input );
// load classifier from file
segmentator.loadClassifier("D:/fiji-win64/greenClass.model");
// apply classifier to current training image and get label result
// (set parameter to true to get probabilities)
segmentator.applyClassifier(false);
// get result (float image)
result = segmentator.getClassifiedImage();
result.show();
The script does return the probability maps as expected , but not the classified image . The used image and expected results are shown here:
The original image
The result from manual segmentation
The result from running the script with segmentator.applyClassifier(false); , this happens for every image processed using the script
The probability from running the script with segmentator.applyClassifier(true);
I am not sure if this is an issue with the script i am using or with the trainable segmentation itself, but i am hoping it is an easy fix. Thanks in advance :)
Edit: I also tried to immediately convert the generated probability using this script posted earlier https://gist.github.com/iarganda/c7fc0a88b8d2737c9d3d , which generated the same black image as generated by segmentator.applyClassifier(false);. Perhaps it is something related to this?
The text was updated successfully, but these errors were encountered:
Are you sure the image is completely "black"? It might be just 0s and 1s so you need to adjust the contrast or simply apply a LUT to see both classes. If you want to have the same LUT as in the plugin, after getting the result image, do the following:
Thank you for getting back to me so quick.
Intensity analysis confirms that the image contains only pixels with 0 intensity. Applying the golden angle LUT results in this image.
A quick test of the 'color-based segmentation using clustering' seems to produce promising results so i will look into using that instead.
Hello, i want to use Trainable Weka Segmentation to analyse images of fluorescent cell clusters.
When manually running the plugin i can load a saved classifier and apply it just fine.
However, when automating the segmentation using a beanshell script it returns a black image instead as the result. This is the script used:
The script does return the probability maps as expected , but not the classified image . The used image and expected results are shown here:
The original image
The result from manual segmentation
The result from running the script with segmentator.applyClassifier(false); , this happens for every image processed using the script
The probability from running the script with segmentator.applyClassifier(true);
I am not sure if this is an issue with the script i am using or with the trainable segmentation itself, but i am hoping it is an easy fix. Thanks in advance :)
Edit: I also tried to immediately convert the generated probability using this script posted earlier https://gist.github.com/iarganda/c7fc0a88b8d2737c9d3d , which generated the same black image as generated by segmentator.applyClassifier(false);. Perhaps it is something related to this?
The text was updated successfully, but these errors were encountered: