Skip to content

A library to split and merge high-resolution 3D images

License

Notifications You must be signed in to change notification settings

big-data-lab-team/sam

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

145 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sam

Build Status Coverage Status

A library to split and merge high-resolution 3D images. Currently supports nii format only.

prerequisites

  • Numpy 1.12.1
  • Nibabel

how to use

Split:

naive split strategy

note: accepts split dimensions rather than number of splits

import imageutils as iu
img = iu.ImageUtils(filepath="/path/to/image.nii")
img.split(first_dim=770, second_dim=605, third_dim=700,
          local_dir="/path/to/output_dir", filename_prefix="bigbrain")

multiple writes strategy

# mem = 12g
import imageutils as iu
img = iu.ImageUtils(filepath="/path/to/image.nii")
img.split_multiple_writes(Y_splits=5, Z_splits=5, X_splits=5,
                          out_dir="/path/to/output_dir", mem=12*1024**3,
                          filename_prefix="bigbrain", extension="nii")

clustered writes strategy

# mem = 12g
import imageutils as iu
img = iu.ImageUtils(filepath="/path/to/image.nii")
img.split_clustered_writes(Y_splits=5, Z_splits=5, X_splits=5,
                           out_dir="/path/to/output_dir", mem=12*1024**3,
                           filename_prefix="bigbrain", extension="nii")

Merge:

buffered slices strategy:

import imageutils as iu
import numpy as np
img = iu.ImageUtils(filepath="/path/to/img.nii", first_dim=3850,
                    second_dim=3025, third_dim=3500, dtype=np.uint16)
img.reconstruct_img("/path/to/legend", "clustered", mem=0)

buffered blocks strategy:

  • cluster reads strategy
# mem=12g
import imageutils as iu
import numpy as np
img = iu.ImageUtils(filepath="/path/to/img.nii", first_dim=3850,
                    second_dim=3025, third_dim=3500, dtype=np.uint16)
img.reconstruct_img("/path/to/legend", "clustered", mem=12*1024**3)
  • multiple reads strategy
# mem=12g
import imageutils as iu
import numpy as np
img = iu.ImageUtils(filepath="/path/to/img.nii", first_dim=3850,
                    second_dim=3025, third_dim=3500, dtype=np.uint16)
img.reconstruct_img("/path/to/legend", "multiple", mem=12*1024**3)

License

This project is licensed under the MIT License - see the LICENSE file for details

About

A library to split and merge high-resolution 3D images

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages