Skip to content

Commit 3189c74

Browse files
committed
Update Image math operations
1 parent cac5287 commit 3189c74

File tree

4 files changed

+18
-10
lines changed

4 files changed

+18
-10
lines changed

ImageM/+imagem/+actions/+analyze/AverageValueByRegion.m

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,9 @@ function run(obj, frame) %#ok<INUSL>
100100
end
101101

102102
% create first axis
103-
res.Axes{1} = table.axis.NumericalAxis('Label', labels(:)');
103+
if isprop(res, 'Axes')
104+
res.Axes{1} = table.axis.NumericalAxis('Label', labels(:)');
105+
end
104106
res.Name = [intensityImage.Name '-AverageValues'];
105107

106108
% display in a new table

ImageM/+imagem/+actions/+process/ImageMathematic.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
Handles;
2222
Viewer;
2323

24-
OpList = {@plus, @minus, @times, @rdivide, @power, @min, @max};
24+
OpList = {@plus, @minus, @mtimes, @mrdivide, @mpower, @min, @max};
2525
OpNames = {'Plus', 'Minus', 'Times', 'Divides', 'power', 'min', 'max'};
2626

2727
end % end properties

ImageM/+imagem/+actions/+process/ImageValuesTransform.m

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,11 @@
2121
Handles;
2222
Viewer;
2323

24-
OpList = {@log, @exp, @sqrt, @sin, @cos, @tan};
25-
OpNames = {'log', 'exp', 'sqrt', 'sin', 'cos', 'tan'};
24+
% the list of math operation to apply, as function handles
25+
OpList = {@log, @exp, @sqrt, @sin, @cos, @tan, @round, @floor, @ceil};
26+
27+
% the list of math operation names, to populate widgets
28+
OpNames = {'log', 'exp', 'sqrt', 'sin', 'cos', 'tan', 'round', 'floor', 'ceil'};
2629

2730
end % end properties
2831

@@ -103,15 +106,18 @@ function onButtonOK(obj, varargin)
103106
op = obj.OpList{opIndex};
104107
opName = char(op);
105108

109+
% compute result data
110+
data2 = op(doc.Image.Data);
111+
106112
% compute result image
107-
res = op(doc.Image);
113+
res = Image('Data', data2, 'Parent', doc.Image);
108114

109115
% add image to application, and create new display
110116
newDoc = addImageDocument(obj.Viewer, res);
111117

112118
% add history
113-
string = sprintf('%s = %s(%s));\n', ...
114-
newDoc.Tag, opName, doc.Tag);
119+
string = sprintf('%s = Image(''Data'', %s(%s.Data), ''Parent'', %s);\n', ...
120+
newDoc.Tag, opName, doc.Tag, doc.Tag);
115121
addToHistory(obj.Viewer, string);
116122

117123
closeFigure(obj);

ImageM/+imagem/+gui/FrameMenuBuilder.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -287,9 +287,9 @@ function buildImageFrameMenu(obj, hf)
287287
addMenuItem(obj, processMenu, imagem.actions.process.ImageWatershed(), 'Watershed...');
288288
addMenuItem(obj, processMenu, imagem.actions.process.ImageExtendedMinWatershed(), 'Extended Min Watershed...');
289289

290-
addMenuItem(obj, processMenu, imagem.actions.process.ImageArithmetic(), 'Image Arithmetic...', true);
291-
addMenuItem(obj, processMenu, imagem.actions.process.ImageValuesTransform(), 'Image Maths 1...');
292-
addMenuItem(obj, processMenu, imagem.actions.process.ImageMathematic(), 'Image Maths 2...');
290+
addMenuItem(obj, processMenu, imagem.actions.process.ImageValuesTransform(), 'Image Values Transform...', true);
291+
addMenuItem(obj, processMenu, imagem.actions.process.ImageMathematic(), 'Image Maths (Image+Value)...');
292+
addMenuItem(obj, processMenu, imagem.actions.process.ImageArithmetic(), 'Image Maths (Image+Image)...');
293293

294294
binaryMenu = addMenu(obj, processMenu, 'Binary / Label Images', 'Separator', 'On');
295295
addMenuItem(obj, binaryMenu, imagem.actions.process.binary.ConnectedComponentsLabeling(), 'Connected Components Labeling');

0 commit comments

Comments
 (0)