Skip to content

Commit

Permalink
Slicer: keep calibration and settings when image is crop
Browse files Browse the repository at this point in the history
  • Loading branch information
dlegland committed Jul 30, 2015
1 parent e86b894 commit f938de0
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
2 changes: 1 addition & 1 deletion matImage/imStacks/CropStackDialog.m
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ function onApplyButtonClicked(this, hObject, eventdata) %#ok<INUSD>
name = 'cropped';
end
Slicer(img2, ...
'imageType', this.parent.imageType, ...
'parent', this.parent, ...
'name', name);

close(this);
Expand Down
24 changes: 23 additions & 1 deletion matImage/imStacks/Slicer.m
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@
% 'vector', 'none'. Default value is assessed from data type and
% size.
%
% * 'parent' another instance of Slicer, that is used to initialize
% several parameters like spatial resolution, display range, LUT
% for display...
%
%
% Example
% % Explore human brain MRI
% metadata = analyze75info('brainMRI.hdr');
Expand All @@ -87,7 +92,7 @@

%% Properties
properties
% reference image (can be 2D, 3D or 4D)
% Image data stored as a 3D or 4D array, in YX(C)Z order.
imageData;

% type of image. Can be one of:
Expand Down Expand Up @@ -185,6 +190,9 @@
% parses input arguments
parsesInputArguments();

% add checkup on visible image slice
this.sliceIndex = min(this.sliceIndex, this.imageSize(3));

updateCalibrationFlag(this);

% create default figure
Expand Down Expand Up @@ -224,6 +232,20 @@ function parsesInputArguments()
while length(varargin) > 1
param = varargin{1};
switch lower(param)
case 'parent'
% copy some settings from parent Slicer
parent = varargin{2};
this.sliceIndex = parent.sliceIndex;
this.voxelSize = parent.voxelSize;
this.voxelOrigin = parent.voxelOrigin;
this.voxelSizeUnit = parent.voxelSizeUnit;
this.calibrated = parent.calibrated;
this.imageType = parent.imageType;
this.displayRange = parent.displayRange;
this.colorMap = parent.colorMap;
this.bgColor = parent.bgColor;
this.calibrated = parent.calibrated;

case 'slice'
% setup initial slice
pos = varargin{2};
Expand Down

0 comments on commit f938de0

Please sign in to comment.