Skip to content

Commit

Permalink
imStacks: add option for logarithm histogram
Browse files Browse the repository at this point in the history
  • Loading branch information
dlegland committed Jul 30, 2015
1 parent fbe71f1 commit e86b894
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion matImage/imStacks/SlicerHistogramDialog.m
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@

useBackground = true;

logHistogram = false;

displayType = 'bars';
displayTypeList = {'bars', 'stems', 'stairs'};

Expand Down Expand Up @@ -255,6 +257,13 @@ function setupDialogLayout(hf)
'Value', this.useBackground, ...
'Callback',@this.onCountBackgroundChanged);

% Add a check box for log representation of histogram
this.handles.logHistogramCheckBox = uicontrol('Style', 'CheckBox', ...
'Parent', mainPanel, ...
'String', 'Log Histogram', ...
'Value', this.logHistogram, ...
'Callback',@this.onLogHistogramChanged);


% Add an "auto update" check box
this.handles.autoUpdateCheckBox = uicontrol('Style', 'CheckBox', ...
Expand Down Expand Up @@ -437,6 +446,13 @@ function onCountBackgroundChanged(this, hObject, eventdata) %#ok<INUSD>
end
end

function onLogHistogramChanged(this, hObject, eventdata) %#ok<INUSD>
this.logHistogram = get(hObject, 'Value');
if this.autoUpdate
updateHistogram(this);
end
end

function onAutoUpdateChanged(this, hObject, eventdata) %#ok<INUSD>
this.autoUpdate = get(hObject, 'Value');

Expand Down Expand Up @@ -620,7 +636,11 @@ function displayColorHistogram(this)
end
end


% eventually converts to log histogram
if this.logHistogram
h = log(h + 1);
end

function h = calcHistogram(img, x, roi)
if isempty(roi)
% histogram of whole image
Expand Down

0 comments on commit e86b894

Please sign in to comment.