Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F81119877
preprocessing.py
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Wed, Sep 4, 07:25
Size
1 KB
Mime Type
text/x-objective-c
Expires
Fri, Sep 6, 07:25 (2 d)
Engine
blob
Format
Raw Data
Handle
20519820
Attached To
R6289 Motion correction paper
preprocessing.py
View Options
#@String parameter_file
from
ij
import
IJ
,
ImagePlus
from
ij.io
import
Opener
,
FileSaver
from
ij.plugin
import
RGBStackMerge
,
StackCombiner
,
Resizer
from
ij.process
import
ImageConverter
from
ij.plugin
import
Resizer
import
json
import
os
#import file paths
json_file
=
open
(
parameter_file
,
'r'
)
text
=
json_file
.
read
()
files
=
json
.
loads
(
text
)
json_file
.
close
()
#Instanciate necessary classes
opener
=
Opener
()
RGB_stack_merge
=
RGBStackMerge
()
stack_combiner
=
StackCombiner
()
resizer
=
Resizer
()
#Open images
unregistered_GC6s_info
=
opener
.
getTiffFileInfo
(
files
[
'GC6s_input'
])
unregistered_GC6s_imp
=
opener
.
openTiffStack
(
unregistered_GC6s_info
)
unregistered_tdTom_info
=
opener
.
getTiffFileInfo
(
files
[
'tdTom_input'
])
unregistered_tdTom_imp
=
opener
.
openTiffStack
(
unregistered_tdTom_info
)
#Remove dispensable slices from unregistered stacks
IJ
.
run
(
unregistered_GC6s_imp
,
"Slice Remover"
,
files
[
'slices_removed'
])
IJ
.
run
(
unregistered_tdTom_imp
,
"Slice Remover"
,
files
[
'slices_removed'
])
#Create output directory if it does not exist
if
not
os
.
path
.
exists
(
files
[
'output_dir'
]):
os
.
makedirs
(
files
[
'output_dir'
])
#Save result
file_saver_GC6s_image
=
FileSaver
(
unregistered_GC6s_imp
)
file_saver_GC6s_image
.
saveAsTiffStack
(
files
[
'output_dir'
]
+
'/GC6s_preprocessed.tif'
)
file_saver_tdTom_image
=
FileSaver
(
unregistered_tdTom_imp
)
file_saver_tdTom_image
.
saveAsTiffStack
(
files
[
'output_dir'
]
+
'/tdTom_preprocessed.tif'
)
Event Timeline
Log In to Comment