Skip to content

Commit f938de0

Browse files
author
dlegland
committed
Slicer: keep calibration and settings when image is crop
1 parent e86b894 commit f938de0

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

matImage/imStacks/CropStackDialog.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ function onApplyButtonClicked(this, hObject, eventdata) %#ok<INUSD>
204204
name = 'cropped';
205205
end
206206
Slicer(img2, ...
207-
'imageType', this.parent.imageType, ...
207+
'parent', this.parent, ...
208208
'name', name);
209209

210210
close(this);

matImage/imStacks/Slicer.m

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,11 @@
6363
% 'vector', 'none'. Default value is assessed from data type and
6464
% size.
6565
%
66+
% * 'parent' another instance of Slicer, that is used to initialize
67+
% several parameters like spatial resolution, display range, LUT
68+
% for display...
69+
%
70+
%
6671
% Example
6772
% % Explore human brain MRI
6873
% metadata = analyze75info('brainMRI.hdr');
@@ -87,7 +92,7 @@
8792

8893
%% Properties
8994
properties
90-
% reference image (can be 2D, 3D or 4D)
95+
% Image data stored as a 3D or 4D array, in YX(C)Z order.
9196
imageData;
9297

9398
% type of image. Can be one of:
@@ -185,6 +190,9 @@
185190
% parses input arguments
186191
parsesInputArguments();
187192

193+
% add checkup on visible image slice
194+
this.sliceIndex = min(this.sliceIndex, this.imageSize(3));
195+
188196
updateCalibrationFlag(this);
189197

190198
% create default figure
@@ -224,6 +232,20 @@ function parsesInputArguments()
224232
while length(varargin) > 1
225233
param = varargin{1};
226234
switch lower(param)
235+
case 'parent'
236+
% copy some settings from parent Slicer
237+
parent = varargin{2};
238+
this.sliceIndex = parent.sliceIndex;
239+
this.voxelSize = parent.voxelSize;
240+
this.voxelOrigin = parent.voxelOrigin;
241+
this.voxelSizeUnit = parent.voxelSizeUnit;
242+
this.calibrated = parent.calibrated;
243+
this.imageType = parent.imageType;
244+
this.displayRange = parent.displayRange;
245+
this.colorMap = parent.colorMap;
246+
this.bgColor = parent.bgColor;
247+
this.calibrated = parent.calibrated;
248+
227249
case 'slice'
228250
% setup initial slice
229251
pos = varargin{2};

0 commit comments

Comments
 (0)