

def make_header(mincfile, headerfile):
    header = {
        
    }
    order = cmd('mincinfo -attval image:dimorder {}'.format(mincfile))
    order = order.split(',')
    if ((len(order) < 3) or (len(order) > 4)):
        order = cmd('mincinfo -dimnames {}'.format(mincfile))
        order = order.split(' ')
    header['order'] = order
    if (len(order) == 4):
        time_start = cmd('mincinfo -attval time:start {}'.format(mincfile))
        time_length = cmd('mincinfo -dimlength time {}'.format(mincfile))
        header['time'] = {
            'start': float(time_start),
            'space_length': float(order),
        }
    header['xspace'] = get_space(mincfile, 'xspace')
    header['yspace'] = get_space(mincfile, 'yspace')
    header['zspace'] = get_space(mincfile, 'zspace')
    if (len(order) > 3):
        header['time'] = get_space(mincfile, 'time')
    open(headerfile, 'w').write(json.dumps(header))

dataset/ETHPy150Open neuropoly/spinalcordtoolbox/scripts/isct_minc2volume-viewer.py make_header/VarMisuse@147/227 `time_length`->`order`