diff --git a/CHANGELOG.unreleased.md b/CHANGELOG.unreleased.md index 2cc4fb8a7a6..21802ddd1b4 100644 --- a/CHANGELOG.unreleased.md +++ b/CHANGELOG.unreleased.md @@ -25,6 +25,7 @@ For upgrade instructions, please check the [migration guide](MIGRATIONS.released ### Fixed - Fix that active segment and node id were not shown in status bar when being in a non-hybrid annotation. [#5638](https://github.com/scalableminds/webknossos/pull/5638) +- Fixed that setting an intensity range of a color layer to 0 via the histogram slider led to no data being rendered at all. [#5676](https://github.com/scalableminds/webknossos/pull/5676) - Fix that "Compute Mesh File" button was enabled in scenarios where it should not be supported (e.g., when no segmentation layer exists). [#5648](https://github.com/scalableminds/webknossos/pull/5648) - Fixed a bug where an authentication error was shown when viewing the meshes tab while not logged in. [#5647](https://github.com/scalableminds/webknossos/pull/5647) - Fix that segment id 0 was always shown even when fallback data of the segmentation layer was visible and hovered with the mouse. [#5674](https://github.com/scalableminds/webknossos/pull/5674) diff --git a/frontend/javascripts/oxalis/shaders/main_data_fragment.glsl.js b/frontend/javascripts/oxalis/shaders/main_data_fragment.glsl.js index c7ae1f18a7b..15e9ea4cd73 100644 --- a/frontend/javascripts/oxalis/shaders/main_data_fragment.glsl.js +++ b/frontend/javascripts/oxalis/shaders/main_data_fragment.glsl.js @@ -183,11 +183,15 @@ void main() { <% } %> // Keep the color in bounds of min and max color_value = clamp(color_value, <%= name %>_min, <%= name %>_max); - // Scale the color value according to the histogram settings - color_value = (color_value - <%= name %>_min) / (<%= name %>_max - <%= name %>_min); + // Scale the color value according to the histogram settings. + // Note: max == min would cause a division by 0. Thus we add 1 in this case and filter out the whole value below. + float is_max_and_min_equal = float(<%= name %>_max == <%= name %>_min); + color_value = (color_value - <%= name %>_min) / (<%= name %>_max - <%= name %>_min + is_max_and_min_equal); // Maybe invert the color using the inverting_factor color_value = abs(color_value - <%= name %>_is_inverted); + // Catch the case where max == min would causes a NaN value and use black as a fallback color. + color_value = mix(color_value, vec3(0.0), is_max_and_min_equal); // Multiply with color and alpha for <%= name %> data_color += color_value * <%= name %>_alpha * <%= name %>_color; } diff --git a/frontend/javascripts/oxalis/view/left-border-tabs/layer_settings_tab.js b/frontend/javascripts/oxalis/view/left-border-tabs/layer_settings_tab.js index 3986a257a67..7a83c32ba8e 100644 --- a/frontend/javascripts/oxalis/view/left-border-tabs/layer_settings_tab.js +++ b/frontend/javascripts/oxalis/view/left-border-tabs/layer_settings_tab.js @@ -10,6 +10,7 @@ import { ReloadOutlined, ScanOutlined, StopOutlined, + WarningOutlined, } from "@ant-design/icons"; import type { Dispatch } from "redux"; import { connect } from "react-redux"; @@ -374,8 +375,10 @@ class DatasetSettings extends React.PureComponent { isInEditMode: boolean, layerName: string, elementClass: string, + layerSettings: DatasetLayerConfiguration, ) => { const { tracing } = this.props; + const { intensityRange } = layerSettings; const isVolumeTracing = tracing.volume != null; const isFallbackLayer = tracing.volume ? tracing.volume.fallbackLayer != null && !isColorLayer @@ -428,6 +431,14 @@ class DatasetSettings extends React.PureComponent { + {intensityRange[0] === intensityRange[1] && !isDisabled ? ( + + + + ) : null} {isColorLayer ? null : this.getOptionalDownsampleVolumeIcon()} {hasHistogram ? this.getEditMinMaxButton(layerName, isInEditMode) : null} @@ -534,6 +545,7 @@ class DatasetSettings extends React.PureComponent { isInEditMode, layerName, elementClass, + layerConfiguration, )} {isDisabled ? null : (