Skip to content

Commit 66303b9

Browse files
committed
update conversion between vector images and 3D images
1 parent 9f951cf commit 66303b9

File tree

4 files changed

+21
-13
lines changed

4 files changed

+21
-13
lines changed

ImageM/+imagem/+actions/+image/ConvertImage3DToVectorImage.m

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
% ConvertImage3DToVectorImage
88
%
99
% See also
10-
%
10+
% ConvertVectorImageToImage3D
1111

1212
% ------
1313
% Author: David Legland
14-
% e-mail: david.legland@inra.fr
14+
% e-mail: david.legland@inrae.fr
1515
% Created: 2019-11-15, using Matlab 9.7.0.1190202 (R2019b)
1616
% Copyright 2019 INRA - BIA-BIBS.
1717

@@ -24,7 +24,7 @@
2424
%% Constructor
2525
methods
2626
function obj = ConvertImage3DToVectorImage(varargin)
27-
% Constructor for ConvertImage3DToVectorImage class
27+
% Constructor for ConvertImage3DToVectorImage class.
2828

2929
end
3030

@@ -39,13 +39,13 @@ function run(obj, frame) %#ok<INUSL,INUSD>
3939
doc = currentDoc(frame);
4040

4141
% apply the conversion operation
42-
res = Image('Data', doc.Image.Data, 'vector', true);
42+
res = permute(doc.Image, [1 2 4 3 5]);
4343

4444
% create a new doc
4545
newDoc = addImageDocument(frame, res);
4646

4747
% add history
48-
string = sprintf('%s = Image(''Data'', %s.Data, ''vector'', true);\n', ...
48+
string = sprintf('%s = permute(%s, [1 2 4 3 5]);\n', ...
4949
newDoc.Tag, doc.Tag);
5050
addToHistory(frame, string);
5151
end

ImageM/+imagem/+actions/+image/ConvertVectorImageToImage3D.m

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
% ConvertVectorImageToImage3D
88
%
99
% See also
10-
%
10+
% ConvertImage3DToVectorImage
1111

1212
% ------
1313
% Author: David Legland
14-
% e-mail: david.legland@inra.fr
14+
% e-mail: david.legland@inrae.fr
1515
% Created: 2019-11-15, using Matlab 9.7.0.1190202 (R2019b)
1616
% Copyright 2019 INRA - BIA-BIBS.
1717

@@ -39,13 +39,13 @@ function run(obj, frame) %#ok<INUSL,INUSD>
3939
doc = currentDoc(frame);
4040

4141
% apply the conversion operation
42-
res = Image('Data', permute(doc.Image.Data, [1 2 4 3 5]));
42+
res = permute(doc.Image, [1 2 4 3 5]);
4343

4444
% create a new doc
4545
newDoc = addImageDocument(frame, res);
4646

4747
% add history
48-
string = sprintf('%s = Image(permute(%s.Data, [1 2 4 3 5]);\n', ...
48+
string = sprintf('%s = permute(%s, [1 2 4 3 5]);\n', ...
4949
newDoc.Tag, doc.Tag);
5050
addToHistory(frame, string);
5151
end

ImageM/+imagem/+actions/+image/PrintImageInfo.m

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,18 @@ function run(obj, frame) %#ok<INUSL,INUSD>
6868

6969
if ~isempty(img.ChannelNames)
7070
fprintf(' Channel Names: {''%s''', img.ChannelNames{1});
71-
for i = 2:channelNumber(img)
72-
fprintf(',''%s''', img.ChannelNames{i});
71+
nc = channelCount(img);
72+
if nc > 10
73+
for i = 2:10
74+
fprintf(', ''%s''', img.ChannelNames{i});
75+
end
76+
fprintf('... (%d more)}\n', nc-10);
77+
else
78+
for i = 2:nc
79+
fprintf(', ''%s''', img.ChannelNames{i});
80+
end
81+
fprintf('}\n');
7382
end
74-
fprintf('}\n');
7583
else
7684
fprintf(' Channel Names: {}\n');
7785
end

ImageM/+imagem/+gui/Image3DSliceViewer.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ function updateDisplay(obj)
248248
sliceImage = updateSliceImage(obj);
249249

250250
% compute display data
251-
cdata = imagem.gui.ImageUtils.computeDisplayImage(sliceImage, obj.Doc.ColorMap, obj.Doc.BackgroundColor);
251+
cdata = imagem.gui.ImageUtils.computeDisplayImage(sliceImage, obj.Doc.ColorMap, obj.DisplayRange, obj.Doc.BackgroundColor);
252252

253253
% changes current display data
254254
api = iptgetapi(obj.Handles.ScrollPanel);

0 commit comments

Comments
 (0)