Select for regions of interest in image analysis

6 visualizaciones (últimos 30 días)
LaraS el 16 de Nov. de 2023
Respondida: Image Analyst el 29 de Nov. de 2023
I'm processing images where I'm looking at focal adhesion structures on cells, and would like to write a code to segment those structures, but I'm not sure how to do so or if I'm doing it right. I want to write a code to trace intensities with the intention of isolating the most intense areas. Initially I was going to have it prompt for user-defined ROI but I'm trying to minimize bias. Any input would be appreciated! Here's my code so far.
for i=1:numframes
numROI = str2double(inputdlg('Enter the Number of ROI = ', fretfiles, i)); %user inputs specified intensity
if fbf==1
Fret_ins = zeros(size(ins(1,:))); %one row, x amount of columns
traces = zeros(length(ins(1,:)),6); %one row, x amount of columns
for i = 1:length(ins(1,:))
traces(i,1)= mean(cfp_trace,'all');
traces(i,2) = mean(yfp_trace,'all');
traces(i,4) = mean(cfp_trace,'all');
traces(i,5) = mean(yfp_trace,'all');
BW = createMask(cfp_trace,yfp_trace,0.5);
traces(i,7) = mean(cfp_trace(mask),'all');
traces(i,8) = mean(yfp_trace(mask),'all');

Respuestas (2)

Shreshth el 29 de Nov. de 2023
Hello LaraS,
I understand that you want to write code that segments focal adhesion structures on cells by tracing intensities to isolate the most intense areas.
Here are a few possible areas of improvement that I could observe in the code that you have provided.
  1. Manual ROI Selection: Your initial approach relies on manual input to determine the number of ROIs, which can introduce user bias and inconsistency, especially when processing a large number of frames.
  2. Variable Scope and Initialization:You're initializing variables like ‘Fret_ins‘ and traces inside the loop, which would reset their values on each iteration. This would result in losing previously stored data.
  3. Loop Indexing: The same loop index ‘i’ is used for both the outer and inner loops, which will lead to incorrect indexing and overwriting of variables.
As a potential alternative, using Otsu’s method for thresholding can deliver you the desired result.
Otsu's method is an automatic thresholding technique that works well when the image has a bimodal intensity histogram (i.e., two distinct peaks or classes). It calculates the threshold that minimizes the weighted within-class variance or, equivalently, maximizes the between-class variance. The method assumes that the image contains two classes of pixels (foreground and background) and then finds the threshold that separates these two classes so that their combined spread (intra-class variance) is minimal.
Advantages of Otsu's Method
Automatic: It does not require manual intervention or parameter tuning for each image, which makes it suitable for batch processing of images.
Objective: The threshold is determined by the algorithm based on image statistics, which eliminates user bias.
Efficient: Otsu's method is computationally efficient and can be easily implemented with built-in MATLAB functions.
For more information about Otsu's method and how to use it in MATLAB, you can refer to the documentation by MathWorks for ‘graythresh’ which is MATLAB's implementation of Otsu's method:
Thank you,
Shubham Shreshth.
  1 comentario
Image Analyst
Image Analyst el 29 de Nov. de 2023
Good catch on using i for both loops.
Fret_ins is not even used so that line could be removed.

Iniciar sesión para comentar.

Image Analyst
Image Analyst el 29 de Nov. de 2023
See my attached demo to get the mean of each frame. It could easily be adapted to give the mean of each blob if there are several blobs in each frame that are segmented out.


Más información sobre Image Processing Toolbox en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by