documents:120206pyip_cooking:python_imagej_cookbook
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
documents:120206pyip_cooking:python_imagej_cookbook [2018/07/19 14:43] – [Plugin: LOCI BioFormats, Replacing OME-TIFF XML] kota | documents:120206pyip_cooking:python_imagej_cookbook [2020/11/26 05:25] – [JAVADOCS] added a new section kota | ||
---|---|---|---|
Line 3: | Line 3: | ||
This page was last edited at: ~~LASTMOD~~ | This page was last edited at: ~~LASTMOD~~ | ||
+ | For learning image processing using Fiji and Jython scripting, go to excellent tutorials written by Albert Cardona, such as [[https:// | ||
+ | |||
+ | This page is like a cookbook: there are no details about how to do programming, | ||
+ | |||
+ | Other resources: | ||
+ | |||
+ | [[https:// | ||
===== Jython Interpreter ===== | ===== Jython Interpreter ===== | ||
A way to run jython script from jython interpreter, | A way to run jython script from jython interpreter, | ||
Line 95: | Line 102: | ||
print op.getDirectory()+ op.getFileName() | print op.getDirectory()+ op.getFileName() | ||
</ | </ | ||
+ | |||
+ | ==== Getting the directory where the curently opened image is stored ==== | ||
+ | <code python: | ||
+ | from ij import IJ | ||
+ | |||
+ | imp = IJ.getImage() | ||
+ | print imp.getOriginalFileInfo().directory | ||
+ | </ | ||
+ | |||
+ | ... can also be done by '' | ||
+ | |||
+ | Be careful not to mix with the usage of '' | ||
+ | |||
==== Regular Expression to get meta information from file name ==== | ==== Regular Expression to get meta information from file name ==== | ||
Line 201: | Line 221: | ||
print ff.getParent() | print ff.getParent() | ||
print ff.getName() | print ff.getName() | ||
+ | </ | ||
+ | ==== Loading a textfile as String ==== | ||
+ | |||
+ | <code python linenums: | ||
+ | path = "/ | ||
+ | with open(inpath, | ||
+ | data = myfile.read() | ||
+ | print data | ||
</ | </ | ||
Line 772: | Line 800: | ||
imps[0].show() # Channel 1 | imps[0].show() # Channel 1 | ||
imps[1].show() # Channel 2 | imps[1].show() # Channel 2 | ||
+ | </ | ||
+ | |||
+ | ==== Channel Merge ==== | ||
+ | |||
+ | [Image > Color > Merge Channels...] | ||
+ | |||
+ | <code python linenums: | ||
+ | from ij import ImagePlus | ||
+ | from ij.plugin import RGBStackMerge, | ||
+ | |||
+ | impc1 = ImagePlus(" | ||
+ | impc2 = ImagePlus(" | ||
+ | |||
+ | mergeimp = RGBStackMerge.mergeChannels([impc2, | ||
+ | |||
+ | # convert the composite image to the RGB image | ||
+ | RGBStackConverter.convertToRGB(mergeimp) | ||
+ | |||
+ | mergeimp.show() | ||
</ | </ | ||
==== Z projection ==== | ==== Z projection ==== | ||
Line 1867: | Line 1914: | ||
print p, resmap.get(p) | print p, resmap.get(p) | ||
</ | </ | ||
+ | |||
+ | ===== Plugin: MiToBo h-dome transformation ===== | ||
+ | |||
+ | h-dome is useful for spot detection in a noisy background. [[https:// | ||
+ | |||
+ | <code python> | ||
+ | from de.unihalle.informatik.MiToBo.core.datatypes.images import MTBImage | ||
+ | from de.unihalle.informatik.MiToBo.morphology import HDomeTransform3D | ||
+ | from ij import IJ | ||
+ | |||
+ | imp = IJ.getImage() | ||
+ | mtb = MTBImage.createMTBImage( imp.duplicate() ) | ||
+ | hdome = HDomeTransform3D(mtb, | ||
+ | hdome.runOp() | ||
+ | mtbdone = hdome.getResultImage() | ||
+ | imp2 = mtbdone.getImagePlus() | ||
+ | imp2.show() | ||
+ | |||
+ | </ | ||
+ | |||
+ | |||
===== R: Multi-Peak fitting using R ===== | ===== R: Multi-Peak fitting using R ===== | ||
Line 1964: | Line 2032: | ||
See explanation in [[http:// | See explanation in [[http:// | ||
+ | |||
+ | ===== JAVADOCS ===== | ||
+ | |||
+ | * 3D ImageJ Suite [[http:// | ||
+ | * [[https:// | ||
+ | * [[https:// | ||
+ | * 3D Viewer [[http:// | ||
+ | * MultistackReg [[http:// | ||
====== Discussions? | ====== Discussions? |
documents/120206pyip_cooking/python_imagej_cookbook.txt · Last modified: 2022/10/16 07:12 by kota