本文整理汇总了Python中ij.WindowManager.getFrame方法的典型用法代码示例。如果您正苦于以下问题:Python WindowManager.getFrame方法的具体用法?Python WindowManager.getFrame怎么用?Python WindowManager.getFrame使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ij.WindowManager
的用法示例。
在下文中一共展示了WindowManager.getFrame方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: readResults
# 需要导入模块: from ij import WindowManager [as 别名]
# 或者: from ij.WindowManager import getFrame [as 别名]
def readResults(windowTitle):
textPanel = WindowManager.getFrame(windowTitle).getTextPanel()
headings = textPanel.getColumnHeadings()
"get results from TextWindow with java.lang.string title"
resolver = re.compile('\d+\t(?P<frame>\d+\.0+)\t(?P<fsDistance>\d+\.\d+)\t(?P<ffDistance>\d+\.\d+)\t(?P<ssDistance>\d+\.\d+)\t(?P<fVol>\d+\.\d+)\t(?P<sVol>\d+\.\d+)')
frameA = []
distA = []
volFcA = []
volScA = []
#xFcA, yFcA, zFcA, xScA, yScA, zScA
resPnl = WindowManager.getFrame(windowTitle).getTextPanel()
for row in range(resPnl.getLineCount()):
mo = resolver.match(resPnl.getLine(row))
frameA.append(int(float(mo.group('frame'))))
distA.append(mo.group("fsDistance"))
volFcA.append(mo.group("fVol"))
volScA.append(mo.group("sVol"))
return frameA, distA, volFcA, volScA
示例2: update_menus
# 需要导入模块: from ij import WindowManager [as 别名]
# 或者: from ij.WindowManager import getFrame [as 别名]
def update_menus():
try:
IJ.redirectErrorMessages()
IJ.run('Update Menus')
except:
error_message = 'Error updating menus'
logWindow = WindowManager.getFrame("Log")
if not logWindow is None:
error_message = error_message + ': ' \
+ logWindow.getTextPanel().getText()
logWindow.close()
print error_message
global error
error += 1
示例3: round
# 需要导入模块: from ij import WindowManager [as 别名]
# 或者: from ij.WindowManager import getFrame [as 别名]
timeInterval = round(calibration.frameInterval)
#start measurement
splitCh = CS.split(imp) # split channels
#try:
ATA().segAndMeasure(splitCh[0], splitCh[1]) # perform segmentation and measurement
#else: go to next element in moFileList
# move image to "segProblem" folder
# continue
WindowManager.getImage("binProjMerged").close()
WindowManager.getImage("DUP_C1-"+image.group()).close()
WindowManager.getImage("DUP_C2-"+image.group()).close()
# read the measurements from results tables.
distance_lines = WindowManager.getFrame("Statistics_Distance").getTextPanel().getText().split("\n")
ch0_dots = tableToDots(WindowManager.getFrame("Statistics_Ch0").getTextPanel().getText().split("\n"), 0)
ch1_dots = tableToDots(WindowManager.getFrame("Statistics_Ch1").getTextPanel().getText().split("\n"), 1)
WindowManager.getFrame("Statistics_Distance").close(False)
WindowManager.getFrame("Statistics_Ch0").close(False)
WindowManager.getFrame("Statistics_Ch1").close(False)
frameList = []
for l in distance_lines[1:len(distance_lines)-1]:
index, frame, distance, ch0dist, ch1dist, ch0vol, ch1vol = l.split("\t")
# find respective frame in ch0 and ch1 dot list. Problem, if both dots have same volume. Vol can be identical!
ch0DotList = dotListToSingle( [d for d in ch0_dots if (d.getFrame() == int(float(frame)) and d.getVol() == int(float(ch0vol)) )] )
ch1DotList = dotListToSingle( [d for d in ch1_dots if (d.getFrame() == int(float(frame)) and d.getVol() == int(float(ch1vol)) )] )
frameList.append(fr(frame, distance, ch0DotList, ch1DotList))
示例4: float
# 需要导入模块: from ij import WindowManager [as 别名]
# 或者: from ij.WindowManager import getFrame [as 别名]
from ij import IJ, WindowManager
from ij.measure import ResultsTable
from ij.text import TextWindow
bClose = True
IJ.run("Blobs (25K)")
imp = IJ.getImage()
IJ.setAutoThreshold(imp, "Default")
IJ.run(imp, "Convert to Mask", "")
IJ.run(imp, "Set Measurements...", "area center redirect=None decimal=3")
IJ.run(imp, "Analyze Particles...", "display exclude clear include summarize")
tw = WindowManager.getFrame("Summary")
if tw != None:
st = tw.getTextPanel().getResultsTable()
IJ.log("1st row of Summary:\n"+ st.getRowAsString(0))
v = st.getCounter()
w = st.getLastColumn()
s = st.size()
z = st.getValueAsDouble(w, 0)
af = float(z)
af /= 100.
print("Area Fraction: %.3f" % af)
else:
IJ.log("Summary window not found")
if bClose:
示例5: mkdir
# 需要导入模块: from ij import WindowManager [as 别名]
# 或者: from ij.WindowManager import getFrame [as 别名]
mkdir(saveFolder)
for image in moFileList:
print "starting with cell " + image.group() + " " + "("+ str(moFileList.index(image)) + "/" + str(len(moFileList)) + ")"
imp = Opener().openImage(path + image.group()) # open Image
cal = imp.getCalibration()
splitCh = CS.split(imp) # split channels
#try:
ATA().segAndMeasure(splitCh[0], splitCh[1]) # perform segmentation and measurement
#else: go to next element in moFileList
WindowManager.getImage("binProjMerged").close()
WindowManager.getImage("DUP_C1-"+image.group()).close()
WindowManager.getImage("DUP_C2-"+image.group()).close()
frameA, distA, volFcA, volScA = readResults("Statistics_Distance") # get results from "Statistics_Distance" window
WindowManager.getFrame("Statistics_Distance").close(False)
frameA, distA, volFcA, volScA = fillUpFrames(frameA, distA, volFcA, volScA)
tw = makeTw(imp, frameA, distA, volFcA, volScA)
tw.getTextPanel().saveAs(saveFolder +"/val_" + image.group('name') + ".tsv") # save filledup results as text
WindowManager.getFrame("Summary").close(False)
WindowManager.getFrame("Statistics_Ch0").close(False)
WindowManager.getFrame("Statistics_Ch1").close(False)
detDots = WindowManager.getImage("DetectedDots")
detDots.copyScale(imp)
IJ.saveAs(detDots, ".tiff", saveFolder + "/zi_"+image.group('name')) # save the overlay with connecting line
print "Saving as " + image.group('name')
示例6: ImageJ
# 需要导入模块: from ij import WindowManager [as 别名]
# 或者: from ij.WindowManager import getFrame [as 别名]
'Plugins, "Cello", xyz' + "\n" +
'Plugins, "Abracadabra", abc')
# reset the plugins folder to the temporary directory
System.setProperty('plugins.dir', temporary_folder);
# Launch ImageJ
IJ.redirectErrorMessages()
ij = ImageJ()
error = 0
# Must show Duplicate command error
logWindow = WindowManager.getFrame("Log")
if logWindow is None:
print 'No error adding duplicate entries'
error += 1
else:
logText = logWindow.getTextPanel().getText()
if not 'Duplicate command' in logText:
print 'Error adding duplicate entries, but the wrong one'
error += 1
logWindow.close()
# debug functions
def printMenu(menu, indent):
n = menu.getItemCount()
for i in range(0, n):
示例7: range
# 需要导入模块: from ij import WindowManager [as 别名]
# 或者: from ij.WindowManager import getFrame [as 别名]
list_x2.append( x2 )
#
#
#3D OBJECTS COUNTER
for i in range(stepNumber):
x2 = list_x2[i]
x2_aux = x2.duplicate()
x2_aux.setTitle('x2_aux')
#run("3D OC Options", "volume surface nb_of_obj._voxels nb_of_surf._voxels integrated_density mean_gray_value std_dev_gray_value median_gray_value minimum_gray_value maximum_gray_value centroid mean_distance_to_surface std_dev_distance_to_surface median_distance_to_surface centre_of_mass bounding_box show_masked_image_(redirection_requiered) dots_size=5 font_size=10 store_results_within_a_table_named_after_the_image_(macro_friendly) redirect_to=x1")
arguments = "volume centroid bounding_box show_masked_image_(redirection_requiered) dots_size=5 font_size=10 store_results_within_a_table_named_after_the_image_(macro_friendly) redirect_to=x2_aux"
IJ.run("3D OC Options", arguments)
IJ.run(x2, "3D Objects Counter", "threshold=0 slice=0 min.=" + repr(p3DOCmin)+" max.=" + repr(p3DOCmax)+ " exclude_objects_on_edges objects statistics")
#Obtengo la salida estadística de 3D Objects Counter
title_x2 = x2.getTitle()
winStats =WindowManager.getFrame("Statistics for "+title_x2)#tomo la ventana con las estadísticas generadas
textStats = winStats.getTextPanel()#tomo el texto de la ventana
textStats.saveAs( resultsFileStats )#Guardo externamente la tabla y luego la levanto con GetParameters( resultsFileStats )
index, vox, X, Y, Z, Bx, By, Bz, B-width, B-height, B-depth = GetParameters( resultsFileStats )
#guardo la mascara en list_x3
IJ.selectWindow("Objects map of x2_"+repr(i))
img = IJ.getImage()
mask = img.duplicate()#al cerrar la ventana img al final del ciclo for se borran los datos que contiene img aunque no se avisa de esto, por lo tanto si se quiere guardar alguna ventana abierta hay que guardar un duplicado para no tener problemas
mask.setTitle('mask_'+repr(i))
list_x3.append( mask )#almaceno la mascara en la lista correspondiente
#cierro ventanas que no preciso
x2_aux.close()
img.close()
#