# mapraw¶

There are 2 forms of this command.

## mapraw(image name, filename, data type, width, height, depth, read only)¶

Maps a .raw image file to an image. If the image file does not exist, it is created. Changes made to the file are IMMEDIATELY reflected to disk, so there is no need to save or load the image. The image must be in the native byte order of the host computer. Dimensions of the .raw file do not need to be specified if the file name is in format name_WxHxD.raw, where [W, H, D] are the dimensions of the image. The system tries to guess the pixel data type, too, based on the file size and dimensions of the image as follows. If pixel size in bytes is 1, the system sets the pixel type to uint8. If pixel size in bytes is 2, the system sets the pixel type to uint16. If pixel size in bytes is 4, float32 pixel data is assumed (instead of e.g. int32 or uint32). If pixel size in bytes is 8, pixels are assumed to be of type uint64 (instead of e.g. int64 or complex32). If the guess is wrong, the pixel data type must be explicitly specified using the corresponding argument. Even in this case the dimensions can be read from the name of the file if the file name contains the dimensions.

Note

In Python/pi2py2, the image name parameter is not specified, and the function returns a newly created image mapped to the .raw image file.

This command cannot be used in the distributed processing mode. If you need it, please contact the authors.

### Arguments¶

#### image name [input]¶

Data type: string

Name of image in the system.

#### filename [input]¶

Data type: string

Name (and path) of file to map.

#### data type [input]¶

Data type: string

Data type of the image. Can be uint8, uint16, uint32, uint64, int8, int16, int32, int64, float32, or complex32. Specify empty value to infer data type from image dimensions.

#### width [input]¶

Data type: integer

Width of the image. Omit width, height and depth to infer dimensions from file name.

#### height [input]¶

Data type: integer

Height of the image. Omit width, height and depth to infer dimensions from file name.

#### depth [input]¶

Data type: integer

Depth of the image. Omit width, height and depth to infer dimensions from file name.

Data type: boolean

Default value: False

Set to true to do read-only mapping. This might be beneficial if the image file is accessed through a network share. WARNING: If set to true, writes to the image result in undefined behaviour, probably program crash to access violation or equivalent error.

## mapraw(image name, filename, data type, dimensions, read only)¶

Maps a .raw image file to an image. If the image file does not exist, it is created. Changes made to the file are IMMEDIATELY reflected to disk, so there is no need to save or load the image. The image must be in the native byte order of the host computer. Dimensions of the .raw file do not need to be specified if the file name is in format name_WxHxD.raw, where [W, H, D] are the dimensions of the image. The system tries to guess the pixel data type, too, based on the file size and dimensions of the image as follows. If pixel size in bytes is 1, the system sets the pixel type to uint8. If pixel size in bytes is 2, the system sets the pixel type to uint16. If pixel size in bytes is 4, float32 pixel data is assumed (instead of e.g. int32 or uint32). If pixel size in bytes is 8, pixels are assumed to be of type uint64 (instead of e.g. int64 or complex32). If the guess is wrong, the pixel data type must be explicitly specified using the corresponding argument. Even in this case the dimensions can be read from the name of the file if the file name contains the dimensions.

Note

In Python/pi2py2, the image name parameter is not specified, and the function returns a newly created image mapped to the .raw image file.

This command cannot be used in the distributed processing mode. If you need it, please contact the authors.

### Arguments¶

#### image name [input]¶

Data type: string

Name of image in the system.

#### filename [input]¶

Data type: string

Name (and path) of file to map.

#### data type [input]¶

Data type: string

Default value: “”

Data type of the image. Can be uint8, uint16, uint32, uint64, int8, int16, int32, int64, float32, or complex32. Specify empty value to infer data type from image dimensions.

#### dimensions [input]¶

Data type: 3-component integer vector

Default value: “[0, 0, 0]”

Dimensions of the image. Set to zero to infer dimensions from file name.