Hi,
I’m trying to write a Jython script where I use Clij for a standard filtering + labelling + regions stats pipeline. I started with “real” images and couldn’t get it to work so I made a minimal example using the blobs image which shows the same problem. As visible in the attached image, only some regions get labelled and the others not. Also, the results table is full of strange values.
I couldn’t find a description of labelling + regions stats in the Clij-Jython documentation and imported the functions that I believe should do the work, but it’s entirely possible I misused those functions. Here’s the script:
from ij import IJ, ImagePlus, WindowManager
from net.haesleinhuepf.clij import CLIJ;
from net.haesleinhuepf.clij.advancedfilters.StatisticsOfLabelledPixels import statisticsOfLabelledPixels;
from net.haesleinhuepf.clij.advancedfilters.ConnectedComponentsLabeling import connectedComponentsLabeling;
from net.haesleinhuepf.clij.coremem.enums import NativeTypeEnum;
from ij.measure import ResultsTable
#load and binarize blobs
IJ.run("Blobs (25K)");
imp = IJ.getImage()
imp.setTitle("blobs_gray");
#create results table
my_results = ResultsTable()
#get clij instance and push to GPU
clij = CLIJ.getInstance();
raw = clij.push(imp);
src = clij.create(raw);
dst = clij.create(raw);
#thresholding
clij.op().automaticThreshold(raw, src, 'Otsu');
#run labelling + stats
connectedComponentsLabeling(clij, src, dst)
statisticsOfLabelledPixels(clij, raw, dst, my_results)
#show output
my_results.show('cell_measures')
binary = clij.pull(src);
binary.show();
binary.setTitle("binary");
connect_comp = clij.pull(dst);
connect_comp.show();
connect_comp.setTitle("connect_comp");
Maybe @haesleinhuepf can help ?
Cheers,
Guillaume