Operating system: iOS10.3.2
Slicer version: 4.6.2
Expected behavior: Matlab module executes properly
Actual behavior: “Completed with errors”
Dear team,
I’m trying to create a Matlab module for Slicer with Matlab Bridge.
I get an error when trying to write the info from a matrix M into the img.pixelData param.
This is a part of the algorithm:
function outputParams=TFG(inputParams)
% Parameters:
% inputParams.threshold: threshold value
% inputParams.inputvolume: input image filename
% inputParams.outputvolume: output image filename, result of the processing
% outputParams.distancia: points distance
img = cli_imageread(inputParams.inputvolume);
M = img.pixelData;
S = size(M);
img.pixelData = M;
cli_imagewrite(inputParams.outputvolume, img);
I get the error:
expr: syntax error
Failed to execute Matlab function: TFG, received the following error message:
ERROR: Command execution failed. Field assignment to a non-structure array object.
Error in TFG (line 102)
img.pixelData(1) = M;
Error in cli_commandserver (line 91)
response=evalc(cmd);
Error in run (line 86)
evalin(‘caller’, [script ‘;’]);
Do you know how can I fix it?
Thank you very much,
King regards,
Marina C.