Converting image datasets to different data types

From MIPAV
Jump to: navigation, search

In MIPAV you can convert image datasets to different data types. For example, you might want to convert a Boolean type dataset to an integer type dataset. MIPAV also allows you to simultaneously alter the input and output values. This utility is particularly helpful if you want to apply an algorithm to a dataset but cannot do so because the original images are the wrong image type.
data type -A set of values from which a variable, constant, function, or expression may takes its value. MIPAV automates the following data types: Boolean, signed byte, unsigned byte, signed short, unsigned short, integer, long, float, double, and color 24.

Convert Type

To convert a dataset to a different image type
1 Select Utilities >Conversion Tools > Convert type. The Convert Image Type dialog box (Figure 8) opens.
2 Select the desired image type in the Image Type group.
3 Indicate the start and end input ranges in the Range of input values group.
4 Indicate the start and end output ranges in the Range of output values group.
5 Specify either Little endian or Big endian in the Endianess group.
6 Click OK. The dataset is converted to the new image type.

Figure 8. Convert Image Type dialog box

ConvertImageType.jpg

Image Type
Specifies the data type. Select one of the following:
Boolean
Indicates whether a condition if true or false.
Byte
Primitive 8-bit data type. Valid values range from -127 to 128.
Unsigned byte
Primitive 8-bit data type. Unsigned byte is a variation of the integer data type. The unsigned byte data type signifies that valid values must fall within a specified range of positive whole number values. Valid values range from 0 to 255. Negative values are not valid, hence the term unsigned byte.
Short
Primitive 16-bit data type. Short is a variation of the integer data type. Short accommodates values that are whole numbers. Valid values range from 0 to 32,768.
Unsigned short
Primitive 16-bit data type. Unsigned short is a variation of the integer data type. The unsigned short data type signifies that valid values must fall within a specified range of positive whole number values. Valid values range from 0 to 65,535. Note that negative values are not valid, hence the term unsigned byte.
Integer
Primitive 32-bit data type. Integer is sometimes abbreviated as int. Integer accommodates values that are whole numbers. Valid values range from
-2,147,483,648 to 2,147,483,648.
Unsigned integer
Primitive 32-bit data type.
Long
Primitive 64-bit data type. Long is a variation of the integer data type. Long accommodates values that are whole numbers. Valid values range from
-9,223,372,036,854,775,808 to 9,223,372,036,854,775,808.
Float
Primitive 32-bit data type. Float is a floating point data type that accommodates decimal values, up to 6 or 7 significant digits of accuracy. Valid values can range from -3.4 x 1038 to 3.4 x 1038.
Double
Primitive 64-bit data type. Double is a floating point data type that accommodates decimal values, up to 14 or 15 significant digits of accuracy. Valid values can range from -1.7 x 10308 to 1.7 x 10308.
Destination
New image
Shows the converted dataset in a new image window.
Replace image
Replaces the current active dataset with the converted dataset.
Range of input values
Use entire image range
Converts all intensity values to the result image range when converting the image to a different type.
Use user-defined range
Converts only the intensity values in the user-defined range when converting the image to a different type.
Start input range
Specifies the intensity value at the beginning of the input range. The default value is the image minimum.
End input range
Specifies the intensity value at the end of the input range.
Range of output values
Starting range
Specifies the intensity value at the beginning of the output range. The default value is the image minimum.
Ending range
Specifies the intensity value at the end of the output range.
Process each slice independently (2.5D)
Converts each image slice independently as if it was a separate image. This options works for 2.5D images.
Endianess
Data organization strategy. Refers to the way computer processors store data in memory.
Little endian
Stores the least significant byte (LSB) first.
Big endian
Stores the most significant byte (MSB) first.
OK
Applies the parameters that you specified to convert the dataset.
Cancel
Disregards any changes you made in this dialog box, closes the dialog box, and does not convert the dataset.
Help
Displays online help for this dialog box.

Converting grayscale images to RGB images

You can convert grayscale image datasets to RGB. RGB images have three channels (red, green, and blue) that contain image data.If you open two datasets in one image window, you can create a composite image that contains a mixture of the red, green, and blue channels.

Concatenate-RGB

To convert grayscale images to RGB images

1 Open an image.
2 Select Utilities >Conversion Tools> Grays -> RGB. The Concatenate -> RGB dialog box opens.
3 Select the image to which you want to apply the red channel in the Image (red) list. If you loaded two images into the image window, two file names should appear.
4 Do the same for the Image (green) list and the Image (blue) list.
5 Indicate whether you want to remap to current intensity values to the full standard 0-255 RGB values.
Note: Generally, each color is defined as one of the 256 intensities. If you remap the grayscale intensities and select Remap data, the system defines the intensities as one of the 256 values. If one or all of the input images have values that exceed 255 and you do not select Remap data, then data truncates to 255 since a color channel can only represent values 0-255.
6 Click OK. A status message appears. When filtering is complete, the new RGB image appears in a separate image window.

