Skip to content
Adrian Quintana edited this page Dec 11, 2017 · 1 revision

Image Class

Introduction

Image class is the responsible of handling image files. According to the file extension it selects the specific algorithm for each format and then, It read the header. Finally, Image data is set into a MultidimArray. Image is a template class (i.e. its datatype is decided by the programmer). Therefore, if a Image<char> is used to read from a file whose datatype is, let say, float, then bytes are truncated for each pixel with an information loss.

Read

The simplest way of reading an image is:

although the read method allows different special cases as follows:

Reading the header

It is possible to read only the values of the image file header. The information read is: image dimensions, data type, offset and bit order

Image img; img.read('filename.ext', HEADER); ArrayDim aDim; DataType datatype; img.getDimensions(aDim); datatype = img.datatype();

Reading from stack

Reading independent images in a stack can be done in two ways: adding a prefix number to the filename separated by @,

or passing the selected image number as argument,

Writing

Single image writing

Stack writing

Conversions

File format

Data type

Writing

How to map?

Map if possible

Operations

Creating images

Transform images (rotate, scale, shift)

Clone this wiki locally