Digital Image Processing defines a large number of specialized functions in order to increase your productivity in performing many common image analysis operations.

<< ImageProcessing`

Region-of-Interest Processing

It is sometimes of interest to process a single sub-region of an image, leaving other regions unchanged. This is commonly referred to as region-of-interest (ROI) processing. Image sub-regions may be conveniently specified by using Mathematica Graphics primitives, such as Point, Line, Circle, Polygon, or simply as a list of vertex positions. Here are two demonstrations.

Read in an image and display it.

B = ImageRead["lipid.tif"];
Show[Graphics[B]];

Define a region of interest. See the Mathematica How-Tos for more information on interactively selecting coordinates.

roi = 
      Polygon[Round[{{29.9211, 84.7558}, {126.665, 185.116}, {187.242, 
              49.4942}}]]

Display the region of interest.

ShowRegionOfInterest[B, roi, LineStyle -> Hue[0]];

This shows the result of applying a Sobel edge detector to the region defined by roi.

Show[
        Graphics[
          RegionProcessing[EdgeMagnitude[#1, N[SobelFilter[]]] &, B, 
            GraphicsRotate[roi]]]];

As a second example, consider the application of a threshold operator to an irregular region-of-interest. The vertices were selected using the point-and-click method as described earlier.

roi = 
        Polygon[Round[{{12.7424, 59.4397}, {51.6206, 91.0848}, {71.5118, 
                120.017}, {108.582, 148.046}, {140.227, 193.253}, {155.597, 
                213.144}, {195.38, 214.049}, {164.639, 149.854}, {155.597, 
                87.4682}, {106.773, 50.3983}, {90.4988, 23.274}, {63.3745, 
                7.90349}}]];

This shows the region-of-interest.

ShowRegionOfInterest[B, roi, LineStyle -> Hue[0]];

This shows the result of applying the threshold operator to the region-of-interest.

Show[
        Graphics[ 
          RegionProcessing[255 Threshold[#, 175] &, B, 
            GraphicsRotate[roi]]]];