Пример #1
0
def transform_ndarray(data: Image) -> ndarray:
    """Transforms PySpin image into numpy ndarray.

    Arguments:
        data (Image): Source image.

    Returns:
        data (ndarray)
    """
    return data.GetNDArray()
Пример #2
0
def save(data: Image, filename: str) -> bool:
    """Saves provided image to disk using specified filename.

    Arguments:
        data (Image): Image to save.
        filename (str): Filename to save image as.

    Returns:
        success (bool)
    """
    return data.Save(filename)
Пример #3
0
def convert_format(data: Image,
                   output_format: IEnumerationT_PixelFormatEnums) -> Image:
    """Transforms PySpin image into specified output format.

    Arguments:
        data (Image): Source image
        output_format (IEnumerationT_PixelFormatEnums): Output format

    Returns:
        data (Image)
    """
    return data.Convert(output_format, HQ_LINEAR)
Пример #4
0
def save_image(image: PySpin.Image, filename: str):
    """
    Saves the given `image` under the given `filename`.
    """
    # Notice how CPU time is minimized and I/O time is maximized
    image.Save(filename)
def save_image(image: PySpin.Image, filename: str):
    image.Save(filename)