Package org.anchoranalysis.mpp.index
Class VoxelPartitionHistogram
Object
org.anchoranalysis.mpp.index.VoxelPartitionHistogram
- All Implemented Interfaces:
VoxelPartition<org.anchoranalysis.math.histogram.Histogram>
public class VoxelPartitionHistogram extends Object implements VoxelPartition<org.anchoranalysis.math.histogram.Histogram>
A voxel partition implementation using histograms to represent voxel value distributions.
This class maintains a histogram for each slice and a combined histogram for all slices.
-
Constructor Summary
Constructors Constructor Description VoxelPartitionHistogram(int numberSlices, Supplier<org.anchoranalysis.math.histogram.Histogram> histogramFactory)Constructs a VoxelPartitionHistogram with a specified number of slices. -
Method Summary
Modifier and Type Method Description voidaddForSlice(int sliceID, int val)Adds a value to the voxel partition for a specific slice.voidcleanUp(VoxelPartitionFactory<org.anchoranalysis.math.histogram.Histogram> factory)Cleans up the voxel partition using the provided factory.org.anchoranalysis.math.histogram.HistogramgetCombined()Gets the combined voxel partition for all slices.org.anchoranalysis.math.histogram.HistogramgetSlice(int sliceID)Gets the voxel partition for a specific slice.intnumberSlices()Gets the number of slices in the partition.
-
Constructor Details
-
VoxelPartitionHistogram
public VoxelPartitionHistogram(int numberSlices, Supplier<org.anchoranalysis.math.histogram.Histogram> histogramFactory)Constructs a VoxelPartitionHistogram with a specified number of slices.- Parameters:
numberSlices- The number of slices in the partitionhistogramFactory- A supplier function that creates new Histogram instances
-
-
Method Details
-
getSlice
public org.anchoranalysis.math.histogram.Histogram getSlice(int sliceID)Description copied from interface:VoxelPartitionGets the voxel partition for a specific slice. This method should only be used for read-only operations to maintain integrity with the combined list.- Specified by:
getSlicein interfaceVoxelPartition<org.anchoranalysis.math.histogram.Histogram>- Parameters:
sliceID- The ID of the slice- Returns:
- The voxel partition for the specified slice
-
addForSlice
public void addForSlice(int sliceID, int val)Description copied from interface:VoxelPartitionAdds a value to the voxel partition for a specific slice.- Specified by:
addForSlicein interfaceVoxelPartition<org.anchoranalysis.math.histogram.Histogram>- Parameters:
sliceID- The ID of the sliceval- The value to add
-
getCombined
public org.anchoranalysis.math.histogram.Histogram getCombined()Description copied from interface:VoxelPartitionGets the combined voxel partition for all slices. This method should only be used for read-only operations.- Specified by:
getCombinedin interfaceVoxelPartition<org.anchoranalysis.math.histogram.Histogram>- Returns:
- The combined voxel partition
-
cleanUp
Description copied from interface:VoxelPartitionCleans up the voxel partition using the provided factory.- Specified by:
cleanUpin interfaceVoxelPartition<org.anchoranalysis.math.histogram.Histogram>- Parameters:
factory- The factory to use for cleanup
-
numberSlices
public int numberSlices()Description copied from interface:VoxelPartitionGets the number of slices in the partition.- Specified by:
numberSlicesin interfaceVoxelPartition<org.anchoranalysis.math.histogram.Histogram>- Returns:
- The number of slices
-