 |
Image manipulation: convert to mask, get pixels
Source code name: "image_manipulate.py"
Programming language: Python
Topic: Images/Manipulation
DMelt Version 1. Last modified: 03/03/2021. License: Pro
https://datamelt.org/code/cache/image_manipulate_2829.py
To run this script using the DMelt IDE,
copy the above URL link to the menu [File]→[Read script from URL] of the DMelt IDE.
from ij import *
from ij.process import *
from ij.measure import *
from jhplot import *
# we open the file manually. Generate ImagePlus object
imp = IJ.openImage("https://datamelt.org/logo.png")
print dir(imp) # check image manipulation methods
# display it
imp.show()
print imp.getWidth()
# do manipulations with the clone
imp.getProcessor().setThreshold(174, 174, ImageProcessor.NO_LUT_UPDATE)
IJ.run(imp,"Convert to Mask","")
IJ.run(imp,"Watershed", "")
imp.show()
# get all the pixels
pix = imp.getProcessor().getPixels()
You see the box below because you did not login.