Main Content

openToWrite

Create and open destination for writing

Since R2021a

    Description

    openToWrite(obj,destination,info,currentLevel) opens the location specified by destination for writing. info describes the object. currentLevel indicates the current level for which data will be written.

    Use this method to prepare the destination for writing. For example, you can open a file handle or create a destination folder, then write a file header or metadata to the destination. When writing multiresolution (pyramid) images, openToWrite is called for each level before the corresponding level's setIOBlock is called.

    Input Arguments

    collapse all

    Adapter object, specified as an instance of an adapter class that is subclassed from the images.blocked.Adapter class.

    Location to write to, specified as a string scalar or character vector.

    Data Types: char | string

    Structure containing information about source, returned as a structure with these fields.

    FieldDescription
    Size

    An L-by-N integer-valued array representing image size(s);

    For this field and all subsequent fields,L is the number of levels in Source. For a single resolution level image L is 1. N is the number of dimensions in the image.

    IOBlockSizeAn L-by-N integer-valued array representing the smallest unit of data that can be read from the source.
    DatatypeAn L-by-N string array containing the MATLAB® datatype for each level.
    InitialValueA scalar value of type specified by Datatype, indicating the initial data value for each level. If the types and values differ for a multiresolution array, this can be a cell array.

    You can optionally return these additional fields.

    Optional FieldDescription
    UserData

    A scalar struct containing additional metadata about the source. This field can be empty.

    WorldStart

    An L-by-N numeric array specifying the starting edge location of the image in world coordinates.L is the number of levels in Source. N is the number of dimensions in the image.

    WorldEnd

    An L-by-N numeric array specifying the ending edge location of the image in world coordinates.L is the number of levels in Source. N is the number of dimensions in the image.

    Image resolution level, specified as a positive integer.

    Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

    Version History

    Introduced in R2021a