Пример #1
0
def AddLocationSpheresToVolume(voxvol, Locations):
    BoundingBoxes = LocationsBoundingBox(Locations)[:, iBBox.MinX:iBBox.MaxZ + 1]

    (RegionOrigin, RegionVoxCount) = voxel.VoxelRegion(BoundingBoxes, voxvol.voxsize, voxvol.origin)
    indicies = RegionOrigin / voxvol.voxsize  # vol.CoordToIndex(RegionOrigin)
    endIndex = indicies + RegionVoxCount

    for iRow in range(0, Locations.shape[0]):
        AddSphereToVolume(voxvol, Locations[iRow, :], RegionOrigin=RegionOrigin[iRow, :], RegionVoxCount=RegionVoxCount[iRow, :])
Пример #2
0
    def testBoundingBox(self):

        vox_size = np.array([10, 10, 10.0])
        vol_dim = np.array([32, 32, 32])
        vol_origin = np.array([0, 0.0, 0.0])

        BoundingBox = np.array([10, 19, 31, 19, 40, 50])

        (RegionOrigin, RegionVoxCount) = voxel.VoxelRegion(BoundingBox, vox_size)

        self.assertTrue(np.all(RegionOrigin == np.array([10, 10, 30])))
        self.assertTrue(np.all(RegionVoxCount == np.array([1, 3, 2])))
Пример #3
0
    def AddBoundingBoxToVolume(self, voxvol, BoundingBox):

        (RegionOrigin, RegionVoxCount) = voxel.VoxelRegion(BoundingBox, voxvol.voxsize, voxvol.origin)

        indicies = RegionOrigin / voxvol.voxsize  # vol.CoordToIndex(RegionOrigin)

        endIndex = indicies + RegionVoxCount

        if indicies.ndim == 1:
            voxvol.voxels[indicies[0]:endIndex[0],
                          indicies[1]:endIndex[1],
                          indicies[2]:endIndex[2]] = True
        else:
            for iRow in range(0, indicies.shape[0]):
                voxvol.voxels[indicies[iRow, 0]:endIndex[iRow, 0],
                              indicies[iRow, 1]:endIndex[iRow, 1],
                              indicies[iRow, 2]:endIndex[iRow, 2]] = True
Пример #4
0
def _CreateVoxelVolume(boundingbox, vox_size):

    (voxvol_origin, vox_count) = voxel.VoxelRegion(boundingbox, vox_size)

    return voxel.Volume.Create(voxel_size=vox_size, voxel_count=vox_count, origin=voxvol_origin, dtype=np.uint8)