本文整理汇总了Python中ilastik.applets.dataSelection.opDataSelection.DatasetInfo.filePath方法的典型用法代码示例。如果您正苦于以下问题:Python DatasetInfo.filePath方法的具体用法?Python DatasetInfo.filePath怎么用?Python DatasetInfo.filePath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ilastik.applets.dataSelection.opDataSelection.DatasetInfo
的用法示例。
在下文中一共展示了DatasetInfo.filePath方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: debug_with_new
# 需要导入模块: from ilastik.applets.dataSelection.opDataSelection import DatasetInfo [as 别名]
# 或者: from ilastik.applets.dataSelection.opDataSelection.DatasetInfo import filePath [as 别名]
def debug_with_new(shell):
"""
(Function for debug and testing.)
"""
#projFilePath = "/magnetic/synapse_debug_data/object_prediction.ilp"
projFilePath = "/magnetic/stuart_object_predictions.ilp"
# New project
shell.createAndLoadNewProject(projFilePath)
workflow = shell.projectManager.workflow
# Add a file
from ilastik.applets.dataSelection.opDataSelection import DatasetInfo
rawInfo = DatasetInfo()
#rawInfo.filePath = '/magnetic/synapse_debug_data/block256.h5/cube'
#rawInfo.filePath = '/magnetic/synapse_small_4d.h5/volume/data'
rawInfo.filePath = '/magnetic/validation_slices_20_40_3200_4000_1200_2000.h5/volume/data'
opRawDataSelection = workflow.rawDataSelectionApplet.topLevelOperator
opRawDataSelection.Dataset.resize(1)
opRawDataSelection.Dataset[0].setValue(rawInfo)
predictionInfo = DatasetInfo()
#predictionInfo.filePath = '/magnetic/synapse_debug_data/block256_spots_predictions.h5/cube'
#predictionInfo.filePath = '/magnetic/synapse_small_4d_synapse_predictions.h5/volume/data'
predictionInfo.filePath = '/magnetic/validation_slices_20_40_3200_4000_1200_2000_pred.h5/volume/data'
opPredDataSelection = workflow.predictionSelectionApplet.topLevelOperator
opPredDataSelection.Dataset.resize(1)
opPredDataSelection.Dataset[0].setValue(predictionInfo)
# Select the feature drawer
shell.setSelectedAppletDrawer(2)
示例2: testBasic
# 需要导入模块: from ilastik.applets.dataSelection.opDataSelection import DatasetInfo [as 别名]
# 或者: from ilastik.applets.dataSelection.opDataSelection.DatasetInfo import filePath [as 别名]
def testBasic(self):
graph = lazyflow.graph.Graph()
reader = OperatorWrapper( OpDataSelection, graph=graph )
reader.ProjectFile.setValue(self.projectFile)
reader.WorkingDirectory.setValue( os.getcwd() )
reader.ProjectDataGroup.setValue( 'DataSelection/local_data' )
# Create a list of dataset infos . . .
datasetInfos = []
# npy
info = DatasetInfo()
# Will be read from the filesystem since the data won't be found in the project file.
info.location = DatasetInfo.Location.ProjectInternal
info.filePath = self.testNpyFileName
info.internalPath = ""
info.invertColors = False
info.convertToGrayscale = False
datasetInfos.append(info)
# png
info = DatasetInfo()
info.location = DatasetInfo.Location.FileSystem
info.filePath = self.testPngFileName
info.internalPath = ""
info.invertColors = False
info.convertToGrayscale = False
datasetInfos.append(info)
reader.Dataset.setValues(datasetInfos)
# Read the test files using the data selection operator and verify the contents
npyData = reader.Image[0][...].wait()
pngData = reader.Image[1][...].wait()
# Check the file name output
print reader.ImageName[0].value
assert reader.ImageName[0].value == self.testNpyFileName
assert reader.ImageName[1].value == self.testPngFileName
# Check raw images
assert npyData.shape == (10,11,1)
for x in range(npyData.shape[0]):
for y in range(npyData.shape[1]):
assert npyData[x,y,0] == x+y
assert pngData.shape == (100, 200, 3)
for x in range(pngData.shape[0]):
for y in range(pngData.shape[1]):
for c in range(pngData.shape[2]):
assert pngData[x,y,c] == (x+y) % 256
示例3: test_real_data_source
# 需要导入模块: from ilastik.applets.dataSelection.opDataSelection import DatasetInfo [as 别名]
# 或者: from ilastik.applets.dataSelection.opDataSelection.DatasetInfo import filePath [as 别名]
def test_real_data_source(self):
graph = lazyflow.graph.Graph()
reader = OperatorWrapper(OpDataSelection, graph=graph,
operator_kwargs={'forceAxisOrder': False})
reader.ProjectFile.setValue(self.projectFile)
reader.WorkingDirectory.setValue(os.getcwd())
reader.ProjectDataGroup.setValue('DataSelection/local_data')
info = DatasetInfo()
# Will be read from the filesystem since the data won't be found in the project file.
info.location = DatasetInfo.Location.ProjectInternal
info.filePath = self.testRawDataFileName
info.internalPath = ""
info.invertColors = False
info.convertToGrayscale = False
#Use real data source
info.realDataSource = True
reader.Dataset.setValues([info])
# Read the test file using the data selection operator and verify the contents
imgData = reader.Image[0][...].wait()
assert imgData.shape == self.imgData.shape
numpy.testing.assert_array_equal(imgData, self.imgData)
示例4: test_fake_data_source
# 需要导入模块: from ilastik.applets.dataSelection.opDataSelection import DatasetInfo [as 别名]
# 或者: from ilastik.applets.dataSelection.opDataSelection.DatasetInfo import filePath [as 别名]
def test_fake_data_source(self):
graph = lazyflow.graph.Graph()
reader = OperatorWrapper(OpDataSelection, graph=graph,
operator_kwargs={'forceAxisOrder': False})
reader.ProjectFile.setValue(self.projectFile)
reader.WorkingDirectory.setValue(os.getcwd())
reader.ProjectDataGroup.setValue('DataSelection/local_data')
info = DatasetInfo()
# Will be read from the filesystem since the data won't be found in the project file.
info.location = DatasetInfo.Location.ProjectInternal
info.filePath = self.testRawDataFileName
info.internalPath = ""
info.invertColors = False
info.convertToGrayscale = False
# Use *fake* data source
info.realDataSource = False
info.axistags = vigra.defaultAxistags('tczyx')
info.laneShape = self.imgData.shape
info.laneDtype = self.imgData.dtype
reader.Dataset.setValues([info])
# Verify that now data selection operator returns fake data
# with expected shape and type
imgData = reader.Image[0][...].wait()
assert imgData.shape == self.imgData.shape
assert imgData.dtype == self.imgData.dtype
expected_fake_data = numpy.zeros(info.laneShape, dtype=info.laneDtype)
numpy.testing.assert_array_equal(imgData, expected_fake_data)
示例5: testBasic3DcStackFromGlobString
# 需要导入模块: from ilastik.applets.dataSelection.opDataSelection import DatasetInfo [as 别名]
# 或者: from ilastik.applets.dataSelection.opDataSelection.DatasetInfo import filePath [as 别名]
def testBasic3DcStackFromGlobString(self):
"""Test if stacked 2d 3-channel files are loaded correctly"""
# For some reason vigra saves 2D+c data compressed in gifs, so skip!
self.compressedExtensions.append('.gif')
for fileName in self.imgFileNameGlobs2Dc:
graph = lazyflow.graph.Graph()
reader = OperatorWrapper(OpDataSelection, graph=graph, operator_kwargs={'forceAxisOrder': False})
reader.ProjectFile.setValue(self.projectFile)
reader.WorkingDirectory.setValue(os.getcwd())
reader.ProjectDataGroup.setValue('DataSelection/local_data')
info = DatasetInfo()
# Will be read from the filesystem since the data won't be found in the project file.
info.location = DatasetInfo.Location.ProjectInternal
info.filePath = fileName
info.internalPath = ""
info.invertColors = False
info.convertToGrayscale = False
reader.Dataset.setValues([info])
# Read the test files using the data selection operator and verify the contents
imgData3Dc = reader.Image[0][...].wait()
# Check the file name output
assert reader.ImageName[0].value == fileName
# Check raw images
assert imgData3Dc.shape == self.imgData3Dc.shape, (imgData3Dc.shape, self.imgData3Dc.shape)
# skip this if image was saved compressed:
if any(x in fileName.lower() for x in self.compressedExtensions):
print("Skipping raw comparison for compressed data: {}".format(fileName))
continue
numpy.testing.assert_array_equal(imgData3Dc, self.imgData3Dc)
示例6: testBasic3DWrongAxes
# 需要导入模块: from ilastik.applets.dataSelection.opDataSelection import DatasetInfo [as 别名]
# 或者: from ilastik.applets.dataSelection.opDataSelection.DatasetInfo import filePath [as 别名]
def testBasic3DWrongAxes(self):
"""Test if 3D file with intentionally wrong axes is rejected """
for fileName in self.imgFileNames3D:
graph = lazyflow.graph.Graph()
reader = OperatorWrapper(OpDataSelection, graph=graph, operator_kwargs={'forceAxisOrder': False})
reader.ProjectFile.setValue(self.projectFile)
reader.WorkingDirectory.setValue(os.getcwd())
reader.ProjectDataGroup.setValue('DataSelection/local_data')
info = DatasetInfo()
# Will be read from the filesystem since the data won't be found in the project file.
info.location = DatasetInfo.Location.ProjectInternal
info.filePath = fileName
info.internalPath = ""
info.invertColors = False
info.convertToGrayscale = False
info.axistags = vigra.defaultAxistags('tzyc')
try:
reader.Dataset.setValues([info])
assert False, "Should have thrown an exception!"
except DatasetConstraintError:
pass
except:
assert False, "Should have thrown a DatasetConstraintError!"
示例7: testBasic3D
# 需要导入模块: from ilastik.applets.dataSelection.opDataSelection import DatasetInfo [as 别名]
# 或者: from ilastik.applets.dataSelection.opDataSelection.DatasetInfo import filePath [as 别名]
def testBasic3D(self):
"""Test if plane 2d files are loaded correctly"""
for fileName in self.imgFileNames3D:
graph = lazyflow.graph.Graph()
reader = OperatorWrapper(OpDataSelection, graph=graph, operator_kwargs={'forceAxisOrder': False})
reader.ProjectFile.setValue(self.projectFile)
reader.WorkingDirectory.setValue(os.getcwd())
reader.ProjectDataGroup.setValue('DataSelection/local_data')
info = DatasetInfo()
# Will be read from the filesystem since the data won't be found in the project file.
info.location = DatasetInfo.Location.ProjectInternal
info.filePath = fileName
info.internalPath = ""
info.invertColors = False
info.convertToGrayscale = False
reader.Dataset.setValues([info])
# Read the test files using the data selection operator and verify the contents
imgData3D = reader.Image[0][...].wait()
# Check the file name output
assert reader.ImageName[0].value == fileName
# Check raw images
assert imgData3D.shape == self.imgData3D.shape, (imgData3D.shape, self.imgData3D.shape)
# skip this if image was saved compressed:
numpy.testing.assert_array_equal(imgData3D, self.imgData3D)
示例8: testWeirdAxisInfos
# 需要导入模块: from ilastik.applets.dataSelection.opDataSelection import DatasetInfo [as 别名]
# 或者: from ilastik.applets.dataSelection.opDataSelection.DatasetInfo import filePath [as 别名]
def testWeirdAxisInfos(self):
"""
If we add a dataset that has the channel axis in the wrong place,
the operator should automatically transpose it to be last.
"""
weirdAxisFilename = os.path.join(self.workingDir, 'WeirdAxes.npy')
expected_data = numpy.random.random( (3,100,100) )
numpy.save(weirdAxisFilename, expected_data)
info = DatasetInfo()
info.filePath = weirdAxisFilename
info.axistags = vigra.defaultAxistags('cxy')
graph = Graph()
op = OpDataSelectionGroup(graph=graph, forceAxisOrder=False)
op.WorkingDirectory.setValue( self.workingDir )
op.DatasetRoles.setValue( ['RoleA'] )
op.DatasetGroup.resize( 1 )
op.DatasetGroup[0].setValue( info )
assert op.ImageGroup[0].ready()
data_from_op = op.ImageGroup[0][:].wait()
assert data_from_op.dtype == expected_data.dtype
assert data_from_op.shape == expected_data.shape, (data_from_op.shape, expected_data.shape)
assert (data_from_op == expected_data).all()
# op.Image is a synonym for op.ImageGroup[0]
assert op.Image.ready()
assert (op.Image[:].wait() == expected_data).all()
# Ensure that files opened by the inner operators are closed before we exit.
op.DatasetGroup.resize(0)
示例9: impl
# 需要导入模块: from ilastik.applets.dataSelection.opDataSelection import DatasetInfo [as 别名]
# 或者: from ilastik.applets.dataSelection.opDataSelection.DatasetInfo import filePath [as 别名]
def impl():
projFilePath = self.PROJECT_FILE
shell = self.shell
# New project
shell.createAndLoadNewProject(projFilePath)
workflow = shell.projectManager.workflow
from ilastik.applets.dataSelection.opDataSelection import DatasetInfo
opDataSelection = workflow.dataSelectionApplet.topLevelOperator
for i, dataFile in enumerate(self.SAMPLE_DATA):
# Add a file
info = DatasetInfo()
info.filePath = dataFile
opDataSelection.Dataset.resize(i+1)
opDataSelection.Dataset[i].setValue(info)
# Set some features
opFeatures = workflow.featureSelectionApplet.topLevelOperator
opFeatures.FeatureIds.setValue( OpPixelFeaturesPresmoothed.DefaultFeatureIds )
opFeatures.Scales.setValue( [0.3, 0.7, 1, 1.6, 3.5, 5.0, 10.0] )
# sigma: 0.3 0.7 1.0 1.6 3.5 5.0 10.0
selections = numpy.array( [[True, False, False, False, False, False, False],
[True, False, False, False, False, False, False],
[True, False, False, False, False, False, False],
[False, False, False, False, False, False, False],
[False, False, False, False, False, False, False],
[False, False, False, False, False, False, False]] )
opFeatures.SelectionMatrix.setValue(selections)
# Save and close
shell.projectManager.saveProject()
shell.ensureNoCurrentProject(assertClean=True)
示例10: impl
# 需要导入模块: from ilastik.applets.dataSelection.opDataSelection import DatasetInfo [as 别名]
# 或者: from ilastik.applets.dataSelection.opDataSelection.DatasetInfo import filePath [as 别名]
def impl():
projFilePath = self.PROJECT_FILE
shell = self.shell
workflow = self.workflow
# New project
shell.createAndLoadNewProject(projFilePath)
# Add a file
from ilastik.applets.dataSelection.opDataSelection import DatasetInfo
info = DatasetInfo()
info.filePath = self.SAMPLE_DATA
opDataSelection = workflow.dataSelectionApplet.topLevelOperator
opDataSelection.Dataset.resize(1)
opDataSelection.Dataset[0].setValue(info)
# Set some features
featureGui = workflow.featureSelectionApplet.gui
opFeatures = workflow.featureSelectionApplet.topLevelOperator
# sigma: 0.3 0.7 1.0 1.6 3.5 5.0 10.0
selections = numpy.array( [[True, False, False, False, False, False, False],
[True, False, False, False, False, False, False],
[True, False, False, False, False, False, False],
[False, False, False, False, False, False, False],
[False, False, False, False, False, False, False],
[False, False, False, False, False, False, False]] )
opFeatures.SelectionMatrix.setValue(selections)
# Save and close
shell.projectManager.saveProject()
shell.ensureNoCurrentProject(assertClean=True)
示例11: debug_with_new
# 需要导入模块: from ilastik.applets.dataSelection.opDataSelection import DatasetInfo [as 别名]
# 或者: from ilastik.applets.dataSelection.opDataSelection.DatasetInfo import filePath [as 别名]
def debug_with_new(shell, workflow):
"""
(Function for debug and testing.)
"""
projFilePath = "/magnetic/test_watershed_project.ilp"
# New project
shell.createAndLoadNewProject(projFilePath)
# Add a file
from ilastik.applets.dataSelection.opDataSelection import DatasetInfo
info = DatasetInfo()
#info.filePath = '/magnetic/gigacube.h5'
#info.filePath = '/magnetic/synapse_small.npy'
info.filePath = '/magnetic/synapse_small.npy_results.h5'
#info.filePath = '/magnetic/singleslice.h5'
opDataSelection = workflow.dataSelectionApplet.topLevelOperator
opDataSelection.Dataset.resize(1)
opDataSelection.Dataset[0].setValue(info)
# Select the watershed drawer
shell.setSelectedAppletDrawer(1)
# Save the project
shell.onSaveProjectActionTriggered()
示例12: testBasic2D
# 需要导入模块: from ilastik.applets.dataSelection.opDataSelection import DatasetInfo [as 别名]
# 或者: from ilastik.applets.dataSelection.opDataSelection.DatasetInfo import filePath [as 别名]
def testBasic2D(self):
"""Test if plane 2d files are loaded correctly"""
for fileName in self.imgFileNames2D:
graph = lazyflow.graph.Graph()
reader = OperatorWrapper(OpDataSelection, graph=graph)
reader.ProjectFile.setValue(self.projectFile)
reader.WorkingDirectory.setValue(os.getcwd())
reader.ProjectDataGroup.setValue('DataSelection/local_data')
info = DatasetInfo()
# Will be read from the filesystem since the data won't be found in the project file.
info.location = DatasetInfo.Location.ProjectInternal
info.filePath = fileName
info.internalPath = ""
info.invertColors = False
info.convertToGrayscale = False
reader.Dataset.setValues([info])
# Read the test files using the data selection operator and verify the contents
imgData2D = reader.Image[0][...].wait()
# Check the file name output
assert reader.ImageName[0].value == fileName
# Check raw images
assert imgData2D.shape == self.imgData2D.shape
# skip this if image was saved compressed:
if any(x in fileName.lower() for x in self.compressedExtensions):
print("Skipping raw comparison for compressed data: {}".format(fileName))
continue
numpy.testing.assert_array_equal(imgData2D, self.imgData2D)
示例13: impl
# 需要导入模块: from ilastik.applets.dataSelection.opDataSelection import DatasetInfo [as 别名]
# 或者: from ilastik.applets.dataSelection.opDataSelection.DatasetInfo import filePath [as 别名]
def impl():
projFilePath = self.PROJECT_FILE
shell = self.shell
# New project
shell.createAndLoadNewProject(projFilePath, self.workflowClass())
workflow = shell.projectManager.workflow
from ilastik.applets.dataSelection.opDataSelection import DatasetInfo
opDataSelection = workflow.dataSelectionApplet.topLevelOperator
for i, dataFile in enumerate(self.SAMPLE_DATA):
# Add a file
info = DatasetInfo()
info.filePath = dataFile
opDataSelection.DatasetGroup.resize(i+1)
opDataSelection.DatasetGroup[i][0].setValue(info)
# Set some features
opFeatures = workflow.featureSelectionApplet.topLevelOperator
# sigma: 0.3 0.7 1.0 1.6 3.5 5.0 10.0
selections = numpy.array( [[True, False, False, False, False, False, False],
[True, False, False, False, False, False, False],
[True, False, False, False, False, False, False],
[False, False, False, False, False, False, False],
[False, False, False, False, False, False, False],
[False, False, False, False, False, False, False]] )
opFeatures.SelectionMatrix.setValue(selections)
示例14: testProjectLocalData
# 需要导入模块: from ilastik.applets.dataSelection.opDataSelection import DatasetInfo [as 别名]
# 或者: from ilastik.applets.dataSelection.opDataSelection.DatasetInfo import filePath [as 别名]
def testProjectLocalData(self):
graph = lazyflow.graph.Graph()
reader = OperatorWrapper( OpDataSelection, graph=graph )
reader.ProjectFile.setValue(self.projectFile)
reader.WorkingDirectory.setValue( os.getcwd() )
reader.ProjectDataGroup.setValue( 'DataSelection/local_data' )
# Create a list of dataset infos . . .
datasetInfos = []
# From project
info = DatasetInfo()
info.location = DatasetInfo.Location.ProjectInternal
info.filePath = "This string should be ignored..."
info._datasetId = 'dataset1' # (Cheating a bit here...)
info.invertColors = False
info.convertToGrayscale = False
datasetInfos.append(info)
reader.Dataset.setValues(datasetInfos)
projectInternalData = reader.Image[0][...].wait()
assert projectInternalData.shape == self.pngData.shape
assert (projectInternalData == self.pngData).all()
示例15: impl
# 需要导入模块: from ilastik.applets.dataSelection.opDataSelection import DatasetInfo [as 别名]
# 或者: from ilastik.applets.dataSelection.opDataSelection.DatasetInfo import filePath [as 别名]
def impl():
projFilePath = self.PROJECT_FILE
shell = self.shell
# New project
shell.createAndLoadNewProject(projFilePath)
workflow = shell.projectManager.workflow
# Add a file
from ilastik.applets.dataSelection.opDataSelection import DatasetInfo
info = DatasetInfo()
info.filePath = self.SAMPLE_DATA
opDataSelection = workflow.dataSelectionApplet.topLevelOperator
opDataSelection.Dataset.resize(1)
opDataSelection.Dataset[0].setValue(info)
# Set some features
opFeatures = workflow.featureSelectionApplet.topLevelOperator
opFeatures.FeatureIds.setValue( OpPixelFeaturesPresmoothed.DefaultFeatureIds )
opFeatures.Scales.setValue( [0.3, 0.7, 1, 1.6, 3.5, 5.0, 10.0] )
# sigma: 0.3 0.7 1.0 1.6 3.5 5.0 10.0
selections = numpy.array( [[True, True, True, True, True, True, False],
[True, True, True, True, True, True, False],
[True, True, True, True, True, True, False],
[True, True, True, True, True, True, False],
[True, True, True, True, True, True, False],
[True, True, True, True, True, True, False]] )
opFeatures.SelectionMatrix.setValue(selections)