Beispiel #1
0
        return name


def fmt_slc(slc):
    return ','.join(map(str, slc))


p = Parser(
    'roi-edit', description,
    Arg('--dim',
        'dimension to flatten',
        DimEditType(),
        default=[],
        action='append'),
    Arg('--ndim', 'final number of dimensions', types.Int.positive,
        default=-1),
    Arg('--pretend',
        'do not commit any actions to disk, just pretend',
        action='store_true'),
    Arg('--rename',
        'old,new name mapping, multiple --rename args can be specified',
        RenameType(),
        default=[],
        action='append'), Arg('files', 'roi files to flatten', nargs='+'))


def main():
    _, args = p.parse_args()

    if args.ns.pretend:
        print('Pretending, file saving is disabled')
Beispiel #2
0
def inc_uid(uid):
    """Increment the UID"""
    ints = map(int, uid.split('.'))
    ints[-1] += 1
    return '.'.join(map(str, ints))


series_num_type = types.Int.positive | 'smart-pick' | 'pick'
output_series_num_type = types.Int.positive | 'auto' | 'add-100' | 'pick'


p = Parser('asl-rbf-to-dicom', description,
    Arg('--disable-cache-update', 'Disable updating of the dicom cache', action='store_true'),
    Arg('--verbose', 'Enable verbose printing', action='store_true'),
    Arg('--asl-series', 'ASL series number', series_num_type, default='smart-pick'),
    Arg('--output-series', 'Series number to save output as', output_series_num_type, default='pick'),
    Arg('--pretend', 'Disable writing', action='store_true'),
    Arg('--overwrite', 'Overwrite an existing file', action='store_true'),
    Arg('rbf', 'ASL rbf.mat file', RBFMatType.r),
    Arg('dicom-dir', 'A directory of dicom files from the series that the rbf.mat was derived from', types.Dir.rw))


def main():
    parser, args = p.parse_args()
    dcms = jtmri.dcm.read(args.ns.dicom_dir, disp=False)
    last_dcm = dcms[-1]
    if len(dcms) == 0:
        parser.error('No dicoms found in %s' % args.ns.dicom_dir)

    asl_series = get_asl_series(args.ns.asl_series, dcms)
    if asl_series is None: