Skip to content

Commit

Permalink
Fix caching sparseindex
Browse files Browse the repository at this point in the history
  • Loading branch information
AhmetNSimsek committed Jul 13, 2023
1 parent 274fa06 commit 915a622
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions siibra/volumes/sparsemap.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,14 +111,14 @@ def mapped_voxels(self, volume: int):
v = [self.probs[i][volume] for i in self.voxels[x, y, z]]
return x, y, z, v

def _to_local_cache(self):
def _to_local_cache(self, cache_prefix: str):
"""
Serialize this index to the cache, using the given prefix for the cache
filenames.
"""
probsfile = cache.CACHE.build_filename(f"{self._cache_prefix}", suffix="probs.txt.gz")
bboxfile = cache.CACHE.build_filename(f"{self._cache_prefix}", suffix="bboxes.txt.gz")
voxelfile = cache.CACHE.build_filename(f"{self._cache_prefix}", suffix="voxels.nii.gz")
probsfile = cache.CACHE.build_filename(f"{cache_prefix}", suffix="probs.txt.gz")
bboxfile = cache.CACHE.build_filename(f"{cache_prefix}", suffix="bboxes.txt.gz")
voxelfile = cache.CACHE.build_filename(f"{cache_prefix}", suffix="voxels.nii.gz")
Nifti1Image(self.voxels, self.affine).to_filename(voxelfile)
with gzip.open(probsfile, 'wt') as f:
for D in self.probs:
Expand Down

0 comments on commit 915a622

Please sign in to comment.