When trying to use imageSegmenter with a a uint8 from the workspace or from file, I get a strange error.

2 views (last 30 days)
So I have a very simple code:
clear
clc
close all
I = imread('Ji2013t.PNG');
figure
imagesc(I)
axis equal
%%imdistline 100 microns = 30 pixels
Ic = I(1:135,142:end,:);
Ic = (Ic);
figure
imagesc(Ic)
axis equal
imageSegmenter(Ic);
And MATLAB 2017b runs all of this fine. However, when it opens the ImaeSegmenter App, it throws a ton of red, with the message:
57 imageLoadSuccess = self.Toolstrip.loadImageInSegmentTab(im);
Warning: The following error was caught while executing
'iptui.internal.segmenter.TwoMaskScrollPanel' class destructor:
Undefined function 'isvalid' for input arguments of type 'double'.
Error in iptui.internal.segmenter.TwoMaskScrollPanel/delete (line
221)
if isvalid(self.hFig)
Error in iptui.internal.segmenter.TwoMaskScrollPanel (line 36)
function self = TwoMaskScrollPanel(im)
Error in
iptui.internal.segmenter.ImageSegmentationTool/buildScrollPanel
(line 590)
self.ScrollPanel =
iptui.internal.segmenter.TwoMaskScrollPanel(im);
Error in
iptui.internal.segmenter.ImageSegmentationTool/createSessionFromImage
(line 89)
self.buildScrollPanel(im);
Error in iptui.internal.segmenter.SegmentTab/importImageData (line
202)
self.hApp.createSessionFromImage(im,
self.IsDataNormalized, self.IsInfNanRemoved);
Error in iptui.internal.segmenter.Toolstrip/loadImageInSegmentTab
(line 100)
TF = self.hSegmentTab.importImageData(im);
Error in iptui.internal.segmenter.ImageSegmentationTool (line 57)
imageLoadSuccess =
self.Toolstrip.loadImageInSegmentTab(im);
Error in imageSegmenter (line 46)
iptui.internal.segmenter.ImageSegmentationTool(I,isRGB);
Error in Ji2013 (line 18)
imageSegmenter(Ic);
> In iptui.internal.segmenter.TwoMaskScrollPanel (line 36)
In iptui.internal.segmenter.ImageSegmentationTool/buildScrollPanel (line 590)
In iptui.internal.segmenter.ImageSegmentationTool/createSessionFromImage (line 89)
In iptui.internal.segmenter.SegmentTab/importImageData (line 202)
In iptui.internal.segmenter.Toolstrip/loadImageInSegmentTab (line 100)
In iptui.internal.segmenter.ImageSegmentationTool (line 57)
In imageSegmenter (line 46)
In Ji2013 (line 18)
Error using figure
Value must be either:
an Mx3 array of type single or double in the range [0 1]
an Mx3 array of type uint8
Error in iptui.internal.segmenter.TwoMaskScrollPanel (line 43)
self.hFig = figure(...
Error in
iptui.internal.segmenter.ImageSegmentationTool/buildScrollPanel
(line 590)
self.ScrollPanel =
iptui.internal.segmenter.TwoMaskScrollPanel(im);
Error in
iptui.internal.segmenter.ImageSegmentationTool/createSessionFromImage
(line 89)
self.buildScrollPanel(im);
Error in iptui.internal.segmenter.SegmentTab/importImageData (line
202)
self.hApp.createSessionFromImage(im,
self.IsDataNormalized, self.IsInfNanRemoved);
Error in iptui.internal.segmenter.Toolstrip/loadImageInSegmentTab
(line 100)
TF = self.hSegmentTab.importImageData(im);
Error in iptui.internal.segmenter.ImageSegmentationTool (line 57)
imageLoadSuccess =
self.Toolstrip.loadImageInSegmentTab(im);
Error in imageSegmenter (line 46)
iptui.internal.segmenter.ImageSegmentationTool(I,isRGB);
Error in Ji2013 (line 18)
imageSegmenter(Ic);
I have never experienced this kind of error from MATLAB. I'm ussually prett aware of any errors I can make, but I have no clue for this one. I tried to convert my uint8 to double using double(Ic), but that failed too. I tried to upload from file, same error, I tried different images, no go, I even tried to debug the function iptui.internal.segmenter.ImageSegmentationTool(I,isRGB), and got to:
imageLoadSuccess = self.Toolstrip.loadImageInSegmentTab(im);
However, when trying to go into loadImageInSegment, I run int problems as it is either JAVA or C++ code and MATLAB can't find it.
Any help would be useful.
Sincerely
Alex
  1 Comment
Alexander Dumont
Alexander Dumont on 27 Jan 2020
After further digging, I determined that line 221 of function 'iptui.internal.segmenter.TwoMaskScrollPanel' is the error. The function isvalid does not seem to be defined. Very strange.

Sign in to comment.

Accepted Answer

Harsha Priya Daggubati
Harsha Priya Daggubati on 30 Jan 2020
Hi
I tried reproducing the issue in 2017b version, but everything works fine for me. I suggest to use the following commands and run the code again.
rehash toolbox
rehash toolboxcache
Hope this works!

More Answers (0)

Categories

Find more on Introduction to Installation and Licensing in Help Center and File Exchange

Products


Release

R2017b

Community Treasure Hunt

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

Start Hunting!