# Documentation

### This is machine translation

Translated by
Mouseover text to see original. Click the button below to return to the English verison of the page.

Adjust intensity values in N-D volumetric image

## Syntax

``J = imadjustn(V)``
``J = imadjustn(V,[low_in high_in],[low_out high_out])``
``J = imadjustn(V,[low_in high_in],[low_out high_out],gamma)``

## Description

````J = imadjustn(V)` maps the values in the N-D volumetric intensity image `V` to new values in `J`. `imadjustn` increases the contrast of the output volumetric image `J`. By default, `imadjustn` saturates the bottom 1% and the top 1% of all pixel values. This syntax is equivalent to `imadjustn(V,stretchlim(V(:)))`.```

example

````J = imadjustn(V,[low_in high_in],[low_out high_out])` maps the values in `V` to new values in `J` such that values between `low_in` and `high_in` map to values between `low_out` and `high_out`. `imadjustn` clips values below `low_in` and above `high_in`. Values below `low_in` map to `low_out` and values above `high_in` map to `high_out`. If you omit the ```[low_out high_out]``` argument, in which case, `imadjustn` uses the default `[0 1]`.```
````J = imadjustn(V,[low_in high_in],[low_out high_out],gamma)` maps the values of `V` to new values in `J`, where `gamma` specifies the shape of the curve describing the relationship between the values in `V` and `J`. If `gamma` is less than 1, `imadjustn` weights the mapping toward higher (brighter) output values. If `gamma` is greater than 1, `imadjustn` weights the mapping toward lower (darker) output values. If `high_out` is less than `low_out`, `imadjustn` reverses the output image volume, as in a photographic negative.```

## Examples

collapse all

Load a 3-D image into the workspace, then save the image as data type `double`.

```load mristack; V1 = im2double(mristack);```

Display cross-sections of the image.

```figure slice(V1,size(V1,2)/2,size(V1,1)/2,size(V1,3)/2) colormap gray shading interp```

Adjust the image intensity values. `imadjustn` maps input values between 0.2 and 0.8 to the default output range of [0, 1]. `imadjustn` clips input values below 0.2 and above 0.8.

`V2 = imadjustn(V1,[0.2 0.8],[]);`

Display cross-sections of the contrast-adjusted image.

```figure slice(V2,size(V2,2)/2,size(V2,1)/2,size(V2,3)/2) colormap gray shading interp```

## Input Arguments

collapse all

Volumetric intensity image, specified as a real, nonsparse, N-D, numeric array.

Data Types: `single` | `double` | `int16` | `uint8` | `uint16`

Range of values in the input image, specified as a 2-element vector of the form `[low_in high_in]`, with values in the range [0, 1]. Before adjusting intensity values, `imadjustn` converts the input image to class `double` (using `im2double`), rescaling values to the range [0,1]. `low_in` and `high_in` correspond to the specified input range after conversion to `double`.

You can use an empty matrix (`[]`) for ```[low_in high_in]``` to specify the default of `[0 1]`.

Data Types: `double`

Range of values in output image, specified as a 2-element vector of the form `[low_out high_out]`, with values in the range [0, 1]. Before adjusting intensity values, `imadjustn` converts the input image to class `double` (using `im2double`), rescaling values to the range [0,1]. `low_out` and `high_out` correspond to the specified output range after conversion to `double`. After adjusting intensity values, `imadjustn` converts the image to the data type of the input image.

You can omit the argument or use an empty matrix (`[]`) for `[low_out high_out]` to specify the default of `[0 1]`.

Data Types: `double`

Shape of curve describing relationship between values in `V` and `J`, specified as a numeric scalar. If the value is less than 1, `imadjustn` weights the mapping toward higher (brighter) output values. If the value is greater than 1, `imadjustn` weights the mapping toward lower (darker) output values. If you omit the argument, `gamma` defaults to 1 (linear mapping).

Data Types: `double`

## Output Arguments

collapse all

Volume with adjusted intensity values, returned as an N-D volumetric intensity image. The output volume has the same class as the input image.