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
d48192de
Unverified
Commit
d48192de
authored
2 years ago
by
Xiao Gui
Browse files
Options
Downloads
Patches
Plain Diff
bugfix: error scale calculations
parent
f2621d8c
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/viewerModule/nehuba/viewerCtrl/perspectiveViewSlider/perspectiveViewSlider.component.ts
+13
-21
13 additions, 21 deletions
.../perspectiveViewSlider/perspectiveViewSlider.component.ts
with
13 additions
and
21 deletions
src/viewerModule/nehuba/viewerCtrl/perspectiveViewSlider/perspectiveViewSlider.component.ts
+
13
−
21
View file @
d48192de
import
{
Component
,
OnDestroy
,
Inject
,
ViewChild
,
ChangeDetectionStrategy
,
HostBinding
}
from
"
@angular/core
"
;
import
{
Component
,
OnDestroy
,
Inject
,
ViewChild
,
ChangeDetectionStrategy
}
from
"
@angular/core
"
;
import
{
FormControl
}
from
"
@angular/forms
"
;
import
{
FormControl
}
from
"
@angular/forms
"
;
import
{
select
,
Store
}
from
"
@ngrx/store
"
;
import
{
select
,
Store
}
from
"
@ngrx/store
"
;
import
{
combineLatest
,
concat
,
NEVER
,
Observable
,
of
,
Subject
,
Subscription
}
from
"
rxjs
"
;
import
{
combineLatest
,
concat
,
NEVER
,
Observable
,
of
,
Subject
,
Subscription
}
from
"
rxjs
"
;
...
@@ -17,10 +17,10 @@ import { floatEquality } from "common/util"
...
@@ -17,10 +17,10 @@ import { floatEquality } from "common/util"
const
MAX_DIM
=
200
const
MAX_DIM
=
200
type
AnatomicalOrientation
=
'
ap
'
|
'
si
'
|
'
l
r
'
// anterior-posterior, superior-inferior,
left-righ
t
type
AnatomicalOrientation
=
'
ap
'
|
'
si
'
|
'
r
l
'
// anterior-posterior, superior-inferior,
right-lef
t
type
RangeOrientation
=
'
horizontal
'
|
'
vertical
'
type
RangeOrientation
=
'
horizontal
'
|
'
vertical
'
const
anatOriToIdx
:
Record
<
AnatomicalOrientation
,
number
>
=
{
const
anatOriToIdx
:
Record
<
AnatomicalOrientation
,
number
>
=
{
'
l
r
'
:
0
,
'
r
l
'
:
0
,
'
ap
'
:
1
,
'
ap
'
:
1
,
'
si
'
:
2
'
si
'
:
2
}
}
...
@@ -121,7 +121,7 @@ export class PerspectiveViewSlider implements OnDestroy {
...
@@ -121,7 +121,7 @@ export class PerspectiveViewSlider implements OnDestroy {
sliceView
=
EnumClassicalView
.
CORONAL
sliceView
=
EnumClassicalView
.
CORONAL
}
}
if
(
maximisedPanelIndex
===
1
)
{
if
(
maximisedPanelIndex
===
1
)
{
anatomicalOrientation
=
'
l
r
'
anatomicalOrientation
=
'
r
l
'
rangeOrientation
=
'
horizontal
'
rangeOrientation
=
'
horizontal
'
minimapView
=
EnumClassicalView
.
CORONAL
minimapView
=
EnumClassicalView
.
CORONAL
sliceView
=
EnumClassicalView
.
SAGITTAL
sliceView
=
EnumClassicalView
.
SAGITTAL
...
@@ -197,13 +197,10 @@ export class PerspectiveViewSlider implements OnDestroy {
...
@@ -197,13 +197,10 @@ export class PerspectiveViewSlider implements OnDestroy {
const
{
real
:
realPos
}
=
nav
const
{
real
:
realPos
}
=
nav
const
{
anatomicalOrientation
:
anatOri
}
=
orientation
const
{
anatomicalOrientation
:
anatOri
}
=
orientation
let
idx
=
null
const
idx
=
anatOriToIdx
[
anatOri
]
if
(
anatOri
===
"
ap
"
)
idx
=
1
if
(
anatOri
===
"
lr
"
)
idx
=
0
if
(
anatOri
===
"
si
"
)
idx
=
2
if
(
idx
===
null
)
return
null
const
{
real
,
transform
}
=
templateSize
const
{
real
,
transform
}
=
templateSize
if
(
!
transform
||
!
transform
[
idx
])
return
null
const
min
=
Math
.
round
(
transform
[
idx
][
3
])
const
min
=
Math
.
round
(
transform
[
idx
][
3
])
const
max
=
Math
.
round
(
real
[
idx
]
+
transform
[
idx
][
3
])
const
max
=
Math
.
round
(
real
[
idx
]
+
transform
[
idx
][
3
])
...
@@ -296,37 +293,32 @@ export class PerspectiveViewSlider implements OnDestroy {
...
@@ -296,37 +293,32 @@ export class PerspectiveViewSlider implements OnDestroy {
return
(
position
[
idx
]
-
compensate
)
/
templateSize
.
real
[
idx
]
return
(
position
[
idx
]
-
compensate
)
/
templateSize
.
real
[
idx
]
}
}
let
viewportDimOfInterest
:
number
let
scale
:
number
=
2
const
sliceviewDim
=
getDim
(
templateSize
.
real
,
sliceView
)
const
sliceviewDim
=
getDim
(
templateSize
.
real
,
sliceView
)
if
(
!
sliceviewDim
)
return
null
if
(
sliceView
===
EnumClassicalView
.
CORONAL
)
{
if
(
sliceView
===
EnumClassicalView
.
CORONAL
)
{
// minimap is sagittal view, so interested in superior-inferior axis
// minimap is sagittal view, so interested in superior-inferior axis
translate
=
getTranslatePc
(
2
)
translate
=
getTranslatePc
(
2
)
viewportDimOfInterest
=
viewportSize
.
height
scale
=
Math
.
min
(
scale
,
viewportSize
.
height
*
zoom
/
sliceviewDim
[
1
])
}
}
if
(
sliceView
===
EnumClassicalView
.
SAGITTAL
)
{
if
(
sliceView
===
EnumClassicalView
.
SAGITTAL
)
{
// minimap is coronal view, so interested in superior-inferior axis
// minimap is coronal view, so interested in superior-inferior axis
translate
=
getTranslatePc
(
2
)
translate
=
getTranslatePc
(
2
)
viewportDimOfInterest
=
viewportSize
.
height
scale
=
Math
.
min
(
scale
,
viewportSize
.
height
*
zoom
/
sliceviewDim
[
1
])
}
}
if
(
sliceView
===
EnumClassicalView
.
AXIAL
)
{
if
(
sliceView
===
EnumClassicalView
.
AXIAL
)
{
// minimap is in coronal view, so interested in left-right axis
// minimap is in coronal view, so interested in left-right axis
translate
=
getTranslatePc
(
0
)
*
-
1
translate
=
getTranslatePc
(
0
)
*
-
1
viewportDimOfInterest
=
viewportSize
.
width
scale
=
Math
.
min
(
scale
,
viewportSize
.
width
*
zoom
/
sliceviewDim
[
0
])
}
}
if
(
!
sliceviewDim
)
return
null
/**
/**
* calculate scale
* calculate scale
*/
*/
const
scale
=
[
2
,
2
]
const
scaleString
=
`scaleY(
${
scale
}
)`
scale
[
0
]
=
Math
.
min
(
scale
[
0
],
viewportDimOfInterest
*
zoom
/
sliceviewDim
[
0
])
scale
[
1
]
=
Math
.
min
(
scale
[
1
],
viewportDimOfInterest
*
zoom
/
sliceviewDim
[
1
])
const
scaleArr
=
scale
.
map
(
v
=>
`scaleY(
${
v
}
)`
)
const
scaleString
=
isVertical
?
scaleArr
[
1
]
:
scaleArr
[
0
]
/**
/**
* calculate translation
* calculate translation
...
...
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