Login  Register

Re: Weka Segmentation: Generating ROI from semantic segmentation and cropping

Posted by Krs5 on Oct 02, 2019; 8:32am
URL: http://imagej.273.s1.nabble.com/Weka-Segmentation-Generating-ROI-from-semantic-segmentation-and-cropping-tp5022476p5022479.html

Dear Samuel,

On the image you provided the code below seems not too bad. Not sure how it
will work on other images. I used the mean intensity on a line measurement
in the green channel to select the ROI and arbitrary I have set the
threshold for the selected ROI below 100. You could play around with this
(or use another parameter than mean).

title = getTitle();
run("Duplicate...", "title=test");
run("Split Channels");
selectWindow("test (green)");
getDimensions(width, height, channels, slices, frames);
mean=1000;
for (i=10; mean>100;i++){
        makeLine(0, height-i, width, height-i);
        getRawStatistics(nPixels, mean, min, max, std, histogram);
}
selectWindow(title);
makeRectangle(0, 0, width, height-i);
run("Crop");

Best wishes

Kees


Dr Ir K.R. Straatman
Senior Experimental Officer
Advanced Imaging Facility
Centre for Core Biotechnology Services
University of Leicester
www.le.ac.uk/advanced-imaging-facility
<https://www.le.ac.uk/advanced-imaging-facility>  





--
Sent from: http://imagej.1557.x6.nabble.com/

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html