本文整理汇总了Python中ij.WindowManager.closeAllWindows方法的典型用法代码示例。如果您正苦于以下问题:Python WindowManager.closeAllWindows方法的具体用法?Python WindowManager.closeAllWindows怎么用?Python WindowManager.closeAllWindows使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ij.WindowManager
的用法示例。
在下文中一共展示了WindowManager.closeAllWindows方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: analyze
# 需要导入模块: from ij import WindowManager [as 别名]
# 或者: from ij.WindowManager import closeAllWindows [as 别名]
def analyze(tempFile):
# Get currently selected image
#imp = WindowManager.getCurrentImage()
imp = IJ.openImage(tempFile)
imp.show()
dims = imp.getDimensions();
imp.setDimensions(dims[2], dims[4], dims[3]);
#----------------------------
# Create the model object now
#----------------------------
# Some of the parameters we configure below need to have
# a reference to the model at creation. So we create an
# empty model now.
model = Model()
# Send all messages to ImageJ log window.
model.setLogger(Logger.IJ_LOGGER)
#------------------------
# Prepare settings object
#------------------------
settings = Settings()
settings.setFrom(imp)
print(settings.imageFileName)
# Configure detector - We use the Strings for the keys
settings.detectorFactory = LogDetectorFactory()
settings.detectorSettings = {
'DO_SUBPIXEL_LOCALIZATION' : False,
'RADIUS' : 20.,
'TARGET_CHANNEL' : 1,
'THRESHOLD' : 0.95,
'DO_MEDIAN_FILTERING' : True,
}
# Configure spot filters - Classical filter on quality
#filter1 = FeatureFilter('QUALITY', 0.5, True)
#settings.addSpotFilter(filter1)
# Configure tracker - We want to allow merges and fusions
settings.trackerFactory = SimpleSparseLAPTrackerFactory()
settings.trackerSettings = LAPUtils.getDefaultLAPSettingsMap() #probably good enough
#settings.trackerSettings['ALLOW_TRACK_SPLITTING'] = False
#settings.trackerSettings['ALLOW_TRACK_MERGING'] = False
settings.trackerSettings['LINKING_MAX_DISTANCE'] = 35.0
settings.trackerSettings['GAP_CLOSING_MAX_DISTANCE']= 60.0
settings.trackerSettings['MAX_FRAME_GAP']= 2
# Configure track analyzers - Later on we want to filter out tracks
# based on their displacement, so we need to state that we want
# track displacement to be calculated. By default, out of the GUI,
# not features are calculated.
# The displacement feature is provided by the TrackDurationAnalyzer.
settings.addTrackAnalyzer(TrackDurationAnalyzer())
#-------------------
# Instantiate plugin
#-------------------
trackmate = TrackMate(model, settings)
ok = trackmate.process()
if not ok:
sys.exit(str(trackmate.getErrorMessage()))
#----------------
# Display results
#----------------
selectionModel = SelectionModel(model)
displayer = HyperStackDisplayer(model, selectionModel, imp)
displayer.render()
displayer.refresh()
# Echo results with the logger we set at start:
model.getLogger().log(str(model))
print(str(settings))
filename = os.path.splitext(settings.imageFileName)
pathname = settings.imageFolder + "" + filename[0] + "tracks.xml"
guicontroller = TrackMateGUIController(trackmate)
newFile = File(pathname)
ExportTracksToXML(guicontroller).export(model, settings, newFile)
actionObject = CaptureOverlayAction()
actionObject.execute(trackmate)
imp = WindowManager.getCurrentImage()
fileSaver = FileSaver(imp)
fileSaver.saveAsTiffStack(settings.imageFolder + "" + filename[0] + "overlay.tif")
WindowManager.closeAllWindows()
guicontroller.quit()
selectionModel.clearSelection();
model.clearTracks(1)