Error loading images programmatically in Medical Image Labeler

27 views (last 30 days)
I'm trying to upload a series of nifti images in a new session of Medical Image Labeler. I created a groundTruthMedical object copying the structure of the groundTruthMedical object that the app generate when a new session is started.
I reported here an example of what I did:
dataFolder = "D:\documents\datasets\";
filePath1 = fullfile(dataFolder,"image1.nii.gz");
filePath2 = fullfile(dataFolder,"image2.nii.gz");
source = {filePath1; filePath2};
dataSource = medical.labeler.loading.VolumeSource(source);
labelData = strings(size(source,1),1); % empty string array of size 2x1
variableNames = {'Name', 'LabelColor', 'PixelLabelID'};
variableTypes = {'string','double','uint8'};
labelDef = table('Size',[0,3],'VariableTypes',variableTypes,'VariableNames',variableNames); % empty table of size 0x3
gTruth = groundTruthMedical(dataSource,labelDef,labelData);
% opens the app and loads the image and label data stored in gTruth
medicalImageLabeler(gTruth)
I have no labelled data because I want to manually segment the images, this is because I created labelData and labelDef as "empty variables".
Medical Image Labeler opens and load the images but an error occurs every time. The error says: "The VariableNames property must contain one name for each variable in the table."
I am pretty sure that the table I created contains one name for each variable, becuse therea are three columns, corresponding to the variables and there are three elements in the variableNames cell.
I don't know how to solve this problem. Is there anyone that faced the same issue and have found a solution?

Accepted Answer

Cris LaPierre
Cris LaPierre on 14 Apr 2024 at 20:43
This appears to be a bug that occurs when your LabelDefinitions table is empty. I was able to duplicate the error using the gTruthMed object created by a labeling session that did not hae any labels defined.
I will report this internally. In the mean time, you can hit 'OK' on the popup and continue using the app.

More Answers (0)

Products


Release

R2024a

Community Treasure Hunt

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

Start Hunting!