Skip to content
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

Add toggle color layer visibility button #3943

Merged
merged 12 commits into from
Mar 29, 2019
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ For upgrade instructions, please check the [migration guide](MIGRATIONS.md).
- The HTML template now includes SEO tags for demo instances and hides internal instances from search engines.
- A maximize-button was added to the viewports in the annotation view. Maximization can also be toggled with the `.` shortcut. [#3876](https://github.com/scalableminds/webknossos/pull/3876)
- [webknossos-connect](https://github.com/scalableminds/webknossos-connect) now starts with webKnossos on local and development instances by default. [#3913](https://github.com/scalableminds/webknossos/pull/3913)
- Added a button for each color layer that toggles its visibility. [#3943](https://github.com/scalableminds/webknossos/pull/3943)

### Changed
- Improved the flight mode performance for tracings with very large trees (>80.000 nodes). [#3880](https://github.com/scalableminds/webknossos/pull/3880)
Expand Down
2 changes: 2 additions & 0 deletions docs/tracing_ui.md
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,9 @@ For multi-layer datasets, each layer can be adjusted separately.
#### Colors
- `Brightness`: Increase / Decrease the brightness of the data layer.
- `Contrast`: Increase / Decrease the contrast of the data layer.
- `Opacity`: Increase / Decrease the opacityof the data layer.
MichaelBuessemeyer marked this conversation as resolved.
Show resolved Hide resolved
- `Color`: Every data layer can be colored to make them easily identifiable. By default, all layers have a white overlay, showing the true, raw black & white data.
- `Visibility`: Use the eye icon on the right side of the name of the data layer to toggle its visibility.

#### Segmentation
- `Segmentation Opacity`: Increases / Decreases the opacity of the segmentation layer. A low value will make the segmentation almost transparent letting you see the underlying data layers more clearly. A high value will make the segmentation opaque which is useful for adjusting and reviewing the exact fit of the segmentation layer. Only possible if your dataset has a segmentation layer.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ class DatasetImportView extends React.PureComponent<Props, State> {
brightness: 0,
contrast: 1,
color: [255, 255, 255],
isVisible: true,
};
const datasetDefaultConfiguration = (await getDatasetDefaultConfiguration(
this.props.datasetId,
Expand Down
21 changes: 18 additions & 3 deletions frontend/javascripts/libs/datasource.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,21 @@
"properties": {
"name": { "type": "string" },
"category": { "enum": ["color", "segmentation"] },
"elementClass": { "enum": ["uint8", "uint16", "uint24", "uint32", "uint64", "float,", "double", "int8", "int16", "int32", "int64"] }
"elementClass": {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my ide beautifies code again 🤔
As this is accepted by prettier I suggest to keep it this way.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, in the long run, this can be quite cumbersome. This is especially prone to merge conflicts. Can you please disable any IDE auto-formatting which differs from prettiers behavior?

"enum": [
"uint8",
"uint16",
"uint24",
"uint32",
"uint64",
"float,",
"double",
"int8",
"int16",
"int32",
"int64"
]
}
},
"required": ["name", "category", "elementClass"]
},
Expand Down Expand Up @@ -128,9 +142,10 @@
"properties": {
"brightness": { "type": "number" },
"contrast": { "type": "number" },
"color": { "$ref": "#/definitions/types::Vector3" }
"color": { "$ref": "#/definitions/types::Vector3" },
"isVisible": { "type": "boolean" }
},
"required": ["brightness", "contrast", "color"]
"required": ["brightness", "contrast", "color", "isVisible"]
}
}
}
Expand Down
1 change: 1 addition & 0 deletions frontend/javascripts/libs/datasource.types.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,6 @@ export type LayerUserConfiguration = {
brightness: number,
contrast: number,
color: Vector3,
isVisible: boolean,
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ class PlaneMaterialFactory {
updateUniformsForLayer(settings: DatasetLayerConfiguration, name: string): void {
this.uniforms[`${name}_brightness`].value = settings.brightness / 255;
this.uniforms[`${name}_contrast`].value = settings.contrast;
this.uniforms[`${name}_alpha`].value = settings.alpha / 100;
this.uniforms[`${name}_alpha`].value = settings.isVisible ? settings.alpha / 100 : 0;

if (settings.color != null) {
const color = this.convertColor(settings.color);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ function SettingsReducer(state: OxalisState, action: Action): OxalisState {
contrast: 1,
color: [255, 255, 255],
alpha: 100,
isVisible: true,
},
initialLayerSettings[layer.name],
);
Expand Down
1 change: 1 addition & 0 deletions frontend/javascripts/oxalis/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ export type DatasetLayerConfiguration = {|
+brightness: number,
+contrast: number,
+alpha: number,
+isVisible: boolean,
|};

export type LoadingStrategy = "BEST_QUALITY_FIRST" | "PROGRESSIVE_QUALITY";
Expand Down
23 changes: 20 additions & 3 deletions frontend/javascripts/oxalis/view/settings/dataset_settings_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ import constants, {
} from "oxalis/constants";
import messages, { settings } from "messages";

const Panel = Collapse.Panel;
const Option = Select.Option;
const { Panel } = Collapse;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also done by my ide

const { Option } = Select;

type DatasetSettingsProps = {|
datasetConfiguration: DatasetConfiguration,
Expand All @@ -65,7 +65,7 @@ class DatasetSettings extends React.PureComponent<DatasetSettingsProps> {
isLastLayer: boolean,
) => {
const isRGB = isRgb(this.props.dataset, layerName);
const { brightness, contrast, alpha, color } = layer;
const { brightness, contrast, alpha, color, isVisible } = layer;
return (
<div key={layerName}>
<Row>
Expand All @@ -74,6 +74,23 @@ class DatasetSettings extends React.PureComponent<DatasetSettingsProps> {
<Tag style={{ cursor: "default", marginLeft: 8 }} color={isRGB && "#1890ff"}>
{isRGB ? "24-bit" : "8-bit"} Layer
</Tag>
{alpha > 0 && isVisible ? (
MichaelBuessemeyer marked this conversation as resolved.
Show resolved Hide resolved
<Tooltip title="Make this color layer invisible.">
<Icon
type="eye"
onClick={() => this.props.onChangeLayer(layerName, "isVisible", false)}
style={{ marginTop: 4, marginLeft: 8, cursor: "pointer" }}
/>
</Tooltip>
) : (
<Tooltip title="Make this color layer visible.">
MichaelBuessemeyer marked this conversation as resolved.
Show resolved Hide resolved
<Icon
type="eye-o"
MichaelBuessemeyer marked this conversation as resolved.
Show resolved Hide resolved
onClick={() => this.props.onChangeLayer(layerName, "isVisible", true)}
style={{ marginTop: 4, marginLeft: 8, cursor: "pointer" }}
/>
</Tooltip>
)}
<Tooltip title="If you are having trouble finding your data, webKnossos can try to find a position which contains data.">
<Icon
type="scan"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,9 @@ const datasetConfigOverrides: { [key: string]: DatasetConfiguration } = {
ROI2017_wkw_fallback: {
fourBit: false,
interpolation: true,
layers: { color: { color: [255, 255, 255], contrast: 1, brightness: 0, alpha: 100 } },
layers: {
color: { color: [255, 255, 255], contrast: 1, brightness: 0, alpha: 100, isVisible: true },
},
quality: 0,
segmentationOpacity: 0,
highlightHoveredCellId: true,
Expand Down