当前位置: 首页>>代码示例>>Python>>正文


Python ImagePlus.setProcessor方法代码示例

本文整理汇总了Python中ij.ImagePlus.setProcessor方法的典型用法代码示例。如果您正苦于以下问题:Python ImagePlus.setProcessor方法的具体用法?Python ImagePlus.setProcessor怎么用?Python ImagePlus.setProcessor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ij.ImagePlus的用法示例。


在下文中一共展示了ImagePlus.setProcessor方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: Random

# 需要导入模块: from ij import ImagePlus [as 别名]
# 或者: from ij.ImagePlus import setProcessor [as 别名]
Random().nextBytes(imp.getProcessor().getPixels())
imp.show()

# Example watershed
# 1 - Obtain an image
blobs = IJ.openImage("http://imagej.net/images/blobs.gif")
# IJ.run(blobs, "Histogram", "")

# Make a copy with the same properties as blobs image:
imp = blobs.createImagePlus()
hwin = HistogramWindow(blobs)
plotimage = hwin.getImagePlus()


ip = blobs.getProcessor().duplicate()
imp.setProcessor("blobs copy", ip)
 
# 2 - Apply a threshold: only zeros and ones
# Set the desired threshold range: keep from 0 to 74
ip.setThreshold(147, 147, ImageProcessor.NO_LUT_UPDATE)
# Call the Thresholder to convert the image to a mask
IJ.run(imp, "Convert to Mask", "")
 
# 3 - Apply watershed
# Create and run new EDM object, which is an Euclidean Distance Map (EDM)
# and run the watershed on the ImageProcessor:
EDM().toWatershed(ip)
 
# 4 - Show the watersheded image:
imp.show()
开发者ID:jrminter,项目名称:OSImageAnalysis,代码行数:32,代码来源:exemplarOne_.py

示例2: len

# 需要导入模块: from ij import ImagePlus [as 别名]
# 或者: from ij.ImagePlus import setProcessor [as 别名]
		gd.showDialog()

	## Does simple interpolation of the ROIs through the stack
	if len(sliceList)>0:
		sliceList.sort(reverse=True)
		for sl in range(theImage.getNSlices()):
			if (sl+1) < sliceList[-1]:
				maskImage.setSliceWithoutUpdate(sliceList[-1])
				activeIp = maskImage.getProcessor().duplicate()
			elif (sl+1) > sliceList[0]:
				maskImage.setSliceWithoutUpdate(sliceList[0])
				activeIp = maskImage.getProcessor().duplicate()
			else:
				isFound = False
				for mark in sliceList:
					dist = sl+1 - mark
					if dist >= 0 and not isFound:
						isFound = True
						refSlice = mark
				maskImage.setSliceWithoutUpdate(refSlice)
				activeIp = maskImage.getProcessor().duplicate()
			maskImage.setSliceWithoutUpdate(sl+1)
			maskImage.setProcessor(activeIp)

	## Computes the overlay image
	ic = ImageCalculator()
	resultImage = ic.run("AND create stack",theImage,maskImage)
	resultImage.show()

	maskImage.close()
开发者ID:stalepig,项目名称:deep-mucosal-imaging,代码行数:32,代码来源:Isolate_stack_ROI.py

示例3: makeMask

# 需要导入模块: from ij import ImagePlus [as 别名]
# 或者: from ij.ImagePlus import setProcessor [as 别名]
	def makeMask(self):
		"""
		This function makes the mask. The steps are (1) Minimum Filter - makes a darker boundary around beads (2) Autothresholding using the Huang algorithm - has some fuzzy logic and seems to work (3) Analyze particles with a size between 500-50000 and 
		circularity between 0.4 to 1.0; The mask generated is sometimes black on beads and white around. Then I need to invert the LUTs
		"""
	
		ipOriginal = self.stack.getProcessor(self.DIC_index)
		ip = ipOriginal.duplicate()
		imgUpdate = ImagePlus("New",ip)
		imgUpdate.setProcessor("Mask",ip)
		
		img0 = ImagePlus("Before",ipOriginal)
		img0.show()
		
		# Minimum filter
		RankFilters().rank(ip,2,RankFilters.MIN)
		img1 = ImagePlus("Filter",ip)
		# Autothreshold - Huang algorithm
		hist = ip.getHistogram()
		lowTH = Auto_Threshold.Huang(hist)
		ip.setThreshold(0,lowTH, ImageProcessor.BLACK_AND_WHITE_LUT)
		img3 = ImagePlus("Thresholded",ip)
		img3.show()

		# Making a binary mask
		IJ.run(img3,"Convert to Mask","")
		
		if self._dialog("Invert Mask ??") is True: IJ.run("Invert LUT")
		img3.updateAndDraw()
		
		# The true mask after Particle Analysis; Creates a mask image around the particles
		IJ.run(img3,"Analyze Particles...", "size=500-50000 circularity=0.40-1.00 show=Masks")
		img1.close()
		#img3.close()

		# Editing the masks (filling holes and dilating it twice)
		imgActive = IJ.getImage()
		IJ.run(imgActive,"Convert to Mask","")
		IJ.run(imgActive,"Fill Holes","")
		for i in range(8): IJ.run(imgActive,"Dilate","")
		ipActive = imgActive.getProcessor().convertToFloat()
		
		# Saving the mask
		maskFname = self.sourceDir + "\\" + self.title + '_mask'
		IJ.saveAs(imgActive, "PNG", maskFname)
				
		# Confirming that the image is masked and the histogram is correct
		#IJ.run(imgActive, "Histogram", "")
		
		#stats = ipActive.getStatistics()
		pixels = ipActive.getPixels()
		self.maskPixels = [pix/255 for pix in pixels]
		self.areaMask = self.maskPixels.count(1)

		# Checking if the image is fine. If not, returns option to skip
		ImageCalculator().calculate("zero create", img0, imgActive)

		skip = False
		if self._dialog("Skip Image ??") is True: skip = True

		IJ.run("Close All")
		return self.maskPixels, skip
开发者ID:jagannath,项目名称:imageAnalysis,代码行数:64,代码来源:maskingBeads_autothreshold_v1_fiji.py


注:本文中的ij.ImagePlus.setProcessor方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。