def dialog(imp2, labelColorBarImp):
	gd = GenericDialogPlus("ROI labeller")
	categories=11

	#placeholder slider variables so the class can be initiated
	slider1=0
	slider2=0	
	slider3=0
	slider4=0
	test=previewLabelerAndListeners(imp2, slider1,slider2,slider3,slider4, gd)
	

	for i in range(1,categories):
		gd.addButton("label "+str(i), test)
		
	gd.addImage(labelColorBarImp)
	#imp7.close() - causes an error as image needed for the dialog
	gd.addButton("Set top",test)
	gd.addButton("Whole stack",test)
	gd.addButton("Set bottom", test)
	

	
	gd.addSlider("Top",1, imp2.getStackSize(), 1)
	gd.addSlider("Bottom",1, imp2.getStackSize(),imp2.getStackSize())
	gd.addSlider("Minimum ROI size", 0, 9999, 0, 1)
	gd.addSlider("Maximum ROI size", 1, 10000, 10000, 1)

	slider1=gd.getSliders().get(0)
	slider2=gd.getSliders().get(1)
	test.slider1=slider1
	test.slider2=slider2
	slider3=gd.getSliders().get(2)
	slider4=gd.getSliders().get(3)
	test.slider3=slider3
	test.slider4=slider4
	slider1.addAdjustmentListener(test)  
	slider2.addAdjustmentListener(test)
	slider3.addAdjustmentListener(test)  
	slider4.addAdjustmentListener(test)

	gd.addChoice("Apply labeling to:", ["(Sub)stack", "Slice"], "(Sub)stack")



	
	gd.setLayout(GridLayout(0,2))
	
	gd.setModal(False)
	buttons=gd.getButtons()

	gd.showDialog()


	while ((not gd.wasCanceled()) and not (gd.wasOKed())):
		Thread.sleep(50)	
	return test
def selectionDialog(categories,labelColorBarImp):
	gd = GenericDialogPlus("ROI labeller -image picking")
	imps = WM.getImageTitles()
	nonimages=WM.getNonImageTitles()
	
	gd.addChoice("Image to quantify", imps, imps[0])
	try:
		gd.addChoice("FRETENTATOR results table", nonimages, nonimages[0])
		fail=0
	except:
		gd.addMessage("No results table open")
		fail=1
	gd.addImage(labelColorBarImp)
	for i in range(categories):
		gd.addStringField("Label "+str(i) +" name:", "Label "+str(i))

	gd.addChoice("Quantify an open image or add labels to open results table?", ["Image", "Results table"], "Results table")
	
	#quantImp= IJ.getImage(gd.getNextChoice())
	
	
	gd.setModal(False)
	gd.showDialog()
	while ((not gd.wasCanceled()) and not (gd.wasOKed())):
		Thread.sleep(50)


	names=dict()
	
	for i in range(categories):
		names[i]=str(gd.getNextString())
	imageName=gd.getNextChoice()
	if fail==0:	
		resultsName=gd.getNextChoice()
		imageOrTable=gd.getNextChoice()
	else:
		imageOrTable="Image"
		resultsName=0
	return names, imageName, resultsName, imageOrTable
예제 #3
0
                         percentileTop, "clip", clip, "showProgressDialog",
                         showProgressDialog, "modelFile", modelFile)).get()
    myoutput = mymod.getOutput("output")
    io.save(myoutput, savepLMfilepath)


runNetwork(saveEMfilepath, savepLMfilepath)

# open pLM image
pLM = IJ.openImage(savepLMfilepath)

# display precicted image

gd = GenericDialogPlus("Options")
gd.addMessage("groundtruth SEM image:")
gd.addImage(EM)
gd.addMessage("prediction Chromatin:")
gd.addImage(pLM)
gd.showDialog()

# resize and save pLM image
pLM.setProcessor(pLM.getTitle(), pLM.getProcessor().resize(width, height))
fs = FileSaver(pLM)
fs.saveAsTiff(savepLMfilepath)

# save rLM image
rLM = IJ.openImage(rLMfilepath)
saverLMfilepath = os.path.join(workdir, "registration_input", "rLM.tif")
fs = FileSaver(rLM)
fs.saveAsTiff(saverLMfilepath)