Typo in volumedataaccess.py
Python's bidings for requestVolumeSamples
have a typos, line 522 should have samplePosition
positional argument passed, not arr
that causes NameError: name 'arr' is not defined
.
def requestVolumeSamples(self, samplePositions, data_out = None, dimensionsND = DimensionsND.Dimensions_012, lod = 0, channel = 0, interpolationMethod = InterpolationMethod.Cubic, replacementNoValue = None):
"""Request a set of samples from the volume. The samples are always in 32-bit floating point format.
Parameters
----------
samplePositions:
A set of voxel coordinates to obtain sample values for.
data_out : numpy.ndarray, optional
If specified, the data requested is copied to this array. Otherwise, a suitable numpy array is allocated.
dimensionsND : DimensionsND, optional
If specified, determine the dimensiongroup requested. Defaults to Dimensions_012
lod : int, optional
Which LOD level to request. Defaults to 0
channel : int, optional
Channel index. Defaults to 0.
interpolationMethod: InterpolationMethod, optional
Defaults to InterpolationMethod.Cubic
replacementNoValue: float, optional
If specified, NoValue data in the dataset is replaced with this value.
Returns
-------
request : VolumeDataRequest
An object encapsulating the request, the request state, and the requested data.
"""
if data_out is None:
data_out = self.allocateVolumeSamplesBuffer(len(samplePositions), channel)
else:
if data_out.nbytes < self.getVolumeSamplesBufferSize(sampleCount, channel):
raise ValueError("output array is too small to hold the requested data with format {}".format(str(VoxelFormat.Format_R32)))
req = VolumeDataRequest(
data_out = data_out,
dimensionsND = dimensionsND,
lod = lod,
channel = channel,
format = VoxelFormat.Format_R32,
replacementNoValue = replacementNoValue,
interpolationMethod = interpolationMethod)
req.samplePositions = _ndarraypositions(arr)
req._request = self._manager.requestVolumeSamples(
req.data_out,
req.dimensionsND,
req.lod,
req.channel,
req.samplePositions,
req.samplePositions.shape[0],
req.interpolationMethod,
req.replacementNoValue)
return req
PS. If you want I can create PR for that, together with smoke test with some comparison against .getValue()
.
PSS. sampleCount
in the branch where data_out
is passed is also undefined.