Freehand ROI for MEDSAM automated algorithm in medical image labeller
I am trying to implement the segmentation labelling based on MEDSAM from this link into the medical image labeller:
Interactively Segment and Analyze ROI Using MedSAM and Radiomics – MATLAB & Simulink – MathWorks América Latina
Automate Labeling in Medical Image Labeler – MATLAB & Simulink – MathWorks América Latina
However, I the unique way to create do this is opening a figure different than the interface of the medical image labeller, who takes times and is inefficient. Is there a way at least to create the ROI inside the medical image labeller (using freehand), and then passing this ROI to the automated function? I created my function below from the image. Also I was trying to create a listener without success for tuning the ROI while doing the segmentation on the medical image labeller.
function MASK = medsam_p(I,MASK)
%Medical Image Processing Function with MEDSAM
%
% Replace the sample below with your code———————————-
medsam = medicalSegmentAnythingModel;
embeddings = extractEmbeddings(medsam,I);
%roi = drawrectangle;
f = figure;
ax = axes(f);
dispIm = imshow(I,[],Parent=ax);
f.WindowState="maximized";
roi = drawrectangle(ax,’Label’,’ROI’);
%wait(roi); % Wait for the user to finish drawing
% Get the position of the drawn rectangle
MASK = segmentObjectsFromEmbeddings(medsam,embeddings,size(I),BoundingBox=roi.Position);
%————————————————————————–
endI am trying to implement the segmentation labelling based on MEDSAM from this link into the medical image labeller:
Interactively Segment and Analyze ROI Using MedSAM and Radiomics – MATLAB & Simulink – MathWorks América Latina
Automate Labeling in Medical Image Labeler – MATLAB & Simulink – MathWorks América Latina
However, I the unique way to create do this is opening a figure different than the interface of the medical image labeller, who takes times and is inefficient. Is there a way at least to create the ROI inside the medical image labeller (using freehand), and then passing this ROI to the automated function? I created my function below from the image. Also I was trying to create a listener without success for tuning the ROI while doing the segmentation on the medical image labeller.
function MASK = medsam_p(I,MASK)
%Medical Image Processing Function with MEDSAM
%
% Replace the sample below with your code———————————-
medsam = medicalSegmentAnythingModel;
embeddings = extractEmbeddings(medsam,I);
%roi = drawrectangle;
f = figure;
ax = axes(f);
dispIm = imshow(I,[],Parent=ax);
f.WindowState="maximized";
roi = drawrectangle(ax,’Label’,’ROI’);
%wait(roi); % Wait for the user to finish drawing
% Get the position of the drawn rectangle
MASK = segmentObjectsFromEmbeddings(medsam,embeddings,size(I),BoundingBox=roi.Position);
%————————————————————————–
end I am trying to implement the segmentation labelling based on MEDSAM from this link into the medical image labeller:
Interactively Segment and Analyze ROI Using MedSAM and Radiomics – MATLAB & Simulink – MathWorks América Latina
Automate Labeling in Medical Image Labeler – MATLAB & Simulink – MathWorks América Latina
However, I the unique way to create do this is opening a figure different than the interface of the medical image labeller, who takes times and is inefficient. Is there a way at least to create the ROI inside the medical image labeller (using freehand), and then passing this ROI to the automated function? I created my function below from the image. Also I was trying to create a listener without success for tuning the ROI while doing the segmentation on the medical image labeller.
function MASK = medsam_p(I,MASK)
%Medical Image Processing Function with MEDSAM
%
% Replace the sample below with your code———————————-
medsam = medicalSegmentAnythingModel;
embeddings = extractEmbeddings(medsam,I);
%roi = drawrectangle;
f = figure;
ax = axes(f);
dispIm = imshow(I,[],Parent=ax);
f.WindowState="maximized";
roi = drawrectangle(ax,’Label’,’ROI’);
%wait(roi); % Wait for the user to finish drawing
% Get the position of the drawn rectangle
MASK = segmentObjectsFromEmbeddings(medsam,embeddings,size(I),BoundingBox=roi.Position);
%————————————————————————–
end medical image labeller, medsam MATLAB Answers — New Questions