-
Notifications
You must be signed in to change notification settings - Fork 100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Codomain web #4839
Codomain web #4839
Changes from all commits
32ff94c
743dd85
ff794dc
7c3bc03
d3fe66a
a5ca492
d768054
6b5dd2e
6bb7066
50a077b
6cfb26b
bea20b8
614ebc1
e79b5a9
5b0479d
0a1c0ae
54689c0
996a4da
f616178
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,4 +52,8 @@ | |
} | ||
.lutpicker input { | ||
width: 10px; | ||
} | ||
#reverseIntensity { | ||
display: block; | ||
float: left; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -631,6 +631,16 @@ jQuery._WeblitzViewport = function (container, server, options) { | |
this.setChannelActive(idx, !_this.loadedImg.channels[idx].active); | ||
}; | ||
|
||
this.setChannelReverseIntensity = function (idx, reverse, noreload) { | ||
if (_this.loadedImg.channels[idx].reverseIntensity !== reverse) { | ||
_this.loadedImg.channels[idx].reverseIntensity = reverse; | ||
_this.self.trigger('channelChange', [_this, idx, _this.loadedImg.channels[idx]]); | ||
if (!noreload) { | ||
_load(); | ||
} | ||
} | ||
}; | ||
|
||
this.getCCount = function () { | ||
return _this.loadedImg.size.c; | ||
}; | ||
|
@@ -950,6 +960,7 @@ jQuery._WeblitzViewport = function (container, server, options) { | |
e1.channels[i].color == e2.channels[i].color && | ||
e1.channels[i].windowStart == e2.channels[i].windowStart && | ||
e1.channels[i].windowEnd == e2.channels[i].windowEnd && | ||
e1.channels[i].reverseIntensity == e2.channels[i].reverseIntensity && | ||
e1.channels[i].metalabel == e2.channels[i].metalabel)) { | ||
return false; | ||
} | ||
|
@@ -966,6 +977,7 @@ jQuery._WeblitzViewport = function (container, server, options) { | |
color: channels[i].color, | ||
windowStart: channels[i].window.start, | ||
windowEnd: channels[i].window.end, | ||
reverseIntensity: channels[i].reverseIntensity, | ||
metalabel: channels[i].metalabel}; | ||
entry.channels.push(channel); | ||
} | ||
|
@@ -991,6 +1003,7 @@ jQuery._WeblitzViewport = function (container, server, options) { | |
this.setChannelColor(i, entry.channels[i].color, true); | ||
this.setChannelActive(i, entry.channels[i].active, true); | ||
this.setChannelLabel(i, entry.channels[i].metalabel, true); | ||
this.setChannelReverseIntensity(i, entry.channels[i].reverseIntensity, true); | ||
} | ||
_load(); | ||
} | ||
|
@@ -1067,6 +1080,7 @@ jQuery._WeblitzViewport = function (container, server, options) { | |
var ch = channels[i].active ? '' : '-'; | ||
ch += parseInt(i, 10)+1; | ||
ch += '|' + channels[i].window.start + ':' + channels[i].window.end; | ||
ch += channels[i].reverseIntensity ? 'r' : '-r'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if you went with the proposal for ':' separation then it'd need to be
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if you went with the proposal for ':' separation then it'd need to be
|
||
ch += '$' + OME.rgbToHex(channels[i].color); | ||
chs.push(ch); | ||
} | ||
|
@@ -1136,6 +1150,12 @@ jQuery._WeblitzViewport = function (container, server, options) { | |
} | ||
if (t.length > 1) { | ||
t = t[1].split('$'); | ||
if (t[0].endsWith('-r')) { | ||
this.setChannelReverseIntensity(idx, false, true); | ||
} else if (t[0].endsWith('r')) { | ||
this.setChannelReverseIntensity(idx, true, true); | ||
} | ||
t[0] = t[0].replace('-r', '').replace('r', ''); // remove 'r' if present | ||
var range = t[0].split(':'); | ||
if (range.length == 2) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if you went with the proposal for ':' separation then it'd need to be
|
||
this.setChannelWindow(idx, parseFloat(range[0], 10), parseFloat(range[1], 10), true); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -207,19 +207,35 @@ def _split_channel_info(rchannels): | |
channels = [] | ||
windows = [] | ||
colors = [] | ||
reverses = [] | ||
for chan in rchannels.split(','): | ||
# chan 1|12:1386r$0000FF | ||
chan = chan.split('|', 1) | ||
# chan ['1', '12:1386r$0000FF'] | ||
t = chan[0].strip() | ||
# t = '1' | ||
color = None | ||
rev = None | ||
# Not normally used... | ||
if t.find('$') >= 0: | ||
t, color = t.split('$') | ||
try: | ||
channels.append(int(t)) | ||
ch_window = (None, None) | ||
if len(chan) > 1: | ||
t = chan[1].strip() | ||
# t = '12:1386r$0000FF' | ||
if t.find('$') >= 0: | ||
t, color = t.split('$', 1) | ||
# color = '0000FF' | ||
# t = 12:1386r | ||
# Optional flag to enable reverse codomain | ||
if t.endswith('-r'): | ||
rev = False | ||
t = t[:-2] | ||
elif t.endswith('r'): | ||
rev = True | ||
t = t[:-1] | ||
t = t.split(':') | ||
if len(t) == 2: | ||
try: | ||
|
@@ -228,10 +244,11 @@ def _split_channel_info(rchannels): | |
pass | ||
windows.append(ch_window) | ||
colors.append(color) | ||
reverses.append(rev) | ||
except ValueError: | ||
pass | ||
logger.debug(str(channels)+","+str(windows)+","+str(colors)) | ||
return channels, windows, colors | ||
return channels, windows, colors, reverses | ||
|
||
|
||
def getImgDetailsFromReq(request, as_string=False): | ||
|
@@ -755,8 +772,8 @@ def _get_prepared_image(request, iid, server_id=None, conn=None, | |
return | ||
if 'c' in r: | ||
logger.debug("c="+r['c']) | ||
channels, windows, colors = _split_channel_info(r['c']) | ||
if not img.setActiveChannels(channels, windows, colors): | ||
channels, windows, colors, reverses = _split_channel_info(r['c']) | ||
if not img.setActiveChannels(channels, windows, colors, reverses): | ||
logger.debug( | ||
"Something bad happened while setting the active channels...") | ||
if r.get('m', None) == 'g': | ||
|
@@ -1854,19 +1871,20 @@ def getRenderingSettings(image): | |
start = ch.getWindowStart() | ||
end = ch.getWindowEnd() | ||
color = ch.getLut() | ||
rev = 'r' if ch.isReverseIntensity() else '' | ||
if not color or len(color) == 0: | ||
color = ch.getColor().getHtml() | ||
chs.append("%s%s|%s:%s$%s" % (act, i+1, start, end, color)) | ||
chs.append("%s%s|%s:%s%s$%s" % (act, i+1, start, end, rev, color)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if you went with the proposal for ':' separation then it'd need to be
should the first 2 %s be %d? it probably doesn't matter if they are implicitly converted. |
||
rv['c'] = ",".join(chs) | ||
rv['m'] = "g" if image.isGreyscaleRenderingModel() else "c" | ||
rv['z'] = image.getDefaultZ() + 1 | ||
rv['t'] = image.getDefaultT() + 1 | ||
return rv | ||
|
||
def applyRenderingSettings(image, rdef): | ||
channels, windows, colors = _split_channel_info(rdef['c']) | ||
channels, windows, colors, reverse = _split_channel_info(rdef['c']) | ||
# also prepares _re | ||
image.setActiveChannels(channels, windows, colors) | ||
image.setActiveChannels(channels, windows, colors, reverse) | ||
if rdef['m'] == 'g': | ||
image.setGreyscaleRenderingModel() | ||
else: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you went with the proposal for ':' separation then it'd need to be
chs.append('%s%s|%d:%d:%s$%s'