Crop crops or masks an image.
This module crops images into a rectangle, ellipse, an arbitrary shape provided by you, the shape of object(s) identified by an
Identify module, or a shape created using a previous
Crop module in the pipeline.
Keep in mind that cropping changes the size of your images, which may have unexpected consequences. For example, identifying objects in a cropped image and then trying to measure their intensity in the original image will not work because the two images are not the same size.
Available measurements
- AreaRetainedAfterCropping: The area of the image left after cropping.
- OriginalImageArea: The area of the original input image.
Special note on saving images: You can save the cropping shape that you have defined in this module (e.g., an ellipse you drew) so that you can use the Image option in future analyses. To do this, save either the mask or cropping in SaveImages. See the SaveImages module help for more information on saving cropping shapes.
Settings:
Select the input image
Choose the image to be cropped.
Name the output image
Enter the name to be given to cropped image.
Select the cropping shape
Select the shape into which you would like to crop:
- Rectangle: Self-explanatory.
- Ellipse: Self-explanatory.
- Image: Cropping will occur based on a binary image you specify. A choice box
with available images will appear from which
you can select an image. To crop into an arbitrary shape that you define, choose
Image and use the LoadSingleImage module to load a black and white image
that you have already prepared from a file. If you have created this image in a
program such as Photoshop, this binary image should contain only the values 0 and 255,
with zeros (black) for the parts you want to remove and 255 (white) for
the parts you want to retain. Alternately, you may have previously generated a
binary image using this module (e.g., using the Ellipse option) and saved
it using the SaveImages module.
In any case, the image must be exactly the same starting size as your image
and should contain a contiguous block of white pixels, because
the cropping module may remove rows and columns that are
completely blank.
- Objects: Crop based on labeled objects identified by a previous
Identify module.
- Previous cropping: The cropping generated by a previous cropping module.
You will be able to select images that were generated by previous Crop modules.
This Crop module will use the same cropping that was used to generate whichever image
you choose.
Select the cropping method
Choose whether you would like to crop by typing in pixel coordinates or clicking with the mouse.
- Coordinates: For Ellipse, you will be asked to enter the geometric
parameters of the ellipse. For Rectangle, you will be asked to specify
the coordinates of the corners.
- Mouse: For Ellipse, you will be asked to click five or more
points to define an ellipse around the part of the image you want to
analyze. Keep in mind that the more points you click, the longer it will
take to calculate the ellipse shape. For Rectangle, you can click as many
points as you like that are in the interior of the region you wish to
retain.
Apply which cycle's cropping pattern?
Specify how a given cropping pattern should be
applied to other image cycles:
- First: The cropping pattern from the first image cycle is applied to all
subsequent cyles. This is useful if the first image is intended to function as a template
in some fashion.
- Every: Every image cycle is cropped individually.
Left and right rectangle positions
(Used only if Rectangle selected as cropping shape, or if using Plate Fix)
Specify the left and right positions for the bounding rectangle by selecting one of the following:
- Absolute: Specify these values as absolute pixel
coordinates in the original image. For instance, you might enter
"25", "225", and "Absolute" to create a 200×200 pixel image that is
25 pixels from the top-left corner.
- From edge: Specify the position relative to the image
edge. For instance, you might enter "25", "25", and "Edge" to
crop 25 pixels from both the left and right edges of the image, irrespective
of the image's original size.
Top and bottom rectangle positions
(Used only if Rectangle selected as cropping shape, or if using Plate Fix)
Specify the top and bottom positions for the bounding rectangle by selecting one of the following:
- Absolute: Specify these values as absolute pixel coordinates.
For instance, you might enter "25", "225", and "Absolute"
to create a 200×200 pixel image that's 25 pixels
from the top-left corner.
- From edge: Specify position relative to the image edge.
For instance, you might enter "25", "25", and "Edge" to
crop 25 pixels from the edges of your images irrespective
of their size.
Coordinates of ellipse center
(Used only if Ellipse selected as cropping shape)
Specify the center pixel position of the ellipse.
Ellipse radius, X direction
(Used only if Ellipse selected as cropping shape)
Specify the radius of the ellipse in the X direction.
Ellipse radius, Y direction
(Used only if Ellipse selected as cropping shape)
Specify the radius of the ellipse in the Y direction.
Use Plate Fix?
(Used only if Image selected as cropping shape)
Select
Yes to attempt to regularize the edges around a previously-identified
plate object.
When attempting to crop based on a previously identified object
such as a rectangular plate, the plate may not have
precisely straight edges: there might be a tiny, almost unnoticeable
"appendage" sticking out. Without Plate Fix, the Crop
module would not crop the image tightly enough: it would retain the tiny appendage, leaving a lot
of blank space around the plate and potentially causing problems with later
modules (especially ones involving illumination correction).
Plate Fix takes the
identified object and crops to exclude any minor appendages (technically,
any horizontal or vertical line where the object covers less than 50% of
the image). It also sets pixels around the edge of the object (for
regions greater than 50% but less than 100%) that otherwise would be 0 to the
background pixel value of your image, thus avoiding problems with
other modules.
Important note: Plate Fix uses the coordinates
entered in the boxes normally used for rectangle cropping (Top, Left and
Bottom, Right) to tighten the edges around your identified plate. This
is done because in the majority of plate identifications you do not want
to include the sides of the plate. If you would like the entire plate to
be shown, you should enter "1:end" for both coordinates. If, for example, you would like
to crop 80 pixels from each edge of the plate, you could enter Top, Left and Bottom,
Right values of 80 and select From edge.
Remove empty rows and columns?
Use this option to choose whether to remove rows and columns that lack objects:
- No: Leave the image the same size. The cropped areas will be set
to zeroes, and will appear as black.
- Edges: Crop the image so that its top, bottom, left and right are at
the first non-blank pixel for that edge.
- All: Remove any row or column of all-blank pixels, even from the
internal portion of the image.
Select the masking image
(Used only if Image selected as cropping shape)
Select the image to be use as a cropping mask.
Select the image with a cropping mask
(Used only if Previous cropping selected as cropping shape)
Select the image associated with the cropping mask that you want to use.
Select the objects
(Used only if Objects selected as cropping shape)
Select the objects that are to be used as a cropping mask.