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
backgroundSourcehas exactly zero channels, an empty zero-valued monochrome background is used (unsigned 8 bit). - If
backgroundSourcehas exactly one channel, it's used as a monochrome background - If
backgroundSourcehas exactly three channels, it's used as a RGB background - If
backgroundSourcehas any other number of channels, the first channel is used as a background.
- Author:
- Owen Feehan
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic OutlinePreserveRelativeSizecreateToColorUnselectedObjects(Interpolator interpolator) Alternative constructor that switches on the coloring of unselected objects by default.intUses 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 backgroundintThe width of the outline.getSize()Size of all created thumbnailsbooleanWhether objects may overlap or not when unscaled.voidsetBackgroundChannelIndex(int backgroundChannelIndex) Uses only this channel (identified by an index in the stack) as the background, -1 disables.voidsetColorUnselectedObjects(RGBColorBean colorUnselectedObjects) Optionally outline the other (unselected for the thumbnail) objects in this particular color.voidsetDisplayer(StackDisplayer displayer) How to convert an image so that it can be displayed.voidsetInterpolator(Interpolator interpolator) Interpolator used when scaling the backgroundvoidsetOutlineWidth(int outlineWidth) The width of the outline.voidsetOverlappingObjects(boolean overlappingObjects) Whether objects may overlap or not when unscaled.voidSize 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
OutlinePreserveRelativeSizethat 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:ThumbnailFromObjectsInitializes a batch to create thumbnails.A batch is a set of objects which are calibrated together (to have the same scale etc.)
- Specified by:
startin 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
ThumbnailBatchinterface 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.
-