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

In Proofreading, Load Oversegmentation, Perform Merges Eagerly in Frontend #7654

Merged
merged 200 commits into from
Jul 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
200 commits
Select commit Hold shift + click to select a range
0640ef0
add datastore route to list all agglomerate ids
fm3 Feb 27, 2024
317fa85
remove unused file access
fm3 Feb 27, 2024
0f2f292
types
fm3 Feb 27, 2024
ee2981a
Apply hdf5 mappings in frontend [WIP]
daniel-wer Feb 27, 2024
4ff2632
Merge branch 'magic-mapping' of github.com:scalableminds/webknossos i…
daniel-wer Feb 27, 2024
953060a
Fix segment and agglomerate id mixup in proofreading saga
daniel-wer Feb 27, 2024
b8e480f
add route to tracingstore
fm3 Feb 27, 2024
47239d5
Merge branch 'magic-mapping' of github.com:scalableminds/webknossos i…
fm3 Feb 27, 2024
1dcc1d0
edit mapping after merge and set it in redux store
dieknolle3333 Feb 27, 2024
9da9533
Fix mapping initialization
daniel-wer Feb 27, 2024
92a0b12
Merge branch 'magic-mapping' of github.com:scalableminds/webknossos i…
daniel-wer Feb 28, 2024
70385e4
WIP: implement split in frontend
dieknolle3333 Feb 28, 2024
5ac63d3
Only load subset of mapping for segments visible 5s after page load
daniel-wer Feb 28, 2024
9d8aa09
Merge branch 'magic-mapping' of github.com:scalableminds/webknossos i…
daniel-wer Feb 28, 2024
f27c7c4
small fix
daniel-wer Feb 28, 2024
8acb514
Merge branch 'magic-mapping' of github.com:scalableminds/webknossos i…
daniel-wer Feb 28, 2024
9aec306
Merge branch 'master' of github.com:scalableminds/webknossos into mag…
daniel-wer Mar 13, 2024
8172707
cleanup, time measurements, throttle mapping requests to 500ms -> cur…
daniel-wer Mar 19, 2024
3828a2e
Merge branch 'master' of github.com:scalableminds/webknossos into mag…
daniel-wer Mar 27, 2024
0f11a72
Update redux-saga to use throttle with effectChannels
daniel-wer Apr 8, 2024
6afe7b0
Only refresh mapping if bucket data changed. Fix partial mapping upda…
daniel-wer Apr 8, 2024
321dc6a
Merge branch 'master' of github.com:scalableminds/webknossos into mag…
daniel-wer Apr 8, 2024
3d7afbf
Fix how proofreading actions update the mapping in the frontend
daniel-wer Apr 8, 2024
07e9c7a
disable most ci checks
philippotto Apr 19, 2024
3a76347
Merge branch 'master' into magic-mapping
philippotto May 2, 2024
b80e0f8
Merge branch 'master' of github.com:scalableminds/webknossos into mag…
philippotto May 2, 2024
f74f3ad
misc improvements
philippotto May 2, 2024
01e6e32
refine shouldUseDataStore logic
philippotto May 2, 2024
ed69061
fix type error
philippotto May 3, 2024
cc1922a
fix some type errors
philippotto May 3, 2024
3ad4d3c
fix more type errors
philippotto May 3, 2024
d49c755
use NumberLike type for number and bigint at various places
philippotto May 3, 2024
94897d2
more NumberLike usages
philippotto May 6, 2024
30c954b
fix lots of typescript errors (related to bigint and to redux)
philippotto May 6, 2024
d8d6f77
fix more type errors
philippotto May 6, 2024
81d7889
fix the last type errors
philippotto May 6, 2024
38a6528
restore proper NumberLike definition and fix remaining type errors
philippotto May 6, 2024
b36a4fc
remove unused imports
philippotto May 6, 2024
9167071
fix race condition which could cause mapping to not be properly initi…
philippotto May 7, 2024
d5c432e
only pass isCentered instead of centeredSegmentId to SegmentListItems
philippotto May 7, 2024
3a40eae
fix react warning when closing context menu for the first time
philippotto May 7, 2024
6c87ee9
add debug code for rare scenario where segment id is not an integer
philippotto May 7, 2024
af907aa
fix TS error
philippotto May 8, 2024
3390e3e
fix that hovered unmapped segment id would not update sometimes
philippotto May 8, 2024
f12f254
avoid two map look ups
philippotto May 10, 2024
76213d5
Merge branch 'master' of github.com:scalableminds/webknossos into mag…
philippotto May 10, 2024
d4b48be
add dryUpdate step before saving proofreading update actions
fm3 May 13, 2024
1f47c29
Merge branch 'magic-mapping' of github.com:scalableminds/webknossos i…
philippotto May 13, 2024
a3e3096
undo provoking the error
fm3 May 13, 2024
fb98f08
make selective segment visibility in proofreading an option
philippotto May 15, 2024
a395285
fix NaN value after mapping unknown segment key
philippotto May 15, 2024
01e6357
avoid parallel executions of updateHdf5Mapping and also cancel update…
philippotto May 15, 2024
75c9433
always compare known segment ids to newest mapping instead of 'previo…
philippotto May 15, 2024
2b9f274
don't crash completely when segment mapping is not known yet and user…
philippotto May 15, 2024
b8b204c
remove artificial delays
philippotto May 15, 2024
16701cb
improve logging
philippotto May 15, 2024
c6134e6
fix ts error
philippotto May 15, 2024
2b5e7cb
remove debugging code for NaN mapped id
philippotto May 15, 2024
e1141cb
tweak hovering
philippotto May 15, 2024
f5c26ef
rename MIN_CUT_AGGLOMERATE actions
philippotto May 15, 2024
364c0d5
adapt cutFromNeighbors to magic mapping approach
philippotto May 15, 2024
9d5656d
avoid roundtrip for mesh reloading by using newest mapping
philippotto May 15, 2024
d058492
tweak hovering (II)
philippotto May 16, 2024
4a0308d
extract code into gatherInfoForOperation
philippotto May 16, 2024
5b0699d
fix context menu for skeletons in 3d viewport
philippotto May 16, 2024
84a98e6
make agglomerate-skeleton-proofreading compatible with magic mappings
philippotto May 16, 2024
ba11833
don't run rendering code for context menu when its not open
philippotto May 16, 2024
5a418e4
remove unused previousMappingObject
philippotto May 16, 2024
c36493d
dynamically switch between local and remotely applied mappings when s…
philippotto May 21, 2024
a806a7f
auto-reload page if dev-proxy fails
philippotto May 23, 2024
b64311c
fix missing reload when disabling/re-enabling mapping (now too many r…
philippotto May 27, 2024
c8a7900
extract finishMappingInitialization action
philippotto May 28, 2024
52e3611
extract ensureMappingsAreLoadedAndRequestedMappingExists
philippotto May 28, 2024
aef93e2
rename mappingIsEditable to hasEditableMapping
philippotto May 28, 2024
39e82d6
introduce BucketRetrievalSource to better cancel/restart bucket watch…
philippotto May 29, 2024
8c59833
introduce clearMappingAction
philippotto May 29, 2024
863cbd5
make sure that getBucketRetrievalSource doesn't create new instances …
philippotto May 29, 2024
102fd47
move cuckoo modules into libs/cuckoo
philippotto May 29, 2024
57a0e27
use cuckoo hashing for gpu-based mapping instead of binary search (pr…
philippotto May 30, 2024
c736e74
add missing module
philippotto May 30, 2024
83a177d
remove logging
fm3 Jun 13, 2024
cd3786e
make use of protobuf shortcut getHasEditableMapping
fm3 Jun 13, 2024
baa16a5
Merge branch 'master' of github.com:scalableminds/webknossos into mag…
philippotto Jun 17, 2024
c5f848c
Update frontend/javascripts/oxalis/model/sagas/mapping_saga.ts
philippotto Jun 17, 2024
87fda40
Update frontend/javascripts/oxalis/model/sagas/proofread_saga.ts
philippotto Jun 17, 2024
4ff3da2
Merge branch 'master' of github.com:scalableminds/webknossos into mag…
philippotto Jun 18, 2024
6282713
mappingIsEditable -> hasEditableMapping to fix compilation error
philippotto Jun 18, 2024
777d725
remove unnecessary braces
philippotto Jun 18, 2024
ec46453
incorporate some pr feedback
philippotto Jun 18, 2024
e18b02f
more pr feedback
philippotto Jun 18, 2024
e42f253
add comment to cuckoo table 64 bit
philippotto Jun 18, 2024
36694cf
also implement cuckoo table for uint32 keys and values
philippotto Jun 18, 2024
8ddd28f
fix invalid initialization of mapping texture when mapping is disabled
philippotto Jun 18, 2024
ba6e9bd
fix that mapping was applied twice
philippotto Jun 18, 2024
6516bfd
fix uint32 cuckoo implementation (still hardcoded to always use 32 bit)
philippotto Jun 18, 2024
68c4819
Merge branch 'magic-mapping' of github.com:scalableminds/webknossos i…
philippotto Jun 18, 2024
4d835cc
use 64 bit look up when necessary in shader
philippotto Jun 19, 2024
6726d88
remove unused mappingSize
philippotto Jun 19, 2024
4b9d842
avoid toolbar rerendering
philippotto Jun 20, 2024
c98e41f
only write necessary changes to cuckoo table instead of rewriting it …
philippotto Jun 20, 2024
4f9434b
ensure diffing of previous and new mapping is fast be providing cache…
philippotto Jun 20, 2024
ce83411
eagerly compute value set when reasonable to avoid clustering of that…
philippotto Jun 20, 2024
ae5c956
add missing worker
philippotto Jun 20, 2024
c7bb508
implement maintenance of value set for entire data cube to avoid reco…
philippotto Jun 20, 2024
9554d28
Revert maintenance of value set because it didn't help with performance
philippotto Jun 20, 2024
f6c4d2e
remove todo because it was tried in c7bb508be7 and reverted afterwards
philippotto Jun 20, 2024
2b0a310
remove some time logging
philippotto Jun 20, 2024
b2f9b10
optimize/combine some set operations (2x as fast now)
philippotto Jun 20, 2024
8b34ec5
move and rename diffSets function
philippotto Jun 20, 2024
4dcbf61
further optimization of set operations (in total 4x faster compared t…
philippotto Jun 21, 2024
14bf4be
remove unused code
philippotto Jun 21, 2024
e80d1ee
remove superfluous parameter
philippotto Jun 21, 2024
6e3a54e
add renaming todo
philippotto Jun 21, 2024
ccd59b7
delete create_set_from_array webworker as it didn't show an improved …
philippotto Jun 21, 2024
5cc4296
delete debugging code from cuckoo modules
philippotto Jun 21, 2024
a60a2db
move attemptMappingLookUp glsl code
philippotto Jun 21, 2024
8671f5e
add some comments
philippotto Jun 21, 2024
38660f8
reactivate CI checks
philippotto Jun 21, 2024
217caa0
remove unused code
philippotto Jun 21, 2024
949b37b
remove obsolete imports
philippotto Jun 21, 2024
e7b7ecb
simplify editableMapping check
philippotto Jun 21, 2024
e057cb3
fix ts problems
philippotto Jun 21, 2024
aa23f3f
fix cyclic dependencies
philippotto Jun 21, 2024
a1743a6
fix 64 bit mapping rendering
philippotto Jun 21, 2024
8c2be7f
remove UI warnings that the merger mode doesn't support 64 bit, becau…
philippotto Jun 21, 2024
a327622
fix linting
philippotto Jun 21, 2024
765ff94
fix proto related tests
philippotto Jun 21, 2024
b085621
fix more specs
philippotto Jun 21, 2024
e7f92af
fix pullqueue spec
philippotto Jun 21, 2024
160c774
refactor setNumberLike in cuckoo tables and update some todo comments
philippotto Jun 24, 2024
ff7d9d7
remove unused route, change tracingstore mapping route to proto ListO…
fm3 Jun 24, 2024
73b7704
toSet
fm3 Jun 24, 2024
2d7b6d6
Merge branch 'magic-mapping' of github.com:scalableminds/webknossos i…
philippotto Jun 24, 2024
05d9167
remove unused getAgglomerateIdForSegmentId
philippotto Jun 24, 2024
9b89c2a
Merge branch 'magic-mapping' of github.com:scalableminds/webknossos i…
philippotto Jun 24, 2024
a06e7a1
fix rendering bug outside of viewport on some GPUs
philippotto Jun 24, 2024
4ef67e2
adapt agglomeratesForSegments route to new protobuf interface
philippotto Jun 24, 2024
44d45d1
link 64-bit issue (#6921) in todo comments
philippotto Jun 24, 2024
b9e4820
introduce mappingIsPartial uniform
philippotto Jun 25, 2024
b0d9282
mention #7895 in todo comment
philippotto Jun 25, 2024
46409ee
remove commented code
philippotto Jun 25, 2024
ba45aa3
Merge branch 'master' of github.com:scalableminds/webknossos into mag…
philippotto Jun 25, 2024
1803f49
Merge branch 'master' of github.com:scalableminds/webknossos into mag…
philippotto Jun 25, 2024
0e4e238
avoid expensive console.log for large mappings
philippotto Jun 26, 2024
45e2801
disable most ci checks
philippotto Jun 26, 2024
3d0a331
fix incorrect hash table size and use hashCombine twice to fix poor c…
philippotto Jun 28, 2024
f8bfb24
fix cuckootable rehash (did redundant work) and adapt max iterations …
philippotto Jul 2, 2024
007cd87
if many inserts are done for the mapping, flush the table at the end
philippotto Jul 3, 2024
a72049f
fix weak hashing for power-of-two table sizes
philippotto Jul 3, 2024
9182693
refactor diminished hash capacity tweak; clean up and extend tests so…
philippotto Jul 4, 2024
5d988d9
clean up reloadData related code in mapping_saga
philippotto Jul 5, 2024
5a4e18d
fix serializing bigint to protobuf long
philippotto Jul 9, 2024
d2e1207
fix toggling of json mappings
philippotto Jul 9, 2024
15e29bc
group consecutive actions in action logger middleware; add debug logg…
philippotto Jul 9, 2024
202b57b
fix that forceful disabled tool wasn't re-enabled when possible (e.g.…
philippotto Jul 9, 2024
8632e3e
mention 64 bit support issue in comment
philippotto Jul 9, 2024
f9ad609
fix broken mapping of ids by sorting the input ids for the server
philippotto Jul 9, 2024
8f4af4f
add comment about sorting
philippotto Jul 9, 2024
e38f97e
don't map ids dynamically in segment list view (instead segment items…
philippotto Jul 10, 2024
a263db1
test reaching critical capacity and remove todo comment
philippotto Jul 10, 2024
afb4803
remove some todo comments regarding mapId code that might return unma…
philippotto Jul 10, 2024
2b60d01
remove more todos and fix toggling of hdf mappings when no volume tra…
philippotto Jul 10, 2024
d7f7c91
cast to number when sorting bigint
philippotto Jul 12, 2024
ef7a415
Merge branch 'master' of github.com:scalableminds/webknossos into mag…
philippotto Jul 12, 2024
e07c0d9
use bigint in proofreading_saga where sensible and cast to number as …
philippotto Jul 12, 2024
e6a3632
disable more ci stuff
philippotto Jul 12, 2024
474cdcd
try to handle most ids as Number and cast to Number only when dealing…
philippotto Jul 12, 2024
3d0e5a1
show zoom warning for agglomerate files only when the mapping is appl…
philippotto Jul 13, 2024
c84388d
fix that supervoxel highlighting of mesh stays active after leaving p…
philippotto Jul 13, 2024
01d2185
fix that after changing the color of a mesh via the segments tab the …
philippotto Jul 13, 2024
2d2e402
remove unused imports
philippotto Jul 13, 2024
3a02416
fix proper type of values returned from getAgglomeratesForSegmentsFrom*
philippotto Jul 15, 2024
475501b
fix incorrect bigint check and refactor to avoid the same mistake in …
philippotto Jul 15, 2024
911c694
fix unnecessary type adaption that failed on null
philippotto Jul 15, 2024
54caaa3
fix another sorting bug
philippotto Jul 15, 2024
7d25619
Merge branch 'master' of github.com:scalableminds/webknossos into mag…
philippotto Jul 22, 2024
0305f6f
integrate pr feedback
philippotto Jul 22, 2024
126e822
rename cuckoo table to CuckooTableVec3
philippotto Jul 22, 2024
9c71895
unify 64 bit todo comments
philippotto Jul 23, 2024
e123f29
forceful -> forcefully
philippotto Jul 23, 2024
6fd1589
refactor eager value set computation
philippotto Jul 23, 2024
eb81c32
use 0s to initialize mapping uniforms
philippotto Jul 23, 2024
d249cb2
refactor/fix mapId logic for unmapped ids
philippotto Jul 23, 2024
7149678
fix selective visibility for alpha != 0.2
philippotto Jul 23, 2024
76146f0
only emit soft errors when a data value could not be mapped
philippotto Jul 23, 2024
8f705ea
fix mapping message hiding too early/never; fix disabled message in m…
philippotto Jul 23, 2024
dddb95d
misc console stuff
philippotto Jul 23, 2024
6bc07c0
also skip texture updates for cuckoo table when lots of unsets need t…
philippotto Jul 23, 2024
2a0597a
show short user notification when segmentation layer is reloaded
philippotto Jul 23, 2024
0c9df9d
Merge branch 'master' into magic-mapping
philippotto Jul 23, 2024
3379ed9
highlight whole segment mesh on hover even when geometry is not merge…
philippotto Jul 24, 2024
0a054ad
Merge branch 'magic-mapping' of github.com:scalableminds/webknossos i…
philippotto Jul 24, 2024
2369589
Merge branch 'master' of github.com:scalableminds/webknossos into mag…
philippotto Jul 24, 2024
2b3278c
use current mag when reading segment ids in proofreading (unless aggl…
philippotto Jul 31, 2024
706b234
Merge branch 'master' into magic-mapping
philippotto Jul 31, 2024
3a49845
remove last todo comments
philippotto Jul 31, 2024
d52cd50
update changelog
philippotto Jul 31, 2024
2b0c70e
remove console.log
philippotto Jul 31, 2024
774befa
re-enable ci checks
philippotto Jul 31, 2024
3f3d581
fix linting
philippotto Jul 31, 2024
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
2 changes: 2 additions & 0 deletions CHANGELOG.unreleased.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@ For upgrade instructions, please check the [migration guide](MIGRATIONS.released
- Upgraded backend dependencies for improved performance and stability. [#7922](https://github.com/scalableminds/webknossos/pull/7922)
- It is now saved whether segment groups are collapsed or expanded, so this information doesn't get lost e.g. upon page reload. [#7928](https://github.com/scalableminds/webknossos/pull/7928/)
- The context menu entry "Focus in Segment List" expands all necessary segment groups in the segments tab to show the highlighted segment. [#7950](https://github.com/scalableminds/webknossos/pull/7950)
- In the proofreading mode, you can enable/disable that only the active segment and the hovered segment are rendered. [#7654](https://github.com/scalableminds/webknossos/pull/7654)

### Changed
- The warning about a mismatch between the scale of a pre-computed mesh and the dataset scale's factor now also considers all supported mags of the active segmentation layer. This reduces the false posive rate regarding this warning. [#7921](https://github.com/scalableminds/webknossos/pull/7921/)
- It is no longer allowed to edit annotations of other organizations, even if they are set to public and to others-may-edit. [#7923](https://github.com/scalableminds/webknossos/pull/7923)
- When proofreading segmentations, the user can now interact with super-voxels directly in the data viewports. Additionally, proofreading is significantly faster because the segmentation data doesn't have to be re-downloaded after each merge/split operation. [#7654](https://github.com/scalableminds/webknossos/pull/7654)

### Fixed
- Fixed a bug that allowed the default newly created bounding box to appear outside the dataset. In case the whole bounding box would be outside it is created regardless. [#7892](https://github.com/scalableminds/webknossos/pull/7892)
Expand Down
2 changes: 1 addition & 1 deletion app/models/annotation/nml/NmlWriter.scala
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ class NmlWriter @Inject()(implicit ec: ExecutionContext) extends FoxImplicits {
case Right(volumeTracing) =>
volumeTracing.fallbackLayer.foreach(writer.writeAttribute("fallbackLayer", _))
volumeTracing.largestSegmentId.foreach(id => writer.writeAttribute("largestSegmentId", id.toString))
if (!volumeTracing.mappingIsEditable.getOrElse(false)) {
if (!volumeTracing.hasEditableMapping.getOrElse(false)) {
volumeTracing.mappingName.foreach { mappingName =>
writer.writeAttribute("mappingName", mappingName)
}
Expand Down
113 changes: 87 additions & 26 deletions frontend/javascripts/admin/admin_rest_api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,19 @@ import type {
MappingType,
VolumeTracing,
UserConfiguration,
Mapping,
NumberLike,
} from "oxalis/store";
import type { NewTask, TaskCreationResponseContainer } from "admin/task/task_create_bulk_view";
import type { QueryObject } from "admin/task/task_search_form";
import { V3 } from "libs/mjs";
import type { Versions } from "oxalis/view/version_view";
import { enforceValidatedDatasetViewConfiguration } from "types/schemas/dataset_view_configuration_defaults";
import { parseProtoTracing } from "oxalis/model/helpers/proto_helpers";
import {
parseProtoListOfLong,
parseProtoTracing,
serializeProtoListOfLong,
} from "oxalis/model/helpers/proto_helpers";
import type { RequestOptions } from "libs/request";
import Request from "libs/request";
import type { Message } from "libs/toast";
Expand Down Expand Up @@ -886,7 +892,7 @@ export async function getTracingForAnnotationType(
): Promise<ServerTracing> {
const { tracingId, typ } = annotationLayerDescriptor;
const version = extractVersion(versions, tracingId, typ);
const tracingType = typ.toLowerCase();
const tracingType = typ.toLowerCase() as "skeleton" | "volume";
const possibleVersionString = version != null ? `&version=${version}` : "";
const tracingArrayBuffer = await doWithToken((token) =>
Request.receiveArraybuffer(
Expand Down Expand Up @@ -1599,23 +1605,6 @@ export function getEditableMappingInfo(
);
}

export function getAgglomerateIdForSegmentId(
tracingStoreUrl: string,
tracingId: string,
segmentId: number,
): Promise<number> {
return doWithToken(async (token) => {
const urlParams = new URLSearchParams({
token,
segmentId: `${segmentId}`,
});
const { agglomerateId } = await Request.receiveJSON(
`${tracingStoreUrl}/tracings/mapping/${tracingId}/agglomerateIdForSegmentId?${urlParams.toString()}`,
);
return agglomerateId;
});
}

export function getPositionForSegmentInAgglomerate(
datastoreUrl: string,
datasetId: APIDatasetId,
Expand Down Expand Up @@ -2068,6 +2057,67 @@ export function getAgglomerateSkeleton(
);
}

export async function getAgglomeratesForSegmentsFromDatastore<T extends number | bigint>(
dataStoreUrl: string,
datasetId: APIDatasetId,
layerName: string,
mappingId: string,
segmentIds: Array<T>,
): Promise<Mapping> {
const segmentIdBuffer = serializeProtoListOfLong<T>(segmentIds);
const listArrayBuffer: ArrayBuffer = await doWithToken((token) =>
Request.receiveArraybuffer(
`${dataStoreUrl}/data/datasets/${datasetId.owningOrganization}/${datasetId.name}/layers/${layerName}/agglomerates/${mappingId}/agglomeratesForSegments?token=${token}`,
{
method: "POST",
body: segmentIdBuffer,
headers: {
"Content-Type": "application/octet-stream",
},
},
),
);
// Ensure that the values are bigint if the keys are bigint
const adaptToType = Utils.isBigInt(segmentIds[0])
? (el: NumberLike) => BigInt(el)
: (el: NumberLike) => el;
const keyValues = _.zip(segmentIds, parseProtoListOfLong(listArrayBuffer).map(adaptToType));
// @ts-ignore
return new Map(keyValues);
}

export async function getAgglomeratesForSegmentsFromTracingstore<T extends number | bigint>(
tracingStoreUrl: string,
tracingId: string,
segmentIds: Array<T>,
): Promise<Mapping> {
const segmentIdBuffer = serializeProtoListOfLong<T>(
// The tracing store expects the ids to be sorted
segmentIds.sort(<T extends NumberLike>(a: T, b: T) => Number(a - b)),
);
const listArrayBuffer: ArrayBuffer = await doWithToken((token) =>
Request.receiveArraybuffer(
`${tracingStoreUrl}/tracings/mapping/${tracingId}/agglomeratesForSegments?token=${token}`,
{
method: "POST",
body: segmentIdBuffer,
headers: {
"Content-Type": "application/octet-stream",
},
},
),
);

// Ensure that the values are bigint if the keys are bigint
const adaptToType = Utils.isBigInt(segmentIds[0])
? (el: NumberLike) => BigInt(el)
: (el: NumberLike) => el;

const keyValues = _.zip(segmentIds, parseProtoListOfLong(listArrayBuffer).map(adaptToType));
// @ts-ignore
return new Map(keyValues);
}

export function getEditableAgglomerateSkeleton(
tracingStoreUrl: string,
tracingId: string,
Expand Down Expand Up @@ -2228,18 +2278,24 @@ export async function getEdgesForAgglomerateMinCut(
tracingStoreUrl: string,
tracingId: string,
segmentsInfo: {
segmentId1: number;
segmentId2: number;
segmentId1: NumberLike;
segmentId2: NumberLike;
mag: Vector3;
agglomerateId: number;
agglomerateId: NumberLike;
editableMappingId: string;
},
): Promise<Array<MinCutTargetEdge>> {
return doWithToken((token) =>
Request.sendJSONReceiveJSON(
`${tracingStoreUrl}/tracings/volume/${tracingId}/agglomerateGraphMinCut?token=${token}`,
{
data: segmentsInfo,
data: {
...segmentsInfo,
// TODO: Proper 64 bit support (#6921)
segmentId1: Number(segmentsInfo.segmentId1),
segmentId2: Number(segmentsInfo.segmentId2),
agglomerateId: Number(segmentsInfo.agglomerateId),
},
},
),
);
Expand All @@ -2254,17 +2310,22 @@ export async function getNeighborsForAgglomerateNode(
tracingStoreUrl: string,
tracingId: string,
segmentInfo: {
segmentId: number;
segmentId: NumberLike;
mag: Vector3;
agglomerateId: number;
agglomerateId: NumberLike;
editableMappingId: string;
},
): Promise<NeighborInfo> {
return doWithToken((token) =>
Request.sendJSONReceiveJSON(
`${tracingStoreUrl}/tracings/volume/${tracingId}/agglomerateGraphNeighbors?token=${token}`,
{
data: segmentInfo,
data: {
...segmentInfo,
// TODO: Proper 64 bit support (#6921)
segmentId: Number(segmentInfo.segmentId),
agglomerateId: Number(segmentInfo.agglomerateId),
},
},
),
);
Expand Down
7 changes: 5 additions & 2 deletions frontend/javascripts/libs/async/debounced_abortable_saga.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ import { call, type Saga } from "oxalis/model/sagas/effect-generators";
import { buffers, Channel, channel, runSaga } from "redux-saga";
import { delay, race, take } from "redux-saga/effects";

// biome-ignore lint/complexity/noBannedTypes: This is copied from redux-saga because it cannot be imported.
type NotUndefined = {} | null;

/*
* This function takes a saga and a debounce threshold
* and returns a function F that will trigger the given saga
Expand All @@ -15,7 +18,7 @@ import { delay, race, take } from "redux-saga/effects";
* is slower than a standard _.debounce. Also see
* debounced_abortable_saga.spec.ts for a small benchmark.
*/
export function createDebouncedAbortableCallable<T, C>(
export function createDebouncedAbortableCallable<T extends NotUndefined, C>(
fn: (param1: T) => Saga<void>,
debounceThreshold: number,
context: C,
Expand Down Expand Up @@ -56,7 +59,7 @@ export function createDebouncedAbortableParameterlessCallable<C>(
};
}

function* debouncedAbortableSagaRunner<T, C>(
function* debouncedAbortableSagaRunner<T extends NotUndefined, C>(
debounceThreshold: number,
triggerChannel: Channel<T>,
abortableFn: (param: T) => Saga<void>,
Expand Down
Loading