forked from mporter-gre/mtools
/
getChannelMinMax.m
21 lines (18 loc) · 945 Bytes
/
getChannelMinMax.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
function [channelMinScaled channelGlobalMax channelGlobalMaxScaled] = getChannelMinMax(pixels, channel)
%Return the channel min and channel global max render settings from Omero.
%Do [channelMin channelMax] = getChannelMinMax(pixels, channel); where
%channel indexes from 0
global session;
pixelsId = pixels.getId.getValue;
renderingService = session.getRenderingSettingsService;
renderingSettings = renderingService.getRenderingSettings(pixelsId);
pixelsDescription = session.getPixelsService.retrievePixDescription(pixelsId);
channelBinding = renderingSettings.getChannelBinding(channel);
startVal = channelBinding.getInputStart.getValue;
endVal = channelBinding.getInputEnd.getValue;
channelGlobalMax = pixelsDescription.getChannel(channel).getStatsInfo.getGlobalMax.getValue;
channelGlobalMaxScaled = endVal/channelGlobalMax;
if channelGlobalMaxScaled > 1
channelGlobalMaxScaled = 1;
end
channelMinScaled = startVal/channelGlobalMax;