No BSD License  

Highlights from
Image Inversion

4.0

4.0 | 2 ratings Rate this file 38 Downloads (last 30 days) File Size: 316.99 KB File ID: #14609
image thumbnail

Image Inversion

by Stead Kiger

 

11 Apr 2007 (Updated 11 Apr 2007)

InvertIm inverts an image array im in the sense of reversing its grayscale (NOT matrix inversion)

| Watch this File

File Information
Description

InvertIm generalized image inversion (grayscale reversal)

This function has several options that are useful for inversion of medical images for use in other software.

invIm=InvertIm(im) inverts an image array im in the sense of reversing its grayscale (NOT matrix inversion). InvertIm effects the inversion by computing new image data rather than by reversing the colormap or look-up-table (LUT), which is often, but not always, a better approach. im can be an array of any dimension composed of numeric or binary elements (integers [uint8, int8, uint16, int16, etc.], floating point [double or single], or logical). The result invIm is the same data class as im.

For numeric arrays, the inverse is computed using
 
   invIm = (maxVal + minVal) - im
 
with appropriate treatment of the different data types. For integer arrays, minVal and maxVal are the minimum and maximum allowed integers. For floating point arrays, if the image data lie within the range [0,1], the inversion is performed with default minVal and maxVal of 0 and 1. If the image data lie outside [0,1], then the minimum and maxmimum values of the data are used for minVal and maxVal.
 
Invert(im, bitsStored) returns the inverse of the image im using a maxVal of 2^bitsStored. This option is convenient when inverting images with a limited dynamic range, e.g., when you have a 16-bit image that only uses the first 12 bits of data. This option is only applicable to integer data.
 
invIm=Invert(im, [], lowerLimit) returns the inverse of the image im using a minVal of lowerLimit. This option is useful, for example, when inverting signed integer image data that is only positive.
 
invIm=Invert(im, [], [], upperLimit) returns the inverse of the image im using a maxVal of upperLimit.
  
All three optional arguments may be used together (e.g., invIm=Invert(im, bitsStored, lowerLimit, upperLimit)), but upperLimit will supercede bitsStored.

MATLAB release MATLAB 7.0.4 (R14SP2)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (2)
15 Dec 2008 Hanif Rahma Hakim

thx.

10 Feb 2009 ucd puri

Hi, many thanks for the nice piece of code. but i am qurious to understand the basic difference between the capability of "InvertIm" and "Imcomplement". Thanks a lot. Regards Tanuj

Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
image inversion Stead Kiger 22 Oct 2008 09:08:52
invert Stead Kiger 22 Oct 2008 09:08:52
lut Stead Kiger 22 Oct 2008 09:08:52
grayscale reversal Stead Kiger 22 Oct 2008 09:08:52
grayscale reversal Hanif Rahma Hakim 15 Dec 2008 20:38:57

Contact us at files@mathworks.com