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 rendering missing data black and wrong segment id being displayed #5674

Merged
merged 8 commits into from
Aug 23, 2021
Original file line number Diff line number Diff line change
Expand Up @@ -515,12 +515,13 @@ class DataCube {
// needs to be examined for rendering.

const bucket = this.getBucket(this.positionToZoomedAddress(voxel, zoomStep));
const { renderMissingDataBlack } = Store.getState().datasetConfiguration;

if (!(bucket instanceof DataBucket)) {
// This is a NullBucket (e.g., because it's out of the bounding box or in a not-existing
// magnification). This zoomstep is as good as all the other zoomsteps (as these will only
// hold null buckets, too).
return true;
return renderMissingDataBlack;
}

if (bucket.hasData() || bucket.isLoaded()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ import type { ElementClass } from "types/api_flow_types";
export const channelCountForLookupBuffer = 2;

function getSomeValue<T>(set: Set<T>): T {
const value = set.values().next().value;
const { value } = set.values().next();

if (value == null) {
throw new Error("Cannot get value of set because it's empty.");
Expand Down Expand Up @@ -345,8 +345,8 @@ export default class TextureBucketManager {
address = reservedAddress;
}

const isBaseBucket = bucketZoomStep === currentZoomStep;
const isFirstFallback = bucketZoomStep - 1 === currentZoomStep;
const zoomStepDifference = bucketZoomStep - currentZoomStep;
const isBaseBucket = zoomStepDifference === 0;
if (isBaseBucket) {
if (address === -1) {
let fallbackBucket = bucket.getFallbackBucket();
Expand Down Expand Up @@ -379,27 +379,22 @@ export default class TextureBucketManager {
this.lookUpBuffer[posInBuffer] = address;
this.lookUpBuffer[posInBuffer + 1] = bucketZoomStep;
}
} else if (isFirstFallback) {
if (address !== -1) {
const baseBucketAddresses = this._getBaseBucketAddresses(bucket, 1);
for (const baseBucketAddress of baseBucketAddresses) {
const lookUpIdx = this._getBucketIndex(baseBucketAddress);
const posInBuffer = channelCountForLookupBuffer * lookUpIdx;
if (this.lookUpBuffer[posInBuffer] !== -2 || lookUpIdx === -1) {
// Either, another bucket was already placed here. Or, the lookUpIdx is
// invalid. Skip the entire loop
break;
}
this.lookUpBuffer[posInBuffer] = address;
this.lookUpBuffer[posInBuffer + 1] = bucketZoomStep;
} else if (address !== -1) {
const baseBucketAddresses = this._getBaseBucketAddresses(bucket, zoomStepDifference);
for (const baseBucketAddress of baseBucketAddresses) {
const lookUpIdx = this._getBucketIndex(baseBucketAddress);
const posInBuffer = channelCountForLookupBuffer * lookUpIdx;
if (this.lookUpBuffer[posInBuffer] !== -2 || lookUpIdx === -1) {
// Either, another bucket was already placed here. Or, the lookUpIdx is
// invalid. Skip the entire loop
break;
}
} else {
// Don't overwrite the default -2 within the look up buffer for fallback buckets,
// since the effort is not worth it (only has an impact on the fallback color within the shader)
this.lookUpBuffer[posInBuffer] = address;
this.lookUpBuffer[posInBuffer + 1] = bucketZoomStep;
}
} else {
// Don't handle buckets with zoomStepDiff > 1, because filling the corresponding
// positions in the lookup buffer would take 8**zoomStepDiff iterations PER bucket.
// Don't overwrite the default -2 within the look up buffer for fallback buckets,
// since the effort is not worth it (only has an impact on the fallback color within the shader)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,11 +175,6 @@ export function getBaseBucketsForFallbackBucket(
resolutions,
betterZoomStep,
);
if (zoomStepDifference > 1) {
// Due to the exponential complexity of calculating the "better bucket addresses",
// we currently only support this function if zoomStepDifference === 1
return [betterBucketAddress];
}

// resolutionFactors is a [x, y, z] tuple with x, y, z being 1 or 2 each (because
// zoomStepDifference === 1). In the case of isotropic resolutions, it's simply [2, 2, 2]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -608,24 +608,6 @@ class DatasetSettings extends React.PureComponent<DatasetSettingsProps, State> {
Toast.success(`Successfully reloaded data of layer ${layerName}.`);
};

onChangeRenderMissingDataBlack = async (value: boolean): Promise<void> => {
Toast.info(
value
? messages["data.enabled_render_missing_data_black"]
: messages["data.disabled_render_missing_data_black"],
{ timeout: 8000 },
);
this.props.onChange("renderMissingDataBlack", value);
const { layers } = this.props.datasetConfiguration;
const reloadAllLayersPromises = Object.keys(layers).map(async layerName => {
await clearCache(this.props.dataset, layerName);
await api.data.reloadBuckets(layerName);
});
await Promise.all(reloadAllLayersPromises);
window.needsRerender = true;
Toast.success("Successfully reloaded data of all layers.");
};

Comment on lines -611 to -628
Copy link
Contributor Author

@MichaelBuessemeyer MichaelBuessemeyer Aug 13, 2021

Choose a reason for hiding this comment

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

This method was used nowhere. It was forgotten to be removed while reorganizing code in the #5384 pr

getVolumeMagsToDownsample = (): Array<Vector3> => {
if (this.props.task != null) {
return [];
Expand Down