本文整理汇总了Python中ilastik.applets.dataSelection.opDataSelection.DatasetInfo.updateFromJson方法的典型用法代码示例。如果您正苦于以下问题:Python DatasetInfo.updateFromJson方法的具体用法?Python DatasetInfo.updateFromJson怎么用?Python DatasetInfo.updateFromJson使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ilastik.applets.dataSelection.opDataSelection.DatasetInfo
的用法示例。
在下文中一共展示了DatasetInfo.updateFromJson方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: onProjectLoaded
# 需要导入模块: from ilastik.applets.dataSelection.opDataSelection import DatasetInfo [as 别名]
# 或者: from ilastik.applets.dataSelection.opDataSelection.DatasetInfo import updateFromJson [as 别名]
def onProjectLoaded(self, projectManager):
"""
Overridden from Workflow base class. Called by the Project Manager.
- Use the parameter json file provided on the command line to populate the project's input data settings.
- Also set the annotation file location.
- Run the preprocessing step.
- Save the project.
"""
if self._split_tool_params is None:
return
# -- Data Selection
opDataSelection = self.dataSelectionApplet.topLevelOperator
# If there is already data in this project, don't touch it.
if len(opDataSelection.DatasetGroup) > 0:
logger.warn("Not changing project data, because your project appears to have data already.")
else:
opDataSelection.DatasetGroup.resize(1)
for role, data_params in [ ( self.DATA_ROLE_RAW, self._split_tool_params.raw_data_info ),
( self.DATA_ROLE_PIXEL_PROB, self._split_tool_params.pixel_probabilities_info ),
( self.DATA_ROLE_RAVELER_LABELS, self._split_tool_params.raveler_labels_info ) ]:
logger.debug( "Configuring dataset for role {}".format( role ) )
logger.debug( "Params: {}".format(data_params) )
datasetInfo = DatasetInfo()
datasetInfo.updateFromJson( data_params )
# Check for globstring, which means we need to import the stack first.
if '*' in datasetInfo.filePath:
totalProgress = [-100]
def handleStackImportProgress( progress ):
if progress / 10 != totalProgress[0] / 10:
totalProgress[0] = progress
logger.info( "Importing stack: {}%".format( totalProgress[0] ) )
serializer = self.dataSelectionApplet.dataSerializers[0]
serializer.progressSignal.connect( handleStackImportProgress )
serializer.importStackAsLocalDataset( datasetInfo )
opDataSelection.DatasetGroup[0][ role ].setValue( datasetInfo )
# -- Split settings (annotation file)
opSplitBodyCarving = self.splitBodyCarvingApplet.topLevelOperator.getLane(0)
opSplitBodyCarving.AnnotationFilepath.setValue( self._split_tool_params.raveler_bookmarks_file )
# -- Preprocessing settings
opPreprocessing = self.preprocessingApplet.topLevelOperator.getLane(0)
opPreprocessing.Sigma.setValue(1.0)
opPreprocessing.Filter.setValue( OpFilter.RAW )
# Run preprocessing
def showProgress( progress ):
logger.info( "Preprocessing Progress: {}%".format( progress ) )
self.preprocessingApplet.progressSignal.connect( showProgress )
opPreprocessing.PreprocessedData[:].wait()
logger.info("Preprocessing Complete")
logger.info("Saving project...")
projectManager.saveProject()
# Special FlyEM supervoxelized body export:
if self._split_tool_params.supervoxelized_bodies_export_path is not None:
opSupervoxelExport = self.splitBodySupervoxelExportApplet.topLevelOperator.getLane(0)
def showExportProgress( progress ):
logger.info( "Supervoxelized Body Export Progress: {}%".format( progress ) )
req = opSupervoxelExport.exportFinalSupervoxels( self._split_tool_params.supervoxelized_bodies_export_path,
'zyx',
progressCallback=showExportProgress )
req.wait()
logger.info("FINISHED")