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
Jonathan Juhl
SortEM
Commits
214d1be5
Commit
214d1be5
authored
Dec 01, 2021
by
Jonathan Juhl
Browse files
Delete mic_extractor_sortem.py
parent
9fdd7808
Changes
1
Hide whitespace changes
Inline
Side-by-side
mic_extractor_sortem.py
deleted
100644 → 0
View file @
9fdd7808
import
tensorflow
as
tf
import
numpy
as
np
import
mrcfile
output_path
=
'/emcc/misser11/out_optics_dub_stack.star'
output_dir
=
input_star
=
'/emcc/misser11/out_optics_dub.star'
def
open_star_file
():
def
make_star_file
():
def
load_big_micrograph
(
image_path
):
def
extract_particles
(
image
,
x_min
,
y_min
,
box_size
):
zeros
=
tf
.
zeros
(
tf
.
shape
(
x_min
)[
0
])
image_stack
=
tf
.
image
.
crop_and_resize
(
image
,[
y_min
,
x_min
,
y_min
+
box_size
,
x_min
+
box_size
],
zeros
,[
box_size
,
box_size
])
with
mrcfile
.
new
(
'pa'
,
compression
=
'bzip2'
)
as
mrc
:
for
i
in
range
(
mrc_paths
)
star_file
=
'out_optics_dub.star'
def
get_star_file_parameters
(
star_files
):
with
open
(
star_files
,
newline
=
''
)
as
csvfile
:
reader
=
list
(
csvfile
)
header
=
list
(
filter
(
lambda
x
:
(
'_rln'
==
x
[
0
:
4
]
or
'loop_'
==
x
.
strip
())
and
'_rlnMicrographName'
not
in
x
,
reader
))
header
=
[
i
.
split
()[
0
]
for
i
in
header
]
header
=
[
'_rlnImageName'
]
+
header
[
1
:]
index
=
1
with
open
(
'out_star.star'
,
'w'
)
as
cv
:
out
=
[]
for
i
in
reader
:
if
len
(
header
)
==
len
(
i
.
split
()):
i
=
i
.
split
(
' '
)
new_i
=
[
str
(
"%06d@emcc/misser11/New_Project/Assets/ParticleStacks/particle_stack_1.mrc"
)
%
(
index
,)]
+
i
[
1
:]
out
.
append
(
new_i
)
index
+=
1
cv
.
write
(
'data_images
\n
'
)
cv
.
write
(
'
\n
'
)
cv
.
write
(
'loop_
\n
'
)
for
i
in
header
:
cv
.
write
(
i
+
'
\n
'
)
cv
.
write
(
'
\n
'
)
for
i
in
out
:
cv
.
write
(
' '
.
join
(
i
))
get_star_file_parameters
(
star_f
\ No newline at end of file
Write
Preview
Supports
Markdown
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