Dear 3D-Slicer community,
I am developing an extension using MatlabBridge which involves loading 3D and 4D images into 3D-Slicer. I adapted the automatically generated Matlab function to do so, but unfortunately it only works when I select “Create new volume” in the dropdown IO > “Create new volume” (see Figure 2). I have multiple volumes that need to be displayed by 3D-Slicer and I don’t want the user to click through each volume and select “Create new volume”. When I leave the setting at “None” (default, see Figure 1), the code returns the following error:
Is there a way to create an empty volume by default? Maybe by modifying the xml-file or the Matlab function? When using “Create new volume”, the struct “inputParams.outputvolume” contains a path to a nrrd-file and a params-file which are afterwards created by the function “cli_imagewrite”. I tried to set similar paths (before calling “cli_imagewrite”) when using the setting “None” for “Output volume”. But this does not work either.
Many thanks in advance for your help.
Figure 1 - not working setting:
Figure 2 - working setting:
Code:
function outputParams=test2(inputParams)
outputParams.min=0; % just to prevent no outputParams given error
outputParams.max=0;
load("/home/user/my_mask.mat") % loads the matrix "mask"
img.pixelData=int8(mask);
inputParams.outputvolume.
cli_imagewrite(inputParams.outputvolume, img);