Class OutlinePreserveRelativeSize
Preserves the relative-size between objects (i.e. they are all reduced by the same scale-factor) in the same batch.
If it's a z-stack, a maximum intensity projection is first applied.
All thumbnails are created with identical size. An error will occur if the background is ever smaller than the thumbnail size.
If no specific background-channel is set with setBackgroundChannelIndex(int)
then the
following scheme applies:
- If
backgroundSource
has exactly zero channels, an empty zero-valued monochrome background is used (unsigned 8 bit). - If
backgroundSource
has exactly one channel, it's used as a monochrome background - If
backgroundSource
has exactly three channels, it's used as a RGB background - If
backgroundSource
has any other number of channels, the first channel is used as a background.
- Author:
- Owen Feehan
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic OutlinePreserveRelativeSize
createToColorUnselectedObjects
(Interpolator interpolator) Alternative constructor that switches on the coloring of unselected objects by default.int
Uses only this channel (identified by an index in the stack) as the background, -1 disables.Optionally outline the other (unselected for the thumbnail) objects in this particular color.How to convert an image so that it can be displayed.Interpolator used when scaling the backgroundint
The width of the outline.getSize()
Size of all created thumbnailsboolean
Whether objects may overlap or not when unscaled.void
setBackgroundChannelIndex
(int backgroundChannelIndex) Uses only this channel (identified by an index in the stack) as the background, -1 disables.void
setColorUnselectedObjects
(RGBColorBean colorUnselectedObjects) Optionally outline the other (unselected for the thumbnail) objects in this particular color.void
setDisplayer
(StackDisplayer displayer) How to convert an image so that it can be displayed.void
setInterpolator
(Interpolator interpolator) Interpolator used when scaling the backgroundvoid
setOutlineWidth
(int outlineWidth) The width of the outline.void
setOverlappingObjects
(boolean overlappingObjects) Whether objects may overlap or not when unscaled.void
Size of all created thumbnailsstart
(ObjectCollection objects, StreamableCollection<BoundingBox> boundingBoxes, Optional<Stack> backgroundSource, ExecutionTimeRecorder executionTimeRecorder) Initializes a batch to create thumbnails.Methods inherited from class org.anchoranalysis.bean.AnchorBean
checkMisconfigured, describeBean, describeChildren, duplicateBean, fields, findFieldsOfClass, getBeanName, getLocalPath, localise, toString
-
Constructor Details
-
OutlinePreserveRelativeSize
public OutlinePreserveRelativeSize()
-
-
Method Details
-
createToColorUnselectedObjects
Alternative constructor that switches on the coloring of unselected objects by default.They are colored in blue.
- Parameters:
interpolator
- how to resize an image.- Returns:
- a newly created instance of
OutlinePreserveRelativeSize
that colors unselected objects, but otherwise uses defaults.
-
start
public ThumbnailBatch<ObjectCollection> start(ObjectCollection objects, StreamableCollection<BoundingBox> boundingBoxes, Optional<Stack> backgroundSource, ExecutionTimeRecorder executionTimeRecorder) throws OperationFailedException Description copied from class:ThumbnailFromObjects
Initializes a batch to create thumbnails.A batch is a set of objects which are calibrated together (to have the same scale etc.)
- Specified by:
start
in classThumbnailFromObjects
- Parameters:
objects
- the entire set of objects in the batch (for which thumbnails may be subsequently created)boundingBoxes
- bounding-boxes that minimally enclose all the inputs to feature rows (e.g. a pair of objects or a single-object) and can be used for guessing scale-factors. A supplier is used as the stream may be desired multiple times.backgroundSource
- a stack that will be used to form the background (or some part of may be used)executionTimeRecorder
- records execution time for various operations- Returns:
- a
ThumbnailBatch
interface to create thumbnails for individual objects - Throws:
OperationFailedException
- if the batch initialization fails
-
getSize
Size of all created thumbnails -
setSize
Size of all created thumbnails -
getBackgroundChannelIndex
public int getBackgroundChannelIndex()Uses only this channel (identified by an index in the stack) as the background, -1 disables. -
setBackgroundChannelIndex
public void setBackgroundChannelIndex(int backgroundChannelIndex) Uses only this channel (identified by an index in the stack) as the background, -1 disables. -
getInterpolator
Interpolator used when scaling the background -
setInterpolator
Interpolator used when scaling the background -
getOutlineWidth
public int getOutlineWidth()The width of the outline. By default, it's 3 as it's nice to have a strongly easily-visible emphasis on where the object is in a thumbnail. -
setOutlineWidth
public void setOutlineWidth(int outlineWidth) The width of the outline. By default, it's 3 as it's nice to have a strongly easily-visible emphasis on where the object is in a thumbnail. -
getColorUnselectedObjects
Optionally outline the other (unselected for the thumbnail) objects in this particular color. If not set, these objects aren't outlined at all. -
isOverlappingObjects
public boolean isOverlappingObjects()Whether objects may overlap or not when unscaled.If they overlap, we scale them individually, not taking account of their neighbours.
If they may not overlap, we scale them collectively, as visually this gives tighter borders between neighbouring objects.
-
setOverlappingObjects
public void setOverlappingObjects(boolean overlappingObjects) Whether objects may overlap or not when unscaled.If they overlap, we scale them individually, not taking account of their neighbours.
If they may not overlap, we scale them collectively, as visually this gives tighter borders between neighbouring objects.
-
getDisplayer
How to convert an image so that it can be displayed. -
setDisplayer
How to convert an image so that it can be displayed.
-