Exemplo n.º 1
0
import logging
import os

import numpy as np

from scilpy.image.operations import (get_array_ops, get_operations_doc)
from scilpy.io.utils import (add_overwrite_arg,
                             add_verbose_arg,
                             assert_outputs_exist,
                             load_matrix_in_any_format,
                             save_matrix_in_any_format)
from scilpy.utils.util import is_float

OPERATIONS = get_array_ops()

ADDED_DOC = get_operations_doc(OPERATIONS).replace('images', 'matrices')
ADDED_DOC = ADDED_DOC.replace('image', 'matrix')
ADDED_DOC = ADDED_DOC.replace('IMG', 'MAT')
__doc__ += ADDED_DOC


def _build_arg_parser():
    p = argparse.ArgumentParser(
        formatter_class=argparse.RawTextHelpFormatter,
        description=__doc__)

    p.add_argument('operation',
                   choices=OPERATIONS.keys(),
                   help='The type of operation to be performed on the '
                        'matrices.')
    p.add_argument('inputs', nargs='+',
Exemplo n.º 2
0
import argparse
import logging
import os

from dipy.io.utils import is_header_compatible
import nibabel as nib
import numpy as np

from scilpy.image.operations import (get_image_ops, get_operations_doc)
from scilpy.io.utils import (add_overwrite_arg, add_verbose_arg,
                             assert_outputs_exist)
from scilpy.utils.util import is_float

OPERATIONS = get_image_ops()

__doc__ += get_operations_doc(OPERATIONS)


def _build_arg_parser():
    p = argparse.ArgumentParser(formatter_class=argparse.RawTextHelpFormatter,
                                description=__doc__)

    p.add_argument('operation',
                   choices=OPERATIONS.keys(),
                   help='The type of operation to be performed on the '
                   'images.')
    p.add_argument('in_images',
                   nargs='+',
                   help='The list of image files or parameters.')
    p.add_argument('out_image', help='Output image path.')
Exemplo n.º 3
0
                             add_verbose_arg,
                             assert_outputs_exist)
from scilpy.utils.util import is_float

OPERATIONS = get_image_ops()

DESCRIPTION = """
Performs an operation on a list of images. The supported operations are
listed below.

Some operations such as multiplication or addition accept float value as
parameters instead of images.
> scil_image_math.py multiplication img.nii.gz 10 mult_10.nii.gz
"""

DESCRIPTION += get_operations_doc(OPERATIONS)


def _build_arg_parser():
    p = argparse.ArgumentParser(
        formatter_class=argparse.RawTextHelpFormatter,
        description=DESCRIPTION)

    p.add_argument('operation',
                   choices=OPERATIONS.keys(),
                   help='The type of operation to be performed on the '
                   'images.')

    p.add_argument('inputs', nargs='+',
                   help='The list of image files or parameters.')