Commit 9798ae12 authored by Stein Pedersen's avatar Stein Pedersen
Browse files

Merge branch python-volumedataaccessor with refs/heads/master into refs/merge-requests/29/train

parents 97000fda b4cb3bbf
Pipeline #612 passed with stages
in 7 minutes and 9 seconds
......@@ -41,6 +41,7 @@ SET(pythonsources
${CMAKE_CURRENT_SOURCE_DIR}/__init__.py
${CMAKE_CURRENT_SOURCE_DIR}/api.py
${CMAKE_CURRENT_SOURCE_DIR}/volumedataaccess.py
${CMAKE_CURRENT_SOURCE_DIR}/volumedataaccessors.py
)
add_custom_command(TARGET core
......
......@@ -19,20 +19,69 @@
using namespace native;
template<typename INDEX_TYPE>
static void
RegisterVolumeDataRegions(py::module& m, const char* name)
{
typedef typename VectorAdapter<typename INDEX_TYPE::element_type, INDEX_TYPE::element_count>::AdaptedType AdaptedIndexType;
typedef VolumeDataRegions<INDEX_TYPE> RegionsType;
typedef std::tuple<AdaptedIndexType, AdaptedIndexType> IndexRegionType;
py::class_<RegionsType, std::unique_ptr<RegionsType, py::nodelete>>
VolumeDataRegions_(m, name, OPENVDS_DOCSTRING(VolumeDataRegions));
VolumeDataRegions_.def_property_readonly("regionCount", &RegionsType::RegionCount);
VolumeDataRegions_.def("region", [](RegionsType* self, int64_t region)
{
auto r = self->Region(region);
IndexRegionType result = std::make_tuple((AdaptedIndexType)r.Min, (AdaptedIndexType)r.Max);
return result;
}, OPENVDS_DOCSTRING(VolumeDataRegions_Region)
);
VolumeDataRegions_.def("regionFromIndex", [](RegionsType* self, AdaptedIndexType index)
{
return self->RegionFromIndex(index);
}, OPENVDS_DOCSTRING(VolumeDataRegions_RegionFromIndex)
);
}
template<typename INDEX_TYPE>
static void
RegisterVolumeDataAccessorWithRegions(py::module& m, const char* name)
{
typedef typename VectorAdapter<typename INDEX_TYPE::element_type, INDEX_TYPE::element_count>::AdaptedType AdaptedIndexType;
typedef VolumeDataRegions<INDEX_TYPE> RegionsType;
typedef VolumeDataAccessorWithRegions<INDEX_TYPE> AccessorWithRegionsType;
typedef std::tuple<AdaptedIndexType, AdaptedIndexType> IndexRegionType;
py::class_<AccessorWithRegionsType, RegionsType, VolumeDataAccessor, std::unique_ptr<AccessorWithRegionsType, py::nodelete>>
VolumeDataAccessorWithRegions_(m, name, OPENVDS_DOCSTRING(VolumeDataAccessorWithRegions));
VolumeDataAccessorWithRegions_.def_property_readonly("currentRegion", [](AccessorWithRegionsType* self)
{
auto r = self->CurrentRegion();
IndexRegionType result = std::make_tuple((AdaptedIndexType)r.Min, (AdaptedIndexType)r.Max);
return result;
}, OPENVDS_DOCSTRING(VolumeDataAccessorWithRegions_CurrentRegion)
);
}
template<typename INDEX_TYPE, typename T>
static void
RegisterVolumeDataReadAccessor(py::module& m, const char* name)
{
typedef typename VectorAdapter<typename INDEX_TYPE::element_type, INDEX_TYPE::element_count>::AdaptedType AdaptedIndexType;
typedef VolumeDataReadAccessor<INDEX_TYPE, T> AccessorType;
typedef VolumeDataAccessorWithRegions<INDEX_TYPE> AccessorWithRegionsType;
typedef VolumeDataReadAccessor<INDEX_TYPE, T> AccessorType;
py::class_<AccessorType, std::unique_ptr<AccessorType, py::nodelete>>
py::class_<AccessorType, AccessorWithRegionsType, std::unique_ptr<AccessorType, py::nodelete>>
VolumeDataAccessor_(m, name, OPENVDS_DOCSTRING(VolumeDataAccessor));
VolumeDataAccessor_.def("getValue", [](AccessorType* self, AdaptedIndexType index)
{
return self->GetValue(index);
});
}
);
}
template<typename INDEX_TYPE, typename T>
......@@ -57,57 +106,6 @@ RegisterVolumeDataReadWriteAccessor(py::module& m, const char* name)
void
PyVolumeDataAccess::initModule(py::module& m)
{
// Register accessor types
RegisterVolumeDataReadAccessor<native::IntVector2, bool> (m, "Read2DVolumeDataAccessor1Bit");
RegisterVolumeDataReadAccessor<native::IntVector2, uint8_t> (m, "Read2DVolumeDataAccessorU8");
RegisterVolumeDataReadAccessor<native::IntVector2, uint16_t> (m, "Read2DVolumeDataAccessorU16");
RegisterVolumeDataReadAccessor<native::IntVector2, uint32_t> (m, "Read2DVolumeDataAccessorU32");
RegisterVolumeDataReadAccessor<native::IntVector2, uint64_t> (m, "Read2DVolumeDataAccessorU64");
RegisterVolumeDataReadAccessor<native::IntVector2, float> (m, "Read2DVolumeDataAccessorR32");
RegisterVolumeDataReadAccessor<native::IntVector2, double> (m, "Read2DVolumeDataAccessorR64");
RegisterVolumeDataReadAccessor<native::IntVector3, bool> (m, "Read3DVolumeDataAccessor1Bit");
RegisterVolumeDataReadAccessor<native::IntVector3, uint8_t> (m, "Read3DVolumeDataAccessorU8");
RegisterVolumeDataReadAccessor<native::IntVector3, uint16_t> (m, "Read3DVolumeDataAccessorU16");
RegisterVolumeDataReadAccessor<native::IntVector3, uint32_t> (m, "Read3DVolumeDataAccessorU32");
RegisterVolumeDataReadAccessor<native::IntVector3, uint64_t> (m, "Read3DVolumeDataAccessorU64");
RegisterVolumeDataReadAccessor<native::IntVector3, float> (m, "Read3DVolumeDataAccessorR32");
RegisterVolumeDataReadAccessor<native::IntVector3, double> (m, "Read3DVolumeDataAccessorR64");
RegisterVolumeDataReadAccessor<native::IntVector4, bool> (m, "Read4DVolumeDataAccessor1Bit");
RegisterVolumeDataReadAccessor<native::IntVector4, uint8_t> (m, "Read4DVolumeDataAccessorU8");
RegisterVolumeDataReadAccessor<native::IntVector4, uint16_t> (m, "Read4DVolumeDataAccessorU16");
RegisterVolumeDataReadAccessor<native::IntVector4, uint32_t> (m, "Read4DVolumeDataAccessorU32");
RegisterVolumeDataReadAccessor<native::IntVector4, uint64_t> (m, "Read4DVolumeDataAccessorU64");
RegisterVolumeDataReadAccessor<native::IntVector4, float> (m, "Read4DVolumeDataAccessorR32");
RegisterVolumeDataReadAccessor<native::IntVector4, double> (m, "Read4DVolumeDataAccessorR64");
RegisterVolumeDataReadAccessor<native::FloatVector2, float> (m, "Interpolating2DVolumeDataAccessorR32");
RegisterVolumeDataReadAccessor<native::FloatVector2, double> (m, "Interpolating2DVolumeDataAccessorR64");
RegisterVolumeDataReadAccessor<native::FloatVector3, float> (m, "Interpolating3DVolumeDataAccessorR32");
RegisterVolumeDataReadAccessor<native::FloatVector3, double> (m, "Interpolating3DVolumeDataAccessorR64");
RegisterVolumeDataReadAccessor<native::FloatVector4, float> (m, "Interpolating4DVolumeDataAccessorR32");
RegisterVolumeDataReadAccessor<native::FloatVector4, double> (m, "Interpolating4DVolumeDataAccessorR64");
RegisterVolumeDataReadWriteAccessor<native::IntVector2, bool> (m, "ReadWrite2DVolumeDataAccessor1Bit");
RegisterVolumeDataReadWriteAccessor<native::IntVector2, uint8_t> (m, "ReadWrite2DVolumeDataAccessorU8");
RegisterVolumeDataReadWriteAccessor<native::IntVector2, uint16_t> (m, "ReadWrite2DVolumeDataAccessorU16");
RegisterVolumeDataReadWriteAccessor<native::IntVector2, uint32_t> (m, "ReadWrite2DVolumeDataAccessorU32");
RegisterVolumeDataReadWriteAccessor<native::IntVector2, uint64_t> (m, "ReadWrite2DVolumeDataAccessorU64");
RegisterVolumeDataReadWriteAccessor<native::IntVector2, float> (m, "ReadWrite2DVolumeDataAccessorR32");
RegisterVolumeDataReadWriteAccessor<native::IntVector2, double> (m, "ReadWrite2DVolumeDataAccessorR64");
RegisterVolumeDataReadWriteAccessor<native::IntVector3, bool> (m, "ReadWrite3DVolumeDataAccessor1Bit");
RegisterVolumeDataReadWriteAccessor<native::IntVector3, uint8_t> (m, "ReadWrite3DVolumeDataAccessorU8");
RegisterVolumeDataReadWriteAccessor<native::IntVector3, uint16_t> (m, "ReadWrite3DVolumeDataAccessorU16");
RegisterVolumeDataReadWriteAccessor<native::IntVector3, uint32_t> (m, "ReadWrite3DVolumeDataAccessorU32");
RegisterVolumeDataReadWriteAccessor<native::IntVector3, uint64_t> (m, "ReadWrite3DVolumeDataAccessorU64");
RegisterVolumeDataReadWriteAccessor<native::IntVector3, float> (m, "ReadWrite3DVolumeDataAccessorR32");
RegisterVolumeDataReadWriteAccessor<native::IntVector3, double> (m, "ReadWrite3DVolumeDataAccessorR64");
RegisterVolumeDataReadWriteAccessor<native::IntVector4, bool> (m, "ReadWrite4DVolumeDataAccessor1Bit");
RegisterVolumeDataReadWriteAccessor<native::IntVector4, uint8_t> (m, "ReadWrite4DVolumeDataAccessorU8");
RegisterVolumeDataReadWriteAccessor<native::IntVector4, uint16_t> (m, "ReadWrite4DVolumeDataAccessorU16");
RegisterVolumeDataReadWriteAccessor<native::IntVector4, uint32_t> (m, "ReadWrite4DVolumeDataAccessorU32");
RegisterVolumeDataReadWriteAccessor<native::IntVector4, uint64_t> (m, "ReadWrite4DVolumeDataAccessorU64");
RegisterVolumeDataReadWriteAccessor<native::IntVector4, float> (m, "ReadWrite4DVolumeDataAccessorR32");
RegisterVolumeDataReadWriteAccessor<native::IntVector4, double> (m, "ReadWrite4DVolumeDataAccessorR64");
//AUTOGEN-BEGIN
// VolumeDataAccessor
py::class_<VolumeDataAccessor, std::unique_ptr<VolumeDataAccessor, py::nodelete>>
......@@ -355,5 +353,73 @@ PyVolumeDataAccess::initModule(py::module& m)
self->GetCurrentUploadError(&pObjectID, &errorCode, &pErrorString);
return std::make_tuple(std::string(pObjectID), errorCode, std::string(pErrorString));
}, OPENVDS_DOCSTRING(VolumeDataAccessManager_GetCurrentUploadError));
// Register region types
RegisterVolumeDataRegions<native::IntVector2> (m, "VolumeDataRegionsIntVector2");
RegisterVolumeDataRegions<native::IntVector3> (m, "VolumeDataRegionsIntVector3");
RegisterVolumeDataRegions<native::IntVector4> (m, "VolumeDataRegionsIntVector4");
RegisterVolumeDataRegions<native::FloatVector2> (m, "VolumeDataRegionsFloatVector2");
RegisterVolumeDataRegions<native::FloatVector3> (m, "VolumeDataRegionsFloatVector3");
RegisterVolumeDataRegions<native::FloatVector4> (m, "VolumeDataRegionsFloatVector4");
// Register accessor base types
RegisterVolumeDataAccessorWithRegions<native::IntVector2> (m, "VolumeDataAccessorWithRegionsIntVector2");
RegisterVolumeDataAccessorWithRegions<native::IntVector3> (m, "VolumeDataAccessorWithRegionsIntVector3");
RegisterVolumeDataAccessorWithRegions<native::IntVector4> (m, "VolumeDataAccessorWithRegionsIntVector4");
RegisterVolumeDataAccessorWithRegions<native::FloatVector2> (m, "VolumeDataAccessorWithRegionsFloatVector2");
RegisterVolumeDataAccessorWithRegions<native::FloatVector3> (m, "VolumeDataAccessorWithRegionsFloatVector3");
RegisterVolumeDataAccessorWithRegions<native::FloatVector4> (m, "VolumeDataAccessorWithRegionsFloatVector4");
// Register accessor types
RegisterVolumeDataReadAccessor<native::IntVector2, bool> (m, "Read2DVolumeDataAccessor1Bit");
RegisterVolumeDataReadAccessor<native::IntVector2, uint8_t> (m, "Read2DVolumeDataAccessorU8");
RegisterVolumeDataReadAccessor<native::IntVector2, uint16_t> (m, "Read2DVolumeDataAccessorU16");
RegisterVolumeDataReadAccessor<native::IntVector2, uint32_t> (m, "Read2DVolumeDataAccessorU32");
RegisterVolumeDataReadAccessor<native::IntVector2, uint64_t> (m, "Read2DVolumeDataAccessorU64");
RegisterVolumeDataReadAccessor<native::IntVector2, float> (m, "Read2DVolumeDataAccessorR32");
RegisterVolumeDataReadAccessor<native::IntVector2, double> (m, "Read2DVolumeDataAccessorR64");
RegisterVolumeDataReadAccessor<native::IntVector3, bool> (m, "Read3DVolumeDataAccessor1Bit");
RegisterVolumeDataReadAccessor<native::IntVector3, uint8_t> (m, "Read3DVolumeDataAccessorU8");
RegisterVolumeDataReadAccessor<native::IntVector3, uint16_t> (m, "Read3DVolumeDataAccessorU16");
RegisterVolumeDataReadAccessor<native::IntVector3, uint32_t> (m, "Read3DVolumeDataAccessorU32");
RegisterVolumeDataReadAccessor<native::IntVector3, uint64_t> (m, "Read3DVolumeDataAccessorU64");
RegisterVolumeDataReadAccessor<native::IntVector3, float> (m, "Read3DVolumeDataAccessorR32");
RegisterVolumeDataReadAccessor<native::IntVector3, double> (m, "Read3DVolumeDataAccessorR64");
RegisterVolumeDataReadAccessor<native::IntVector4, bool> (m, "Read4DVolumeDataAccessor1Bit");
RegisterVolumeDataReadAccessor<native::IntVector4, uint8_t> (m, "Read4DVolumeDataAccessorU8");
RegisterVolumeDataReadAccessor<native::IntVector4, uint16_t> (m, "Read4DVolumeDataAccessorU16");
RegisterVolumeDataReadAccessor<native::IntVector4, uint32_t> (m, "Read4DVolumeDataAccessorU32");
RegisterVolumeDataReadAccessor<native::IntVector4, uint64_t> (m, "Read4DVolumeDataAccessorU64");
RegisterVolumeDataReadAccessor<native::IntVector4, float> (m, "Read4DVolumeDataAccessorR32");
RegisterVolumeDataReadAccessor<native::IntVector4, double> (m, "Read4DVolumeDataAccessorR64");
RegisterVolumeDataReadAccessor<native::FloatVector2, float> (m, "Interpolating2DVolumeDataAccessorR32");
RegisterVolumeDataReadAccessor<native::FloatVector2, double> (m, "Interpolating2DVolumeDataAccessorR64");
RegisterVolumeDataReadAccessor<native::FloatVector3, float> (m, "Interpolating3DVolumeDataAccessorR32");
RegisterVolumeDataReadAccessor<native::FloatVector3, double> (m, "Interpolating3DVolumeDataAccessorR64");
RegisterVolumeDataReadAccessor<native::FloatVector4, float> (m, "Interpolating4DVolumeDataAccessorR32");
RegisterVolumeDataReadAccessor<native::FloatVector4, double> (m, "Interpolating4DVolumeDataAccessorR64");
RegisterVolumeDataReadWriteAccessor<native::IntVector2, bool> (m, "ReadWrite2DVolumeDataAccessor1Bit");
RegisterVolumeDataReadWriteAccessor<native::IntVector2, uint8_t> (m, "ReadWrite2DVolumeDataAccessorU8");
RegisterVolumeDataReadWriteAccessor<native::IntVector2, uint16_t> (m, "ReadWrite2DVolumeDataAccessorU16");
RegisterVolumeDataReadWriteAccessor<native::IntVector2, uint32_t> (m, "ReadWrite2DVolumeDataAccessorU32");
RegisterVolumeDataReadWriteAccessor<native::IntVector2, uint64_t> (m, "ReadWrite2DVolumeDataAccessorU64");
RegisterVolumeDataReadWriteAccessor<native::IntVector2, float> (m, "ReadWrite2DVolumeDataAccessorR32");
RegisterVolumeDataReadWriteAccessor<native::IntVector2, double> (m, "ReadWrite2DVolumeDataAccessorR64");
RegisterVolumeDataReadWriteAccessor<native::IntVector3, bool> (m, "ReadWrite3DVolumeDataAccessor1Bit");
RegisterVolumeDataReadWriteAccessor<native::IntVector3, uint8_t> (m, "ReadWrite3DVolumeDataAccessorU8");
RegisterVolumeDataReadWriteAccessor<native::IntVector3, uint16_t> (m, "ReadWrite3DVolumeDataAccessorU16");
RegisterVolumeDataReadWriteAccessor<native::IntVector3, uint32_t> (m, "ReadWrite3DVolumeDataAccessorU32");
RegisterVolumeDataReadWriteAccessor<native::IntVector3, uint64_t> (m, "ReadWrite3DVolumeDataAccessorU64");
RegisterVolumeDataReadWriteAccessor<native::IntVector3, float> (m, "ReadWrite3DVolumeDataAccessorR32");
RegisterVolumeDataReadWriteAccessor<native::IntVector3, double> (m, "ReadWrite3DVolumeDataAccessorR64");
RegisterVolumeDataReadWriteAccessor<native::IntVector4, bool> (m, "ReadWrite4DVolumeDataAccessor1Bit");
RegisterVolumeDataReadWriteAccessor<native::IntVector4, uint8_t> (m, "ReadWrite4DVolumeDataAccessorU8");
RegisterVolumeDataReadWriteAccessor<native::IntVector4, uint16_t> (m, "ReadWrite4DVolumeDataAccessorU16");
RegisterVolumeDataReadWriteAccessor<native::IntVector4, uint32_t> (m, "ReadWrite4DVolumeDataAccessorU32");
RegisterVolumeDataReadWriteAccessor<native::IntVector4, uint64_t> (m, "ReadWrite4DVolumeDataAccessorU64");
RegisterVolumeDataReadWriteAccessor<native::IntVector4, float> (m, "ReadWrite4DVolumeDataAccessorR32");
RegisterVolumeDataReadWriteAccessor<native::IntVector4, double> (m, "ReadWrite4DVolumeDataAccessorR64");
}
import openvds.core
import numpy as np
from openvds.core import VolumeDataLayout
from openvds.core import VolumeDataLayout, VolumeDataPageAccessor
from .volumedataaccessors import VolmeDataAccessorManager
from typing import Dict, Tuple, Sequence, List
......@@ -513,4 +515,37 @@ class VolumeDataAccessManager(object):
interpolationMethod = interpolationMethod,
replacementNoValue = replacementNoValue)
def _createVolumeDataAccessor(self, factoryName: str, pageAccessor: VolumeDataPageAccessor=None, replacementNoValue=None, interpolationMethod: InterpolationMethod=None):
if pageAccessor is None:
defaultDimensions = { 2: DimensionsND.Dimensions_01, 3: DimensionsND.Dimensions_012, 4: DimensionsND.Dimensions_012 }
pageAccessor = self.manager.createVolumeDataPageAccessor(self.layout, defaultDimensions[self.layout.dimensions], 0, 0, 8, self.manager.AccessMode.AccessMode_ReadOnly)
return VolmeDataAccessorManager(factoryName.strip(), self.manager, pageAccessor, replacementNoValue, interpolationMethod)
def create2DVolumeDataAccessor1Bit (self, pageAccessor: VolumeDataPageAccessor=None, replacementNoValue=None): return self._createVolumeDataAccessor("create2DVolumeDataAccessor1Bit", pageAccessor, replacementNoValue)
def create2DVolumeDataAccessorU8 (self, pageAccessor: VolumeDataPageAccessor=None, replacementNoValue=None): return self._createVolumeDataAccessor("create2DVolumeDataAccessorU8 ", pageAccessor, replacementNoValue)
def create2DVolumeDataAccessorU16 (self, pageAccessor: VolumeDataPageAccessor=None, replacementNoValue=None): return self._createVolumeDataAccessor("create2DVolumeDataAccessorU16 ", pageAccessor, replacementNoValue)
def create2DVolumeDataAccessorU32 (self, pageAccessor: VolumeDataPageAccessor=None, replacementNoValue=None): return self._createVolumeDataAccessor("create2DVolumeDataAccessorU32 ", pageAccessor, replacementNoValue)
def create2DVolumeDataAccessorU64 (self, pageAccessor: VolumeDataPageAccessor=None, replacementNoValue=None): return self._createVolumeDataAccessor("create2DVolumeDataAccessorU64 ", pageAccessor, replacementNoValue)
def create2DVolumeDataAccessorR32 (self, pageAccessor: VolumeDataPageAccessor=None, replacementNoValue=None): return self._createVolumeDataAccessor("create2DVolumeDataAccessorR32 ", pageAccessor, replacementNoValue)
def create2DVolumeDataAccessorR64 (self, pageAccessor: VolumeDataPageAccessor=None, replacementNoValue=None): return self._createVolumeDataAccessor("create2DVolumeDataAccessorR64 ", pageAccessor, replacementNoValue)
def create3DVolumeDataAccessor1Bit (self, pageAccessor: VolumeDataPageAccessor=None, replacementNoValue=None): return self._createVolumeDataAccessor("create3DVolumeDataAccessor1Bit", pageAccessor, replacementNoValue)
def create3DVolumeDataAccessorU8 (self, pageAccessor: VolumeDataPageAccessor=None, replacementNoValue=None): return self._createVolumeDataAccessor("create3DVolumeDataAccessorU8 ", pageAccessor, replacementNoValue)
def create3DVolumeDataAccessorU16 (self, pageAccessor: VolumeDataPageAccessor=None, replacementNoValue=None): return self._createVolumeDataAccessor("create3DVolumeDataAccessorU16 ", pageAccessor, replacementNoValue)
def create3DVolumeDataAccessorU32 (self, pageAccessor: VolumeDataPageAccessor=None, replacementNoValue=None): return self._createVolumeDataAccessor("create3DVolumeDataAccessorU32 ", pageAccessor, replacementNoValue)
def create3DVolumeDataAccessorU64 (self, pageAccessor: VolumeDataPageAccessor=None, replacementNoValue=None): return self._createVolumeDataAccessor("create3DVolumeDataAccessorU64 ", pageAccessor, replacementNoValue)
def create3DVolumeDataAccessorR32 (self, pageAccessor: VolumeDataPageAccessor=None, replacementNoValue=None): return self._createVolumeDataAccessor("create3DVolumeDataAccessorR32 ", pageAccessor, replacementNoValue)
def create3DVolumeDataAccessorR64 (self, pageAccessor: VolumeDataPageAccessor=None, replacementNoValue=None): return self._createVolumeDataAccessor("create3DVolumeDataAccessorR64 ", pageAccessor, replacementNoValue)
def create4DVolumeDataAccessor1Bit (self, pageAccessor: VolumeDataPageAccessor=None, replacementNoValue=None): return self._createVolumeDataAccessor("create4DVolumeDataAccessor1Bit", pageAccessor, replacementNoValue)
def create4DVolumeDataAccessorU8 (self, pageAccessor: VolumeDataPageAccessor=None, replacementNoValue=None): return self._createVolumeDataAccessor("create4DVolumeDataAccessorU8 ", pageAccessor, replacementNoValue)
def create4DVolumeDataAccessorU16 (self, pageAccessor: VolumeDataPageAccessor=None, replacementNoValue=None): return self._createVolumeDataAccessor("create4DVolumeDataAccessorU16 ", pageAccessor, replacementNoValue)
def create4DVolumeDataAccessorU32 (self, pageAccessor: VolumeDataPageAccessor=None, replacementNoValue=None): return self._createVolumeDataAccessor("create4DVolumeDataAccessorU32 ", pageAccessor, replacementNoValue)
def create4DVolumeDataAccessorU64 (self, pageAccessor: VolumeDataPageAccessor=None, replacementNoValue=None): return self._createVolumeDataAccessor("create4DVolumeDataAccessorU64 ", pageAccessor, replacementNoValue)
def create4DVolumeDataAccessorR32 (self, pageAccessor: VolumeDataPageAccessor=None, replacementNoValue=None): return self._createVolumeDataAccessor("create4DVolumeDataAccessorR32 ", pageAccessor, replacementNoValue)
def create4DVolumeDataAccessorR64 (self, pageAccessor: VolumeDataPageAccessor=None, replacementNoValue=None): return self._createVolumeDataAccessor("create4DVolumeDataAccessorR64 ", pageAccessor, replacementNoValue)
def create2DInterpolatingVolumeDataAccessorR32(self, pageAccessor: VolumeDataPageAccessor=None, replacementNoValue=None, interpolationMethod: InterpolationMethod=InterpolationMethod.Cubic): return self._createVolumeDataAccessor("create2DInterpolatingVolumeDataAccessorR32", pageAccessor, replacementNoValue, interpolationMode)
def create2DInterpolatingVolumeDataAccessorR64(self, pageAccessor: VolumeDataPageAccessor=None, replacementNoValue=None, interpolationMethod: InterpolationMethod=InterpolationMethod.Cubic): return self._createVolumeDataAccessor("create2DInterpolatingVolumeDataAccessorR64", pageAccessor, replacementNoValue, interpolationMode)
def create3DInterpolatingVolumeDataAccessorR32(self, pageAccessor: VolumeDataPageAccessor=None, replacementNoValue=None, interpolationMethod: InterpolationMethod=InterpolationMethod.Cubic): return self._createVolumeDataAccessor("create3DInterpolatingVolumeDataAccessorR32", pageAccessor, replacementNoValue, interpolationMode)
def create3DInterpolatingVolumeDataAccessorR64(self, pageAccessor: VolumeDataPageAccessor=None, replacementNoValue=None, interpolationMethod: InterpolationMethod=InterpolationMethod.Cubic): return self._createVolumeDataAccessor("create3DInterpolatingVolumeDataAccessorR64", pageAccessor, replacementNoValue, interpolationMode)
def create4DInterpolatingVolumeDataAccessorR32(self, pageAccessor: VolumeDataPageAccessor=None, replacementNoValue=None, interpolationMethod: InterpolationMethod=InterpolationMethod.Cubic): return self._createVolumeDataAccessor("create4DInterpolatingVolumeDataAccessorR32", pageAccessor, replacementNoValue, interpolationMode)
def create4DInterpolatingVolumeDataAccessorR64(self, pageAccessor: VolumeDataPageAccessor=None, replacementNoValue=None, interpolationMethod: InterpolationMethod=InterpolationMethod.Cubic): return self._createVolumeDataAccessor("create4DInterpolatingVolumeDataAccessorR64", pageAccessor, replacementNoValue, interpolationMode)
\ No newline at end of file
from openvds.core import VolumeDataAccessManager, VolumeDataPageAccessor, InterpolationMethod
class VolmeDataAccessorManager(object):
def __init__(self, factoryName: str, manager: VolumeDataAccessManager, pageAccessor: VolumeDataPageAccessor, replacementNoValue=None, interpolationMethod: InterpolationMethod=None):
self.factory = getattr(manager, factoryName)
self.manager = manager
self.pageAccessor = pageAccessor
self.replacementNoValue = replacementNoValue or 0.0
self.interpolationMethod = interpolationMethod
self.accessor = None
def __enter__(self):
if self.interpolationMethod:
self.accessor = self.factory(self.pageAccessor, self.replacementNoValue, self.interpolationMethod)
else:
self.accessor = self.factory(self.pageAccessor, self.replacementNoValue)
return self.accessor
def __exit__(self, exc_type, exc_value, exc_traceback):
if self.accessor:
self.manager.destroyVolumeDataAccessor(self.accessor)
self.accessor = None
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment