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

Support uint16 color layers #4152

Merged
merged 6 commits into from
Jul 15, 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 @@ -11,6 +11,7 @@ For upgrade instructions, please check the [migration guide](MIGRATIONS.md).

### Added
- Volume tasks with only one finished instance can now be viewed as CompoundTask. [#4167](https://github.com/scalableminds/webknossos/pull/4167)
- Added support for int16 and uint16 color layers. [#4152](https://github.com/scalableminds/webknossos/pull/4152)

### Changed
- Volume project download zips are reorganized to contain a zipfile for each annotation (that in turn contains a data.zip and an nml file). [#4167](https://github.com/scalableminds/webknossos/pull/4167)
Expand Down
2 changes: 1 addition & 1 deletion docs/data_formats.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ webKnossos supports two data formats (WKW and KNOSSOS) for voxel datasets and NM
* [KNOSSOS cubes](https://knossostool.org/). Dataset of 128x128x128 cubes.

### Image formats
* Grayscale data (`uint8`), also referred to as `color` data
* Grayscale data (8 Bit, 16 Bit, Float), also referred to as `color` data
* RGB data (24 Bit)
* Segmentation data (8 Bit, 16 Bit, 32 Bit)
* Multi-channel data (multiple 8 Bit)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ import constants, {
} from "oxalis/constants";
import messages, { settings } from "messages";

import Histogram from "./histogram_view";
import Histogram, { isHistogramSupported } from "./histogram_view";

const { Panel } = Collapse;
const { Option } = Select;
Expand Down Expand Up @@ -135,7 +135,7 @@ class DatasetSettings extends React.PureComponent<DatasetSettingsProps, State> {
const { alpha, color, intensityRange, isDisabled } = layer;
let histogram = new Array(256).fill(0);
if (this.state.histograms && this.state.histograms[layerName]) {
histogram = this.state.histograms[layerName].histogram;
({ histogram } = this.state.histograms[layerName]);
Copy link
Member

Choose a reason for hiding this comment

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

Interesting, didn't know that syntax for already defined variables!

}

return (
Expand Down Expand Up @@ -171,7 +171,7 @@ class DatasetSettings extends React.PureComponent<DatasetSettingsProps, State> {
{this.getFindDataButton(layerName, isDisabled)}
</Col>
</Row>
{!isDisabled && elementClass !== "float" ? (
{!isDisabled && isHistogramSupported(elementClass) ? (
<Histogram
data={histogram}
min={intensityRange[0]}
Expand Down
8 changes: 8 additions & 0 deletions frontend/javascripts/oxalis/view/settings/histogram_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import type { Dispatch } from "redux";
import { connect } from "react-redux";
import { type DatasetLayerConfiguration } from "oxalis/store";
import { updateLayerSettingAction } from "oxalis/model/actions/settings_actions";
import { type ElementClass } from "admin/api_flow_types";

type OwnProps = {|
data: Array<number>,
Expand All @@ -27,6 +28,13 @@ type HistogramProps = {
const canvasHeight = 100;
const canvasWidth = 300;

export function isHistogramSupported(elementClass: ElementClass): boolean {
if (["int8", "uint8"].includes(elementClass)) {
daniel-wer marked this conversation as resolved.
Show resolved Hide resolved
return true;
}
return false;
}

class Histogram extends React.PureComponent<HistogramProps> {
canvasRef: ?HTMLCanvasElement;

Expand Down