35 public std::enable_shared_from_this<Volume>
45 using SliceItem = std::pair<cv::Mat, std::optional<mmap_info>>;
67 static auto New(
const filesystem::path&
path) ->
Pointer;
71 const filesystem::path&
path,
86 auto
min() const ->
double;
88 auto
max() const ->
double;
112 auto
isInBounds(const cv::Vec3d& v) const ->
bool;
147 int index, const cv::Mat& slice,
bool compress = true) const;
187 const cv::Vec3d& center,
188 const cv::Vec3d& xvec,
189 const cv::Vec3d& yvec,
191 int height = 64) const ->
Reslice;
Abstract Base Class for Key-Value Caches.
std::shared_ptr< Cache > Pointer
Base class for objects stored on disk with an associated metadata file.
auto path() const -> filesystem::path
Get the path to the object.
std::string Identifier
Identifier type.
auto name() const -> std::string
Get the human-readable name for the object.
Least Recently Used Cache.
An image generated by intersecting a plane with a Volume.
Volume(filesystem::path path)
Load the Volume from a directory path.
auto getSlicePath(int index) const -> filesystem::path
Get the file path of a slice by index.
void cachePurge() const
Purge the slice cache.
auto bounds() const -> Bounds
Get the bounding box.
void setCacheSlices(bool b)
Enable slice caching.
auto numSlices() const -> int
Get the number of slices.
auto interpolateAt(double x, double y, double z) const -> std::uint16_t
Get the intensity value at a subvoxel position.
void setCacheMemoryInBytes(std::size_t nbytes) const
Set the maximum size of the cache in bytes.
void setCacheCapacity(std::size_t newCacheCapacity) const
Set the maximum number of cached slices.
auto getCacheSize() const -> std::size_t
Get the current number of cached slices.
void setNumberOfSlices(std::size_t numSlices)
Set the expected number of slice images.
auto sliceHeight() const -> int
Get the slice height.
auto getSliceData(int index) const -> cv::Mat
Get a slice by index number.
SliceCache::Pointer cache_
std::shared_ptr< Volume > Pointer
void setSliceData(int index, const cv::Mat &slice, bool compress=true) const
Set a slice by index number.
auto intensityAt(int x, int y, int z) const -> std::uint16_t
Get the intensity value at a voxel position.
auto sliceWidth() const -> int
Get the slice width.
void setMemoryMapSlices(bool b)
Whether to memory map slices rather than loading into memory.
void setVoxelSize(double s)
Set the voxel size (in microns)
auto reslice(const cv::Vec3d ¢er, const cv::Vec3d &xvec, const cv::Vec3d &yvec, int width=64, int height=64) const -> Reslice
Create a Reslice image by intersecting the volume with a plane.
std::vector< std::mutex > sliceMutexes_
Volume(filesystem::path path, Identifier uuid, std::string name)
Make a new Volume at the specified path.
static constexpr std::size_t DEFAULT_CAPACITY
std::shared_mutex cacheMutex_
auto voxelSize() const -> double
Get the voxel size (in microns)
void setSliceHeight(int h)
Set the expected height of the slice images.
std::pair< cv::Mat, std::optional< mmap_info > > SliceItem
auto getCacheCapacity() const -> std::size_t
Get the maximum number of cached slices.
auto max() const -> double
Get the maximum intensity value in the Volume.
cv::Mat cache_slice_(int index) const
void setMin(double m)
Set the minimum value in the Volume.
cv::Mat load_slice_(int index, mmap_info *mmap_info=nullptr) const
auto isInBounds(double x, double y, double z) const -> bool
Return whether a position is within the volume bounds.
void setSliceWidth(int w)
Set the expected width of the slice images.
void setCache(SliceCache::Pointer c) const
Set the slice cache.
void setMax(double m)
Set the maximum value in the Volume.
auto getSliceDataCopy(int index) const -> cv::Mat
Get a slice by index number.
auto min() const -> double
Get the minimum intensity value in the Volume.
Volume Cartographer library