-
Notifications
You must be signed in to change notification settings - Fork 1
/
LaplaceModule.m
75 lines (73 loc) · 3.07 KB
/
LaplaceModule.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
function LaplaceModule(inputParams)
% Example function that returns the minimum and maximum voxel value in a volume
% and performs thresholding operation on the volume.
%
% Parameters:
% inputParams.inputmap: input label map
% inputParams.outputvolume: output label map
%
inputmap=cli_imageread(inputParams.inputmap);
labelmap = inputmap.pixelData;
LP = laplace_solver_Slicer(labelmap,inputParams.fg,inputParams.source,inputParams.sink,inputParams.maxiters);
%LP = inputmap;
save('C:\Users\jessi\Documents\MATLAB\test.mat');
outputmap = inputmap;
outputmap.pixelData = LP;
save('C:\Users\jessi\Documents\MATLAB\test.mat');
cli_imagewrite(inputParams.outputmap, outputmap);
%% Help for reading/writing parameters
%
% Reading input parameters
%
% integer, integer-vector, float, float-vector, double, double-vector, string, string-enumeration, file:
% value=inputParams.name;
% string-vector:
% value=cli_stringvectordecode(inputParams.name);
% point-vector:
% value=cli_pointvectordecode(inputParams.name);
% boolean:
% value=isfield(inputParams,'name');
% image:
% value=cli_imageread(inputParams.name);
% transform:
% value=cli_lineartransformread(inputParams.name);
% or (for generic transforms):
% value=cli_transformread(inputParams.name);
% point:
% values_LPS=cli_pointvectordecode(inputParams.name);
% [pointDim pointCount]=size(values_LPS);
% region:
% values=cli_pointvectordecode(inputParams.name);
% [regionDim regionCount]=size(values_LPS);
% center_LPS=[values(1:3,regionIndex); 1];
% radius_LPS=abs([values(4:6,regionIndex); 1]);
% measurement:
% value=cli_measurementread(inputParams.name);
% geometry:
% value=cli_geometryread(inputParams.name);
% Important: in the CLI definition file the following attribute shall be added to the geometry element: fileExtensions=".ply"
% See https://subversion.assembla.com/svn/slicerrt/trunk/MatlabBridge/src/Examples/MeshScale/ for a complete example.
%
% Notes:
% - Input and file (image, transform, measurement, geometry) parameter names are defined by the <longflag> element in the XML file
% - Output parameter names are defined by the <name> element in the XML file
% - For retrieving index-th unnamed parameter use inputParams.unnamed{index+1} instead of inputParams.name
%
%
% Writing output parameters
%
% integer, integer-vector, float, float-vector, double, double-vector, string, string-enumeration, file:
% outputParams.name=value;
% image:
% cli_imagewrite(inputParams.name, value);
% transform:
% cli_lineartransformwrite(inputParams.name, value);
% or (for generic transforms):
% cli_transformwrite(inputParams.name, value);
% measurement:
% cli_measurementwrite(inputParams.name, value);
% geometry:
% cli_geometrywrite(inputParams.name, value);
% Important: in the CLI definition file the following attribute shall be added to the geometry element: fileExtensions=".stl"
% See https://subversion.assembla.com/svn/slicerrt/trunk/MatlabBridge/src/Examples/MeshScale/ for a complete example.
%