This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ''' | |
| writing data to a csv file. | |
| ''' | |
| import os, csv | |
| # prepare test data to wirte to a csv file | |
| data1 = range(10) | |
| data2 = [x * x for x in data1] | |
| data3 = [pow(x, 3) for x in data1] | |
| print data3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ''' | |
| loading multiple tif files and store them in a list. | |
| ''' | |
| import os | |
| from ij import IJ | |
| from ij.io import DirectoryChooser | |
| def run(): | |
| srcDir = DirectoryChooser("Choose!").getDirectory() | |
| IJ.log("directory: "+srcDir) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def stacklistGenerate(imp): | |
| stk = imp.getStack() | |
| imglist = [] | |
| print len(imglist) | |
| for i in range(imp.getStackSize()): | |
| ip = stk.getProcessor(i+1) | |
| title = "img" + str(i+1) | |
| impsingle = ImagePlus(title, ip.duplicate()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| imp = IJ.getImage() | |
| midslice = int(imp.getStackSize() / 2) | |
| imp.setSlice(midslice) | |
| #IJ.setThreshold(-50, -0.62) | |
| ip.setAutoThreshold(AutoThresholder.Method.Default, False) | |
| IJ.setThreshold(ip.getMinThreshold(), ip.getMaxThreshold()) | |
| print ip.getMaxThreshold() | |
| print ip.getMinThreshold() | |
| #th = ip.getMaxThreshold() | |
| IJ.run("Convert to Mask", "method=Default background=Light black") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from fiji.threshold import Auto_Local_Threshold as ALT | |
| # nucleus selection | |
| #imp = IJ.getImage() | |
| imp = IJ.openImage("/Users/miyanari/Desktop/EMBL_with Kota/FISH_data/DNA-FISH_Demo.tif") | |
| #IJ.run(imp, "Split Channels", "") | |
| imps = ChannelSplitter.split(imp) | |
| nucimp = imps[0] | |
| #nucimp.show() |