Skip to content

Commit

Permalink
feat: adds hidden attribute to ScaleInfo for placeholder resolutions (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
dxenes1 committed Mar 29, 2023
1 parent 8e9c17e commit 555679c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/neuroglancer/datasource/precomputed/frontend.ts
Expand Up @@ -37,7 +37,7 @@ import {Borrowed} from 'neuroglancer/util/disposable';
import {mat4, vec3} from 'neuroglancer/util/geom';
import {completeHttpPath} from 'neuroglancer/util/http_path_completion';
import {isNotFoundError, responseJson} from 'neuroglancer/util/http_request';
import {parseArray, parseFixedLengthArray, parseQueryStringParameters, unparseQueryStringParameters, verifyEnumString, verifyFiniteFloat, verifyFinitePositiveFloat, verifyInt, verifyObject, verifyObjectProperty, verifyOptionalObjectProperty, verifyOptionalString, verifyPositiveInt, verifyString, verifyStringArray} from 'neuroglancer/util/json';
import {parseArray, parseFixedLengthArray, parseQueryStringParameters, unparseQueryStringParameters, verifyEnumString, verifyFiniteFloat, verifyFinitePositiveFloat, verifyInt, verifyObject, verifyObjectProperty, verifyOptionalObjectProperty, verifyOptionalString, verifyPositiveInt, verifyString, verifyStringArray, verifyOptionalBoolean} from 'neuroglancer/util/json';
import * as matrix from 'neuroglancer/util/matrix';
import {getObjectId} from 'neuroglancer/util/object_id';
import {cancellableFetchSpecialOk, parseSpecialUrl, SpecialProtocolCredentials, SpecialProtocolCredentialsProvider} from 'neuroglancer/util/special_protocol_request';
Expand Down Expand Up @@ -85,6 +85,7 @@ class ScaleInfo {
chunkSizes: Uint32Array[];
compressedSegmentationBlockSize: vec3|undefined;
sharding: ShardingParameters|undefined;
hidden: boolean;
constructor(obj: any, numChannels: number) {
verifyObject(obj);
const rank = (numChannels === 1) ? 3 : 4;
Expand Down Expand Up @@ -124,6 +125,7 @@ class ScaleInfo {
x => parseFixedLengthArray(vec3.create(), x, verifyPositiveInt));
}
this.key = verifyObjectProperty(obj, 'key', verifyString);
this.hidden = verifyObjectProperty(obj, 'hidden', verifyOptionalBoolean) ?? false;
}
}

Expand Down Expand Up @@ -208,7 +210,7 @@ export class PrecomputedMultiscaleVolumeChunkSource extends MultiscaleVolumeChun
getSources(volumeSourceOptions: VolumeSourceOptions) {
const modelResolution = this.info.scales[0].resolution;
const {rank} = this;
return transposeNestedArrays(this.info.scales.map(scaleInfo => {
return transposeNestedArrays(this.info.scales.filter(x => !x.hidden).map(scaleInfo => {
const {resolution} = scaleInfo;
const stride = rank + 1;
const chunkToMultiscaleTransform = new Float32Array(stride * stride);
Expand Down
1 change: 1 addition & 0 deletions src/neuroglancer/datasource/precomputed/volume.md
Expand Up @@ -56,6 +56,7 @@ The root value must be a JSON object with the following members:
format](#sharded-chunk-storage). Must be a [sharding specification](./sharded.md#sharding-specification).
If the sharded format is used, the `"chunk_sizes"` member must specify only a single chunk size.
If unspecified, the [unsharded format](#unsharded-chunk-storage) is used.
- `"hidden"`: Optional. If specified, must be a boolean value that indicates if the scale should be not rendered in the viewer. Defaults to `False`.
- `"mesh"`: May be optionally specified if `"volume_type"` is `"segmentation"`. If specified, it
must be a string value specifying the name of the subdirectory containing the [mesh
data](./meshes.md).
Expand Down

0 comments on commit 555679c

Please sign in to comment.