-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtif2nifti.py
executable file
·27 lines (20 loc) · 1.05 KB
/
tif2nifti.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/bin/env python3
def main():
from niftiutils import tif2nii
import logging
import coloredlogs
import argparse
logger = logging.getLogger(__name__)
logging.basicConfig(format='[%(funcName)s] - %(asctime)s - %(message)s', level=logging.INFO)
coloredlogs.install(level='DEBUG', logger=logger)
parser = argparse.ArgumentParser()
parser.add_argument('-i', '--input', help='input tiff image path', metavar='PATH')
parser.add_argument('-o', '--output', help="output nifti image path", metavar='PATH')
parser.add_argument('-x-pix', type=float, default=0.025, help="initial voxel size along x (in mm)")
parser.add_argument('-y-pix', type=float, default=0.025, help="initial voxel size along y (in mm)")
parser.add_argument('-z-pix', type=float, default=0.025, help="initial voxel size along z (in mm)")
parser.add_argument('-t', '--type', default='uint8', help="data type")
args = parser.parse_args()
tif2nii(args.input, args.output, args.x_pix, args.y_pix, args.z_pix)
if __name__ == "__main__":
main()