Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
siibra-explorer
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Xiao Gui
siibra-explorer
Commits
e388018f
Commit
e388018f
authored
2 years ago
by
Xiao Gui
Browse files
Options
Downloads
Patches
Plain Diff
fix annotation edge cases
parent
582e5d0e
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/atlasComponents/annotations/annotation.service.ts
+32
-7
32 additions, 7 deletions
src/atlasComponents/annotations/annotation.service.ts
with
32 additions
and
7 deletions
src/atlasComponents/annotations/annotation.service.ts
+
32
−
7
View file @
e388018f
...
...
@@ -166,14 +166,39 @@ export class AnnotationLayer {
}
private
parseNgSpecType
(
spec
:
AnnotationSpec
):
_AnnotationSpec
{
let
overwritingType
=
null
if
(
spec
.
type
===
'
point
'
)
overwritingType
=
0
if
(
spec
.
type
===
'
line
'
)
overwritingType
=
1
if
(
spec
.
type
===
"
aabbox
"
)
overwritingType
=
2
if
(
overwritingType
===
null
)
throw
new
Error
(
`overwrite type lookup failed for
${
spec
.
type
}
`
)
const
voxelSize
=
this
.
viewer
.
navigationState
.
voxelSize
.
toJSON
()
const
sanitizePoint
=
(
p
:
[
number
,
number
,
number
])
=>
p
.
map
((
v
,
idx
)
=>
v
/
voxelSize
[
idx
])
as
[
number
,
number
,
number
]
const
needSanitizePosition
=
voxelSize
[
0
]
!==
1
||
voxelSize
[
1
]
!==
1
||
voxelSize
[
2
]
!==
1
let
overwrite
:
Partial
<
_AnnotationSpec
>
=
{}
if
(
spec
.
type
===
'
point
'
)
{
overwrite
=
{
type
:
0
,
}
}
if
(
spec
.
type
===
'
line
'
)
{
overwrite
=
{
type
:
1
}
}
if
(
spec
.
type
===
"
aabbox
"
)
{
overwrite
=
{
type
:
2
}
}
if
(
!
overwrite
.
type
)
throw
new
Error
(
`overwrite type lookup failed for
${
spec
.
type
}
`
)
/**
* The unit of annotation(s) depends on voxel size. If it is 1,1,1 then it would be in um, but often it is not.
* If not sanitized, the annotation can be miles off.
*/
if
(
needSanitizePosition
)
{
for
(
const
key
of
[
'
point
'
,
'
pointA
'
,
'
pointB
'
]
)
{
if
(
!!
spec
[
key
])
overwrite
[
key
]
=
sanitizePoint
(
spec
[
key
])
}
}
return
{
...
spec
,
type
:
overwrit
ingTyp
e
}
...
overwrite
,
}
as
_AnnotationSpec
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment