Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Sean Fitzgibbon
SlideR 🍔
Commits
3dd0c1b0
Commit
3dd0c1b0
authored
May 10, 2021
by
Sean Fitzgibbon
Browse files
tweaks
parent
09bd88ab
Changes
1
Hide whitespace changes
Inline
Side-by-side
slice-register.py
View file @
3dd0c1b0
...
...
@@ -132,6 +132,9 @@ from tirl.transformations.linear.scale import TxScale, TxIsoScale
from
tirl.transformations.linear.translation
import
TxTranslation
from
tirl.transformations.nonlinear.displacement
import
TxDisplacementField
import
matplotlib.pyplot
as
plt
import
os.path
as
op
# TIRL IMPORTS
# DEFINITIONS
...
...
@@ -180,6 +183,8 @@ def run(cnf=None, **options):
p
.
moving
.
export
=
\
os
.
path
.
join
(
p
.
general
.
outputdir
,
f
"moving.
{
ext
}
"
)
moving
=
tirl
.
scripts
.
mnd
.
inout
.
load_image
(
scope
=
globals
(),
**
p
.
moving
)
if
p
.
fixed
.
export
is
True
:
ext
=
ts
.
EXTENSIONS
[
"TImage"
]
p
.
fixed
.
export
=
os
.
path
.
join
(
p
.
general
.
outputdir
,
f
"fixed.
{
ext
}
"
)
...
...
@@ -208,6 +213,15 @@ def run(cnf=None, **options):
fixed
,
*
p
.
preprocessing
.
fixed
,
scope
=
globals
(),
other
=
moving
,
cnf
=
p
)
fixed
.
centralise
(
weighted
=
True
)
# if p.moving.snapshot is True:
# print(moving.mask.shape)
# plt.imsave(op.join(p.general.outputdir, 'moving_mask.png'), moving.mask)
#
# if p.fixed.snapshot is True:
# print(fixed.mask.shape)
# plt.imsave(op.join(p.general.outputdir, 'fixed_mask.png'), fixed.mask)
# Run the registration routine
try
:
register
(
fixed
,
moving
,
p
)
...
...
@@ -681,7 +695,7 @@ def rgb2hsv(x):
def
match_fixed_resolution
(
img
,
**
kwargs
):
"""
Resamples histology image to match the resolution of
another 2D
image.
Resamples histology image to match the resolution of
the fixed
image.
"""
p
=
AttrMap
(
kwargs
.
get
(
"cnf"
))
...
...
@@ -892,13 +906,13 @@ def create_cli(parser):
"""
parser
.
add_argument
(
"--moving"
,
metavar
=
"image"
,
help
=
"Moving slide"
,
default
=
None
,
type
=
str
,
required
=
Fals
e
)
required
=
Tru
e
)
parser
.
add_argument
(
"--fixed"
,
metavar
=
"image"
,
help
=
"Fixed slide"
,
default
=
None
,
type
=
str
,
required
=
Fals
e
)
required
=
Tru
e
)
parser
.
add_argument
(
"--out"
,
metavar
=
"dir"
,
help
=
"Output directory"
,
default
=
None
,
type
=
str
,
required
=
Fals
e
)
required
=
Tru
e
)
parser
.
add_argument
(
"--config"
,
metavar
=
"cnf_file.json"
,
help
=
"configuration file"
,
default
=
'default.json'
,
type
=
str
,
required
=
False
)
...
...
@@ -913,7 +927,7 @@ def main(*args):
""" Main program code. """
parser
=
argparse
.
ArgumentParser
(
prog
=
"sli
de_to_slide
"
,
prog
=
"sli
ce-register.py
"
,
description
=
"Registers a histology slide to "
"another histology slide."
)
parser
=
create_cli
(
parser
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment