Weka Segmentation: Generating ROI from semantic segmentation and cropping

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Weka Segmentation: Generating ROI from semantic segmentation and cropping

Mohaja14
Hello I am Samuel,

I am trying to study fuel cells for my graduate degree, where I have to
study many images. I am trying to build a macro that will generate a ROI
around the top most layer and crop it. As you can see in the picture below,
the top most layer is called the CL layer.
<http://imagej.1557.x6.nabble.com/file/t382438/Fig-SEM-Micrograph-of-Cross-section-of-SOFC-Single-Cell.png>
I would like this macro to run on a batch of images, but not every image is
the same. Sometimes the contact layer can be higher/lower, or
thinner/thicker. So I cannot simply hard code specific retangular ROI
dimensions, because it may capture not enough of the CL layer, or it may
capture some of the layer below it.
I am trying to use the Trainable Weka Segmentation, because it seemed best
suited for this task. Where I can train it to select only the CL layer.
<http://imagej.1557.x6.nabble.com/file/t382438/trained.jpg>  
In the image above I have cropped the CL layer and the layer below it, the
CFL layer. I then trained my classifier to segment the image into 3 parts,
the CL layer, the CFL layer, and the background. Now my real question is: In
a macro, how can I generate a ROI around the area with the most red traces,
and then crop it so it only contains the CL layer with a batch of images?

Thank you,
Samuel Sayed



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

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

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

Krs5
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