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

Fix proofreading when mag 1 doesn't exist for segmentation layer #6795

Merged
merged 3 commits into from
Jan 31, 2023
Merged
Show file tree
Hide file tree
Changes from all 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.unreleased.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ For upgrade instructions, please check the [migration guide](MIGRATIONS.released
- Fixed a bug where the dataset folders view would not list public datasets if the requesting user could not also access the dataset for other reasons, like being admin. [#6759](https://github.com/scalableminds/webknossos/pull/6759)
- Fixed a bug where zarr-streamed datasets would produce (very rare) rendering errors. [#6782](https://github.com/scalableminds/webknossos/pull/6782)
- Fixed a bug where publicly shared annotations were not viewable by users without an account. [#6784](https://github.com/scalableminds/webknossos/pull/6784)
- Fixed proofreading when mag 1 doesn't exist for segmentation layer [#6795](https://github.com/scalableminds/webknossos/pull/6795)
- Fixed that the proofreading tool allowed to split/merge with segment 0 which led to an inconsistent state. [#6793](https://github.com/scalableminds/webknossos/pull/6793)

### Removed
Expand Down
9 changes: 6 additions & 3 deletions frontend/javascripts/oxalis/api/api_latest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ import {
} from "oxalis/model/accessors/volumetracing_accessor";
import { getHalfViewportExtentsFromState } from "oxalis/model/sagas/saga_selectors";
import {
getDatasetResolutionInfo,
getLayerBoundaries,
getLayerByName,
getResolutionInfo,
Expand Down Expand Up @@ -1549,10 +1548,12 @@ class DataApi {
topLeft: Vector3,
bottomRight: Vector3,
token: string,
resolution?: Vector3,
): string {
const { dataset } = Store.getState();
const resolutionInfo = getDatasetResolutionInfo(dataset);
const resolution = resolutionInfo.getLowestResolution();
const resolutionInfo = getResolutionInfo(getLayerByName(dataset, layerName, true).resolutions);
resolution = resolution || resolutionInfo.getLowestResolution();

const magString = resolution.join("-");
return (
`${dataset.dataStore.url}/data/datasets/${dataset.owningOrganization}/${dataset.name}/layers/${layerName}/data?mag=${magString}&` +
Expand Down Expand Up @@ -1591,13 +1592,15 @@ class DataApi {
layerName: string,
topLeft: Vector3,
bottomRight: Vector3,
resolution?: Vector3,
): Promise<ArrayBuffer> {
return doWithToken((token) => {
const downloadUrl = this._getDownloadUrlForRawDataCuboid(
layerName,
topLeft,
bottomRight,
token,
resolution,
);
return Request.receiveArraybuffer(downloadUrl);
});
Expand Down
12 changes: 10 additions & 2 deletions frontend/javascripts/oxalis/model/accessors/dataset_accessor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -368,11 +368,19 @@ function _getResolutionInfoOfVisibleSegmentationLayer(state: OxalisState): Resol
export const getResolutionInfoOfVisibleSegmentationLayer = memoizeOne(
_getResolutionInfoOfVisibleSegmentationLayer,
);
export function getLayerByName(dataset: APIDataset, layerName: string): DataLayerType {
export function getLayerByName(
dataset: APIDataset,
layerName: string,
alsoMatchFallbackLayer: boolean = false,
): DataLayerType {
const dataLayers = getDataLayers(dataset);
const hasUniqueNames = _.uniqBy(dataLayers, "name").length === dataLayers.length;
ErrorHandling.assert(hasUniqueNames, messages["dataset.unique_layer_names"]);
const layer = dataLayers.find((l) => l.name === layerName);
const layer = dataLayers.find(
(l) =>
l.name === layerName ||
(alsoMatchFallbackLayer && "fallbackLayer" in l && l.fallbackLayer === layerName),
);

if (!layer) {
throw new Error(`Layer "${layerName}" not found`);
Expand Down
1 change: 1 addition & 0 deletions frontend/javascripts/oxalis/model/sagas/proofread_saga.ts
Original file line number Diff line number Diff line change
Expand Up @@ -699,6 +699,7 @@ function* createGetUnmappedDataValueFn(
fallbackLayerName,
nodePosition,
V3.add(nodePosition, mag),
mag,
);

return Number(new TypedArrayClass(buffer)[0]);
Expand Down