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/16 00:23] – [Particle Analysis] kota | documents:120206pyip_cooking:python_imagej_cookbook [2018/12/10 23:07] – [Plugin: MiToBo h-dome transformation] kota | ||
---|---|---|---|
Line 95: | Line 95: | ||
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 772: | Line 785: | ||
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 1522: | Line 1554: | ||
cm.setPointSize(3) | cm.setPointSize(3) | ||
</ | </ | ||
- | ===== Plugin: LOCI BioFormats, Replacing OME-TIFF XML ===== | + | ===== Plugin: LOCI BioFormats |
+ | |||
+ | ==== Importing CZI file ==== | ||
+ | |||
+ | <code python linenums: | ||
+ | from loci.plugins import BF | ||
+ | from loci.plugins.in import ImporterOptions | ||
+ | |||
+ | filepath = "/ | ||
+ | |||
+ | # Options for Bioformats plugin, includeing the image path | ||
+ | options = ImporterOptions() | ||
+ | options.setOpenAllSeries(True) | ||
+ | options.setShowOMEXML(False) | ||
+ | options.setStitchTiles(False) | ||
+ | options.setId(filepath) | ||
+ | |||
+ | fullimps = BF.openImagePlus(options) | ||
+ | |||
+ | #fullimps now holds multiple images contained within the czi file. | ||
+ | # open the first one. | ||
+ | fullimps[0].show() | ||
+ | </ | ||
+ | |||
+ | See here for more on metadata parsing and so on: [[https:// | ||
+ | |||
+ | ==== Replacing OME-TIFF XML ==== | ||
<code python linenums: | <code python linenums: | ||
Line 1841: | Line 1899: | ||
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 ===== | ||
documents/120206pyip_cooking/python_imagej_cookbook.txt · Last modified: 2022/10/16 07:12 by kota