-
Notifications
You must be signed in to change notification settings - Fork 0
/
DICBacteriaExtractor.py
39 lines (30 loc) · 1.24 KB
/
DICBacteriaExtractor.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# Jorik van Rijn <jorik.vanrijn@gmail.com> - 2020
import ij.IJ as IJ
import ij.io.Opener as Opener
import ij.ImagePlus as ImagePlus
import ij.plugin.ChannelSplitter as ChannelSplitter
import ij.plugin.RGBStackMerge as RGBStackMerge
import ij.process.ImageProcessor as ImageProcessor
from FijiTools2020.impActions import subtractzproject
def main():
# Open a .ome.tif image from the Flexoscope.
impath = IJ.getFilePath("Choose .ome.tiff file")
channels = Opener.openUsingBioFormats(impath)
# Show image
# imp.show() # straight to channels object sames memory.
# Split channels.
channels = ChannelSplitter().split(channels)
# Process channel 1.
# subtractzproject(imp, projectionMethod="Median")
channels[1] = ImagePlus()
channels.append(ImagePlus())
channels[1] = subtractzproject(channels[0])
IJ.run(channels[0], "Enhance Contrast...", "saturated=0.3 normalize process_all use")
IJ.run(channels[0], "8-bit", "")
IJ.run(channels[1], "Square", "stack")
IJ.run(channels[1], "Enhance Contrast...", "saturated=0.3 normalize process_all use")
IJ.run(channels[1], "8-bit", "")
# Merge channels.
merge = RGBStackMerge().mergeChannels(channels, True) # boolean keep
merge.show()
main()