本文整理汇总了Python中lazyflow.utility.PathComponents.split方法的典型用法代码示例。如果您正苦于以下问题:Python PathComponents.split方法的具体用法?Python PathComponents.split怎么用?Python PathComponents.split使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lazyflow.utility.PathComponents
的用法示例。
在下文中一共展示了PathComponents.split方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: getPartiallyFormattedName
# 需要导入模块: from lazyflow.utility import PathComponents [as 别名]
# 或者: from lazyflow.utility.PathComponents import split [as 别名]
def getPartiallyFormattedName(self, lane_index, path_format_string):
''' Takes the format string for the output file, fills in the most important placeholders, and returns it '''
raw_dataset_info = self.dataSelectionApplet.topLevelOperator.DatasetGroup[lane_index][0].value
project_path = self.shell.projectManager.currentProjectPath
project_dir = os.path.dirname(project_path)
dataset_dir = PathComponents(raw_dataset_info.filePath).externalDirectory
abs_dataset_dir = make_absolute(dataset_dir, cwd=project_dir)
known_keys = {}
known_keys['dataset_dir'] = abs_dataset_dir
nickname = raw_dataset_info.nickname.replace('*', '')
if os.path.pathsep in nickname:
nickname = PathComponents(nickname.split(os.path.pathsep)[0]).fileNameBase
known_keys['nickname'] = nickname
known_keys['result_type'] = self.dataExportTrackingApplet.topLevelOperator.SelectedPlugin._value
# use partial formatting to fill in non-coordinate name fields
partially_formatted_name = format_known_keys(path_format_string, known_keys)
return partially_formatted_name
示例2: getPartiallyFormattedName
# 需要导入模块: from lazyflow.utility import PathComponents [as 别名]
# 或者: from lazyflow.utility.PathComponents import split [as 别名]
def getPartiallyFormattedName(self, lane_index: int, path_format_string: str) -> str:
''' Takes the format string for the output file, fills in the most important placeholders, and returns it '''
raw_dataset_info = self.topLevelOperator.RawDatasetInfo[lane_index].value
project_path = self.topLevelOperator.WorkingDirectory.value
dataset_dir = PathComponents(raw_dataset_info.filePath).externalDirectory
abs_dataset_dir = make_absolute(dataset_dir, cwd=project_path)
nickname = raw_dataset_info.nickname.replace('*', '')
if os.path.pathsep in nickname:
nickname = PathComponents(nickname.split(os.path.pathsep)[0]).fileNameBase
known_keys = {
'dataset_dir': abs_dataset_dir,
'nickname': nickname,
'result_type': self.topLevelOperator.SelectedPlugin._value,
}
return format_known_keys(path_format_string, known_keys)
示例3: post_process_lane_export
# 需要导入模块: from lazyflow.utility import PathComponents [as 别名]
# 或者: from lazyflow.utility.PathComponents import split [as 别名]
def post_process_lane_export(self, lane_index):
settings, selected_features = self.trackingApplet.topLevelOperator.getLane(lane_index).get_table_export_settings()
if settings:
self.dataExportApplet.progressSignal.emit(0)
raw_dataset_info = self.dataSelectionApplet.topLevelOperator.DatasetGroup[lane_index][0].value
project_path = self.shell.projectManager.currentProjectPath
project_dir = os.path.dirname(project_path)
dataset_dir = PathComponents(raw_dataset_info.filePath).externalDirectory
abs_dataset_dir = make_absolute(dataset_dir, cwd=project_dir)
known_keys = {}
known_keys['dataset_dir'] = abs_dataset_dir
nickname = raw_dataset_info.nickname.replace('*', '')
if os.path.pathsep in nickname:
nickname = PathComponents(nickname.split(os.path.pathsep)[0]).fileNameBase
known_keys['nickname'] = nickname
# use partial formatting to fill in non-coordinate name fields
name_format = settings['file path']
partially_formatted_name = format_known_keys( name_format, known_keys )
settings['file path'] = partially_formatted_name
req = self.trackingApplet.topLevelOperator.getLane(lane_index).export_object_data(
lane_index,
# FIXME: Even in non-headless mode, we can't show the gui because we're running in a non-main thread.
# That's not a huge deal, because there's still a progress bar for the overall export.
show_gui=False)
req.wait()
self.dataExportApplet.progressSignal.emit(100)
# Restore state of axis ranges
parameters = self.trackingApplet.topLevelOperator.Parameters.value
parameters['time_range'] = self.prev_time_range
parameters['x_range'] = self.prev_x_range
parameters['y_range'] = self.prev_y_range
parameters['z_range'] = self.prev_z_range
示例4: create_default_headless_dataset_info
# 需要导入模块: from lazyflow.utility import PathComponents [as 别名]
# 或者: from lazyflow.utility.PathComponents import split [as 别名]
def create_default_headless_dataset_info(cls, filepath):
"""
filepath may be a globstring or a full hdf5 path+dataset
"""
comp = PathComponents(filepath)
nickname = comp.filenameBase
# Remove globstring syntax.
if '*' in nickname:
nickname = nickname.replace('*', '')
if os.path.pathsep in nickname:
nickname = PathComponents(nickname.split(os.path.pathsep)[0]).fileNameBase
info = DatasetInfo()
info.location = DatasetInfo.Location.FileSystem
info.nickname = nickname
info.filePath = filepath
# Convert all (non-url) paths to absolute
# (otherwise they are relative to the project file, which probably isn't what the user meant)
if not isUrl(filepath):
comp.externalPath = os.path.abspath(comp.externalPath)
info.filePath = comp.totalPath()
return info
示例5: setupOutputs
# 需要导入模块: from lazyflow.utility import PathComponents [as 别名]
# 或者: from lazyflow.utility.PathComponents import split [as 别名]
def setupOutputs(self):
self.cleanupOnDiskView()
# FIXME: If RawData becomes unready() at the same time as RawDatasetInfo(), then
# we have no guarantees about which one will trigger setupOutputs() first.
# It is therefore possible for 'RawDatasetInfo' to appear ready() to us,
# even though it's upstream partner is UNready. We are about to get the
# unready() notification, but it will come too late to prevent our
# setupOutputs method from being called.
# Without proper graph setup transaction semantics, we have to use this
# hack as a workaround.
try:
rawInfo = self.RawDatasetInfo.value
except:
for oslot in self.outputs.values():
if oslot.partner is None:
oslot.meta.NOTREADY = True
return
selection_index = self.InputSelection.value
if not self.Inputs[selection_index].ready():
for oslot in self.outputs.values():
if oslot.partner is None:
oslot.meta.NOTREADY = True
return
self._opFormattedExport.Input.connect( self.Inputs[selection_index] )
dataset_dir = PathComponents(rawInfo.filePath).externalDirectory
abs_dataset_dir, _ = getPathVariants(dataset_dir, self.WorkingDirectory.value)
known_keys = {}
known_keys['dataset_dir'] = abs_dataset_dir
nickname = rawInfo.nickname.replace('*', '')
if '//' in nickname:
nickname = PathComponents(nickname.split('//')[0]).fileNameBase
known_keys['nickname'] = nickname
# Disconnect to open the 'transaction'
if self._opImageOnDiskProvider is not None:
self._opImageOnDiskProvider.TransactionSlot.disconnect()
self._opFormattedExport.TransactionSlot.disconnect()
# Blank the internal path while we manipulate the external path
# to avoid invalid intermediate states of ExportPath
self._opFormattedExport.OutputInternalPath.setValue( "" )
# use partial formatting to fill in non-coordinate name fields
name_format = self.OutputFilenameFormat.value
partially_formatted_name = format_known_keys( name_format, known_keys )
# Convert to absolute path before configuring the internal op
abs_path, _ = getPathVariants( partially_formatted_name, self.WorkingDirectory.value )
self._opFormattedExport.OutputFilenameFormat.setValue( abs_path )
# use partial formatting on the internal dataset name, too
internal_dataset_format = self.OutputInternalPath.value
partially_formatted_dataset_name = format_known_keys( internal_dataset_format, known_keys )
self._opFormattedExport.OutputInternalPath.setValue( partially_formatted_dataset_name )
# Re-connect to finish the 'transaction'
self._opFormattedExport.TransactionSlot.connect( self.TransactionSlot )
if self._opImageOnDiskProvider is not None:
self._opImageOnDiskProvider.TransactionSlot.connect( self.TransactionSlot )
self.setupOnDiskView()