本文整理汇总了Python中ij.ImagePlus.getWidth方法的典型用法代码示例。如果您正苦于以下问题:Python ImagePlus.getWidth方法的具体用法?Python ImagePlus.getWidth怎么用?Python ImagePlus.getWidth使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ij.ImagePlus
的用法示例。
在下文中一共展示了ImagePlus.getWidth方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: openImp
# 需要导入模块: from ij import ImagePlus [as 别名]
# 或者: from ij.ImagePlus import getWidth [as 别名]
def openImp(self, path):
imp = ImagePlus(path) # open associated tif file
imp.show()
imp.getWindow().setLocationAndSize(280, 120, imp.getWidth()*4, imp.getHeight()*4) # int x, int y, int width, int height
return imp
示例2: ImagePlus
# 需要导入模块: from ij import ImagePlus [as 别名]
# 或者: from ij.ImagePlus import getWidth [as 别名]
from ij.plugin.filter import ParticleAnalyzer
from ij.plugin.frame import RoiManager
from java.util import Random
# don't need to import...
# from java.util import zip
from java.lang import Double
from jarray import zeros
# Explicit float image
imp = ImagePlus("ramp image", FloatProcessor(512, 512))
pix = imp.getProcessor().getPixels()
n_pixels = len(pix)
# catch width
w = imp.getWidth()
# create a ramp gradient from left to right
for i in range(len(pix)):
pix[i] = i % w
# adjust min and max, since we know them
imp.getProcessor().setMinAndMax(0, w-1)
imp.show()
# Explicit Byte image
width = 512
height = 512
示例3: NonBlockingGenericDialog
# 需要导入模块: from ij import ImagePlus [as 别名]
# 或者: from ij.ImagePlus import getWidth [as 别名]
accept_waiter = NonBlockingGenericDialog("Thresholding...")
accept_waiter.addNumericField("Threshold:",t_line,0)
accept_waiter.setCancelLabel("Apply new threshold")
accept_waiter.setOKLabel("Accept threshold")
accept_waiter.showDialog()
if (accept_waiter.wasCanceled()):
newip.reset()
newip.snapshot()
t_line = accept_waiter.getNextNumber()
# if (t_line > 10):
# t_line = t_line - 5
# else:
# t_line = 5
newip.setThreshold(0,t_line,ImageProcessor.BLACK_AND_WHITE_LUT)
newImage.updateAndDraw()
else:
doSameSlice = False
for i in range(newImage.getWidth()):
for j in range(newImage.getHeight()):
if (newip.getPixel(i,j) > newip.getMaxThreshold()):
newip.putPixel(i,j,254)
else:
newip.putPixel(i,j,0)
newnewip = newip.duplicate()
newStack.addSlice(newnewip)
newImage.close()
castImage = ImagePlus("cast",newStack)
castImage.show()
示例4: StackCells
# 需要导入模块: from ij import ImagePlus [as 别名]
# 或者: from ij.ImagePlus import getWidth [as 别名]
#.........这里部分代码省略.........
if roi == None :
IJ.showMessage("", "No selection")
return
if roi.getType() in [6,7] :
nslice = self.__impD.getCurrentSlice()
self.__impF.setSlice(nslice)
self.__impF.setRoi(roi)
elif roi.getType() in [2,4] :
nslice = self.__impD.getCurrentSlice()
self.__impF.setSlice(nslice)
m=Morph(self.__impF, roi)
m.setMidParams(10, 2)
roi=m.MidAxis
if roi == None :
self.__display.text = "roi fail"
if not self.__skip : IJ.showMessage("", "failed roi, please draw it as polyline")
return
#if roi.getType() != 6 : self.__impF.setRoi(roi)
else :
IJ.showMessage("", "This selection is not yet allowed")
return
self.__impF.setRoi(roi)
straightener = Straightener()
new_ip = straightener.straighten(self.__impF, roi, int(self.__widthl))
self.__iplist.append(new_ip)
self.__labels.append(self.__isF.getShortSliceLabel(nslice))
self.__display.text = self.__name + " cell " + str(len(self.__iplist)) +" width="+str(new_ip.getWidth())+ " height="+ str(new_ip.getHeight())
roi.setPosition(self.__impD.getCurrentSlice())
self.__rm = RoiManager.getInstance()
if (self.__rm==None): self.__rm = RoiManager()
self.__rm.add(self.__impD, roi, len(self.__iplist))
self.__cellsrois.append((roi, self.__impD.getCurrentSlice()))
#self.__rm.runCommand("Show All")
IJ.selectWindow(self.__impD.getTitle())
def __end(self, event):
if len(self.__iplist)==0 :
IJ.showMessage("", "Stack is empty")
return
self.__ipw=[ ip.getWidth() for ip in self.__iplist ]
self.__iph=[ ip.getHeight() for ip in self.__iplist ]
maxw=max(self.__ipw)
maxh=max(self.__iph)
if self.__enlarge :
resizelist = [ ip.resize(maxw, maxh, True) for ip in self.__iplist ]
else :
resizelist = []
for ip in self.__iplist :
tempip = ShortProcessor(maxw, maxh)
tempip.copyBits(ip, 0, 0, Blitter.COPY)
resizelist.append(tempip)
ims = ImageStack(maxw, maxh)
示例5: ImageStack
# 需要导入模块: from ij import ImagePlus [as 别名]
# 或者: from ij.ImagePlus import getWidth [as 别名]
print stackSource.getSize()
if doXYScale:
stack = ImageStack(int(round(imgSource.getWidth()*xyScale)), int(round(imgSource.getHeight()*xyScale)))
for z in xrange(stackSource.getSize()):
stack.addSlice(Filter.createDownsampled(
stackSource.getProcessor(z+1),
xyScale,
0.5,
0.5))
img = ImagePlus("", stack)
else:
img = imgSource
width = img.getWidth()
height = img.getHeight()
# img.show()
print img.getWidth(), img.getHeight(), img.getStack().getSize()
for c in correlationRanges:
correlationRange = c
homeScale = root.rstrip('/') + '/xyScale=%f' % xyScale
home = homeScale.rstrip('/') + '/range=%d_%s'.rstrip('/')
home = home % ( correlationRange, str(datetime.datetime.now() ) )
make_sure_path_exists( home.rstrip('/') + '/' )
options.comparisonRange = c
serializationString = '%s/correlations_range=%d.sr' % ( homeScale.rstrip(), correlationRange )