import argparse
import nibabel as nib
import numpy as np

parser = argparse.ArgumentParser()
parser.add_argument(
    '--dir',
    type=str,
    default=r'D:\DATA\MRI_Datasets\ALS\1224993\test\t2',
    help='feature matrix directory')
parser.add_argument(
    '--c',
    type=str,
    default='t2s',
    help='feature matrix directory')
parser.add_argument('--random_state',
                    type=int,
                    default=42,
                    help='seed for random initialisation')
args = parser.parse_args()

nii1 = nib.load(args.dir + '/'+args.c+'.nii.gz')
data1 = nii1.get_fdata()
nii2 = nib.load(args.dir + '/'+args.c+'_seg.nii.gz')
data2 = nii2.get_fdata()
data = data1*data2
niiNew = nib.Nifti1Image(data, nii1.affine)
nib.save(niiNew, args.dir + '/'+args.c+'_spinal.nii.gz')
