# OOF2: The Manual

## 2.2. Microstructures

The `Microstructure` is the fundamental object in OOF2, just like a document is the fundamental object in a word processor. A `Microstructure` (with a capital M) is the computer's representation of a physical microstructure (with a small m). Before doing anything else in OOF2 you must create a `Microstructure`. Because OOF2 is designed to work on images, and images are usually rectangular, `Microstructures` must be rectangular.[3]

Just as photographs, when digitized, are divided into pixels, a `Microstructure` is also divided into pixels. A pixel is the smallest component of a `Microstructure` that can be manipulated by OOF2. The `Microstructure` contains arrays of data describing each pixel, such as what `Material` has been assigned to it, and what Pixel Groups it belongs to.

Commands for creating and manipulating `Microstructures` are in OOF.Microstructure. The corresponding GUI is described in Section 3.2.

### 2.2.1. Coordinate Systems

Every `Microstructure` has two sizes: a physical size and a pixel size. The physical size is the size of the real microstructure that the `Microstructure` represents, 100μ×100μ, for example. (See Section 2.1.1.) The pixel size of a `Microstructure` is the number of pixels along its x and y dimensions. Note that pixels need not be square: a 100μ×100μ `Microstructure` might be divided into 100×160 pixels.

The fact that `Microstructures` have two sizes means that they have two coordinate systems. We can talk about a physical point (x,y) in the `Microstructure`, where x and y are given in physical units, (that is, in whatever units were used to specify the physical size) and the origin is at the lower left corner of the `Microstructure`. We can also talk about the position (i,j) of a pixel, where i and j are integers specifying the column and row of the pixel. Row 0 is the bottom row, and column 0 is the leftmost column.

Note Most image processing programs label the pixels as if they were matrix elements -- pixel (i,j) is in the ith row from the top and the jth column from the left. OOF2 does not do this, choosing instead to use the same origin and axes for both the physical and pixel coordinate systems.

A third coordinate system, one that is rarely relevant in OOF2, is the screen pixel coordinate system. `Microstructures` and `Images` can be displayed on the computer screen at different resolutions. This doesn't change the number of pixels in the `Microstructure`, it only changes the number of screen pixels used to draw one `Microstructure` pixel. A few parameters to some of the display methods are in units of the screen pixel size, though.

### 2.2.2. The Pixel Selection

Many operations on `Microstructures` work on sets of pixels. Each `Microstructure` keeps track of a set of currently selected pixels. There are tools to select pixels and to modify the selected set. Each `Microstructure` has its own set of selected pixels.

Commands for selecting pixels are in OOF.PixelSelection. The GUI tools for the same operations are described in Section 3.4 and Section 4.7.3.

The set of selected pixels is used in many other commands. For example, it is possible to assign a `Material` to the currently selected pixels, or to put the pixels into a pixel group.

### 2.2.3. Pixel Groups

Pixel Groups are a way of storing and retrieving named sets of pixels. The `Microstructure` maintains a list of Pixel Groups and keeps track of which pixels belong to which groups. Many operations that apply to the Pixel Selection also apply to Pixel Groups. Pixel Groups can also be used to distinguish pixels from one another when creating `Skeletons`, if the group is marked `meshable`.

Commands for manipulating Pixel Groups are discussed in OOF.PixelGroup.

### 2.2.4. Images

`Microstructures` are usually created from `Images`. An `Image` in OOF2 is a digitized micrograph or other digital image. `Images` live inside their `Microstructures` -- that is, each `Image` is associated with one and only one `Microstructure`, and the size of the `Image`, in pixels, must be exactly the same as the size of its `Microstructure`[4]. One `Microstructure`, however, may contain more than one `Image` or more than one version of the same image. This can be useful when different processing techniques are needed to bring out different features of a micrograph.

When pixels are selected in an `Image`, they are actually being selected in the `Microstructure` containing the image. This means that all of the `Images` in a `Microstructure` share the same pixel selection.

Commands for manipulating `Images` are in OOF.Image. The corresponding GUI is described in Section 3.3. Creating a `Microstructure` directly from an image file is discussed in Section 3.2 and OOF.Microstructure.Create_From_ImageFile.

### 2.2.5. Active Areas

It is often convenient to restrict the scope of OOF2 operations to a portion of a `Microstructure`, called the Active Area. Pixel selections, pixel group operations, and `Skeleton` modifications are all restricted to the current Active Area. `Image` and `Mesh` operations, however, are not.

By default, the Active Area is the whole `Microstructure`. Commands to manipulate the Active Area are described in Section 3.5 and OOF.ActiveArea.

### 2.2.6. Orientation Maps

`Orientation Maps` assign an `Orientation` to every pixel in a `Microstructure`. They are usually obtained via electron backscatter diffraction (EBSD). A `Microstructure` can contain at most one `Orientation Map`, which must have a pixel size and physical size that match the `Microstructure`'s size. (The easiest way to ensure this is to create the `Microstructure` from the `Orientation Map`, using the OOF.Microstructure.Create_From_OrientationMap_File command.)

Commands for manipulating ```Orientation Maps``` are found in the OOF.OrientationMap menu in the main OOF2 menu bar.

The crystal orientations in an ```Orientation Map``` are not automatically used by `Materials`. They are only used if the `Material` contains an explicit `OrientationMap` `Property`.

[3] Non-rectangular microstructures can be represented within a rectangular `Microstructure` by using elements without any `Material`. See the "Nonrectangular Domain" Tutorial.

[4] This restriction may be lifted in future versions.