Figure 9. Concatenate -> RGB dialog box
Image (red)
Identifies the image to be added to the red channel of the resulting image.

GraysToRGB.jpg

Image (green)
Identifies the image to be added to the green channel of the resulting image.
Image (blue)
Identifies the image to be added to the blue channel of the resulting image.
Remap data (0-255)
Indicates, when selected, that you want image intensities to be remapped to values 0-255, which is the standard for RGB images.
Destination
New image
Sends the output to a new image frame.
Replace image
Replaces the existing image.
OK
Applies the parameters that you specified to create an RGB image.
Cancel
Disregards any changes you made in this dialog box, closes the dialog box, and does not create an RGB image.
Help
Displays online help for this dialog box.

Converting RGB datasets to grayscale datasets

On the Utilities > Conversion Tools menu in the MIPAV window, the RGB conversion utility offers both a manual and an automatic method of converting RGB datasets to grayscale RGB images.
Manual conversion -In the manual method of conversion, you select Utilities >Conversion Tools > RGB -> Gray to display the RGB -> Gray dialog box (Figure 10). The dialog box provides three weighting methods:

  • Equal weights -This method assigns equal weights to each of the three color channels. When you select this option, you can also select the Only average RGB values greater than check box and specify a threshold value. For example, if you specify a threshold value of 50, the program ignores any pixel in that channel that contains a value over 50.
  • Computer graphics weights -This method assigns the weights to each channel that are typically used to display computer graphics.
  • User-specified weights -In this method, you enter the specific weights for each color channel.

Automatic conversion -If, instead, you select Utilities > >Conversion Tools > RGB -> Grays, the program automatically converts the RGB image to three grayscale images: one each for the red, blue, and green channels.
Note: You can only specify a threshold when you choose to use the equal weights method of conversion.

RGB datasets have four channels: red, green, blue, and alpha. When you convert RGB datasets to grayscale. RGB images, the intensities are combined to form a single grayscale value.

For example:

File:MIPAV Utilities68.gif

Where,

N = New grayscale pixel
R = Red channel
G = Green channel
B = Blue channel
RW = Weight assigned to the red channel
GW = Weight assigned to the green channel
BW = Weight assigned to the blue channel

Figure 10. RGB -> Gray dialog box'
Equal weights
Assigns the same weight (0.3333) to each channel in the image. When you select this option, the Only average RGB values great than becomes available.

RGB To Gray.jpg

Computer graphics
Assigns the weighting factors typically used in computer graphics to each channel in the image:
Red, 0.299
Green, 0.587
Blue, 0.114
User specified
Specifies a weight that you determine for each channel. When you select this check box, you must type a specific weight for each channel in the Red, Green, and Blue boxes.
Red
Specifies the weight assigned to the red channel in the image. You can only specify a weight in this box if you selected the User specified option.
Green
Specifies the weight assigned to the green channel in the image. You can only specify a weight in this box if you selected the User specified option.
Blue
Specifies the weight assigned to the blue channel in the image. You can only specify a weight in this box if you selected the User specified option.
Only average RGB values greater than
Excludes any voxel in the image over the threshold value that you specify in this box. This check box is only available when you select the Equal Weights option.
New Image
Sends the output to a new image frame.
Replace Image
Replaces the existing image.
OK
Applies the parameters that you specified to create a grayscale image.
Cancel
Disregards any changes you made in this dialog box, closes the dialog box, and does not create a grayscale image.
Help
Displays online help for this dialog box.


To manually convert RGB datasets to grayscale

1 Select Utilities > RGB > RGB -> Gray: The RGB -> Gray dialog box (Figure 10) opens.
2 Select one of the following weighting methods: equal weights, computer graphics, or user specified.
If you selected Equal Weights, decide whether to apply a threshold to the RGB channels. If you want to apply a threshold, select Only average RGB values greater than and enter the threshold value. Then go to the next step.
If you selected Computer graphics or User specified, go to the next step.
3 Click OK. A status message appears. In a few moments, the image is replaced by the new grayscale dataset.


Figure 11. Manually converting RGB datasets to grayscale

Original.jpg

EqualWeights.jpg

ComputerGraphics.jpg

UserSPecified33.jpg

AverageGreaterThan50.jpg

A - the original image
B - the image converted to grayscale using Equal Weights
C - the image converted to grayscale using Computer Graphics
D - the image converted to grayscale using the User Specified RGB weight factors (0.33 for each channel)
E - the image converted to grayscale using combined options - Equal Weights and average values greater than 50

To automatically convert RGB datasets to grayscale image
Select Utilities > RGB > RGB -> Grays. The program briefly displays a status message during the conversion and then generates three new grayscale datasets, one for each channel.

Figure 12. Example of three grayscale datasets generated automatically from an RGB dataset. Here, A is an original RGB image, B - gray red channel image, C - gray green channel image, and D -gray blue channel image.

OriginalRGB.jpg A

GrayRed.jpg B

GrayGreen.jpg C

GrayBlue.jpg D


Correcting image spacing