def testRead(self): graph = Graph() op = OpBlockwiseFilesetReader(graph=graph) op.DescriptionFilePath.setValue(self.configpath) slice1 = numpy.s_[:, 20:150, 20:150, 20:100, :] readData = op.Output[slice1].wait() assert (readData == self.data[slice1]).all() op.cleanUp()
def testRead(self): graph = Graph() op = OpBlockwiseFilesetReader(graph=graph) op.DescriptionFilePath.setValue( self.configpath ) slice1 = numpy.s_[ :, 20:150, 20:150, 20:100, : ] readData = op.Output[ slice1 ].wait() assert (readData == self.data[slice1]).all() op.cleanUp()
def _attemptOpenAsBlockwiseFileset(self, filePath): fileExtension = os.path.splitext(filePath)[1].lower() fileExtension = fileExtension.lstrip(".") # Remove leading dot if fileExtension in OpInputDataReader.blockwiseExts: opReader = OpBlockwiseFilesetReader(parent=self) try: # This will raise a SchemaError if this is the wrong type of json config. opReader.DescriptionFilePath.setValue(filePath) return (opReader, opReader.Output) except JsonConfigSchema.SchemaError: opReader.cleanUp() return (None, None)
def _attemptOpenAsBlockwiseFileset(self, filePath): fileExtension = os.path.splitext(filePath)[1].lower() fileExtension = fileExtension.lstrip('.') # Remove leading dot if fileExtension in OpInputDataReader.blockwiseExts: opReader = OpBlockwiseFilesetReader(parent=self) try: # This will raise a SchemaError if this is the wrong type of json config. opReader.DescriptionFilePath.setValue(filePath) return ([opReader], opReader.Output) except JsonConfigParser.SchemaError: opReader.cleanUp() except OpBlockwiseFilesetReader.MissingDatasetError as e: raise OpInputDataReader.DatasetReadError(*e.args) return ([], None)