User Tools

Site Tools


documents:120206pyip_cooking:python_imagej_cookbook

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
documents:120206pyip_cooking:python_imagej_cookbook [2017/12/03 14:08] – [Automatic Brightness/Contrast Button] human language explanation added kotadocuments:120206pyip_cooking:python_imagej_cookbook [2018/08/20 01:32] – [Channel Splitter] kota
Line 772: Line 772:
 imps[0].show() # Channel 1 imps[0].show() # Channel 1
 imps[1].show() # Channel 2 imps[1].show() # Channel 2
 +</code>
 +
 +==== Channel Merge ====
 +
 +[Image > Color > Merge Channels...]
 +
 +<code python linenums:1>
 +from ij import ImagePlus
 +from ij.plugin import RGBStackMerge, RGBStackConverter
 +
 +impc1 = ImagePlus("path/to/image.tif")
 +impc2 = ImagePlus("path/to/image.tif")
 +
 +mergeimp = RGBStackMerge.mergeChannels([impc2, None, impc1, None, None, None, None], True)
 +
 +# convert the composite image to the RGB image
 +RGBStackConverter.convertToRGB(mergeimp)
 +
 +mergeimp.show()
 </code> </code>
 ==== Z projection ==== ==== Z projection ====
Line 1309: Line 1328:
  
 <code python linenums:1> <code python linenums:1>
 +from ij import IJ, ImagePlus
 from ij.plugin.filter import ParticleAnalyzer as PA from ij.plugin.filter import ParticleAnalyzer as PA
 +from ij.measure import ResultsTable
 +
 imp = IJ.getImage() imp = IJ.getImage()
  
Line 1519: Line 1541:
 cm.setPointSize(3) cm.setPointSize(3)
 </code> </code>
-===== Plugin: LOCI BioFormats, Replacing OME-TIFF XML =====+===== Plugin: LOCI BioFormats ===== 
 + 
 +==== Importing CZI file ==== 
 + 
 +<code python linenums:1> 
 +from loci.plugins import BF 
 +from loci.plugins.in import ImporterOptions 
 + 
 +filepath = "/path/to/image/my.czi" 
 + 
 +# Options for Bioformats pluginincludeing 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() 
 +</code> 
 + 
 +See here for more on metadata parsing and so on: [[https://gist.github.com/ctrueden/6282856|bio-formats.py]] 
 + 
 +==== Replacing OME-TIFF XML ====
  
 <code python linenums:1> <code python linenums:1>
documents/120206pyip_cooking/python_imagej_cookbook.txt · Last modified: 2022/10/16 07:12 by kota

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki